Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp638270rwi; Thu, 13 Oct 2022 03:13:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77Dvq92TskLZmqjtEqwLWEJCj0E8dmRdW6roUv26kqs3+CZaGjtpyOMCRYsEVt5JUOjDLv X-Received: by 2002:aa7:d28c:0:b0:459:3cc5:3cb8 with SMTP id w12-20020aa7d28c000000b004593cc53cb8mr32420965edq.261.1665656028243; Thu, 13 Oct 2022 03:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665656028; cv=none; d=google.com; s=arc-20160816; b=yFQMmQlkCv0YAv18he+UcxiymLp3AUzlymvxQlCME+U/8PWjb1cx/41KJoHZVZhT9R 5rk+F2JvlY/J/qTilIeNAQoMU+9yRqea8Gxi58pyBW3K7C6FTz9+1MwSPPTnitLJDAIz Ahi20XODUC2yeZvCOYHTI4ZheNx5nP8NJzLwAXRcMA0uIZKOXqLISqOmCZX18VLBIBgm dPC7FP67d56C1XPdMOKwQKRQ40C6WBx6FWr/unyHoQVtuU7e7AkYG/bFYgtO6MAeaeaY 1PN1LanD4JHoiQH3+gAcxA/6oN6+GoA3ObRvj9oSVch/HCAHTQUD55OhtLk2X9i3ABLK 7UCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=JcaACVyuCJee0fNzuqJY93CHBEwsNA8Dii6Vxb0hZIc=; b=Gj/Blta8y+5OQ9VycwuFozeowDVgBT0FNdgSe4Rs+BvBhQH7vUqJtbEJs6U2lNQhPf sGxV4a04668RZ/kTQuva8G+fu6/zfRiUrMg+xUcmD7mPNLlBne8PlbeqaLPmajzy2k25 ZknOu+uy6GVHAczGmxjzSB14ouvQTAM21xkc3ufBpMCu3h3OpYjfWu9D3rI29p+7cWvy 3GhuDOH6uY8ixoc9EzUDr9ArhT6nGqHlYCmPhI6G1WH21TxuGsV2aOjWka5fcvr/6BYv eOSoCsKbQCNpcx7U98tVmqTW35MXR3OyMTGot9wPbRbpZURlavraTT/y9cTUAcV/cdrT xhtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm8-20020a170907948800b0078def5c29e3si4407816ejc.596.2022.10.13.03.13.21; Thu, 13 Oct 2022 03:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbiJMKEN (ORCPT + 99 others); Thu, 13 Oct 2022 06:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiJMKEK (ORCPT ); Thu, 13 Oct 2022 06:04:10 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752D8E0F for ; Thu, 13 Oct 2022 03:04:09 -0700 (PDT) Received: from fsav118.sakura.ne.jp (fsav118.sakura.ne.jp [27.133.134.245]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 29DA47B6033225; Thu, 13 Oct 2022 19:04:07 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav118.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav118.sakura.ne.jp); Thu, 13 Oct 2022 19:04:07 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav118.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 29DA47NY033222 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Oct 2022 19:04:07 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <9907d724-4668-cd50-7454-1a8ca86542b0@I-love.SAKURA.ne.jp> Date: Thu, 13 Oct 2022 19:04:05 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v38 04/39] LSM: Maintain a table of LSM attribute data Content-Language: en-US To: Casey Schaufler , casey.schaufler@intel.com, paul@paul-moore.com, linux-security-module@vger.kernel.org Cc: linux-audit@redhat.com, jmorris@namei.org, selinux@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org References: <20220927195421.14713-1-casey@schaufler-ca.com> <20220927195421.14713-5-casey@schaufler-ca.com> From: Tetsuo Handa In-Reply-To: <20220927195421.14713-5-casey@schaufler-ca.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/09/28 4:53, Casey Schaufler wrote: > @@ -483,6 +491,16 @@ void __init security_add_hooks(struct security_hook_list *hooks, int count, > { > int i; > > + /* > + * A security module may call security_add_hooks() more > + * than once. Landlock is one such case. > + */ > + if (lsm_id == 0 || lsm_idlist[lsm_id - 1] != lsmid) > + lsm_idlist[lsm_id++] = lsmid; > + > + if (lsm_id > LSMID_ENTRIES) > + panic("%s Too many LSMs registered.\n", __func__); I'm not happy with LSMID_ENTRIES. This is a way towards forever forbidding LKM-based LSMs. I'm fine with using UAPI-visible constants for switching /proc/ files. But TOMOYO does not need such constant because TOMOYO does not use /proc/ files. Also, lsm_self_attr() will be limited for LSM modules which use /proc/ files, and therefore I think prctl() will be already there. > + > for (i = 0; i < count; i++) { > hooks[i].lsmid = lsmid; > hlist_add_tail_rcu(&hooks[i].list, hooks[i].head);