From: Casey Schaufler <casey@schaufler-ca.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
casey.schaufler@intel.com, paul@paul-moore.com,
linux-security-module@vger.kernel.org
Cc: john.johansen@canonical.com, keescook@chromium.org,
selinux@vger.kernel.org, jmorris@namei.org,
linux-kernel@vger.kernel.org, linux-audit@redhat.com
Subject: Re: [PATCH v38 04/39] LSM: Maintain a table of LSM attribute data
Date: Mon, 24 Oct 2022 09:37:52 -0700 [thread overview]
Message-ID: <7263e155-9024-0508-370c-72692901b326@schaufler-ca.com> (raw)
In-Reply-To: <55f27f99-3a2b-3482-6dc2-12203948dd35@I-love.SAKURA.ne.jp>
On 10/24/2022 8:13 AM, Tetsuo Handa wrote:
> On 2022/10/24 2:13, Casey Schaufler wrote:
>>> We won't be able to accept whatever LSM modules to upstream, and we won't
>>> be able to enable whatever LSM modules in distributor kernels.
>> A built in module loader security module would address this issue.
>> Getting such a module accepted upstream is not going to be trivial,
>> but the BPF people seem to have managed it.
> How can we guarantee that a built-in module loader security module is
> always built-in ?
You can't. That's up to the distribution. Just like BPF.
> What I'm insisting is that "warrant the freedom to load
> loadable LSM modules without recompiling the whole kernel".
Since security modules are optional and the LSM infrastructure
itself is optional you can't ensure that any given kernel would
support a loadable security module.
> Sure, we can load LSM modules which were not built into distributor kernels
> if we can recompile the whole kernel". But give me a break, that's a stupid
> opinion for non-kernel developers. People won't replace distributor kernels
> with rebuilt kernels only for enabling LSM modules which were not built into
> distributor kernels.
>
> Quoting from https://lkml.kernel.org/r/7f9ffd77-a329-ab13-857b-f8e34b2bfc77@schaufler-ca.com
>
> > I'm waiting to see what happens if eBPF security modules
> > become popular. I can easily see distributions turning the BPF LSM off.
>
> Even if TOMOYO could be rewritten in eBPF (I don't think it is possible), how TOMOYO
> can be loaded into distributor kernels if distributions turn the BPF LSM off ?
>
> > Before I go any further, I think that the loadable module manager LSM would be
> > very hard to get upstream.
>
> Not only it will be very hard to get the loadable module manager LSM upstream,
> it will be also very hard to keep the loadable module manager LSM enabled in
> distributor kernels.
That is correct.
>
> Again, how can we guarantee that a built-in module loader security module is
> always built-in ?
Again, you can't. You can't guarantee that the LSM infrastructure is built in.
> What I'm insisting is that "warrant the freedom to load loadable LSM modules
> without recompiling the whole kernel".
>
> Adding EXPORT_SYMBOL_GPL(security_hook_heads) is the only way that can "allow
> LSM modules which distributors cannot support to be legally loaded".
I believe that I've identified an alternative. It isn't easy or cheap.
>
> Any fixed-sized array like lsm_idlist[LSMID_ENTRIES] that defines max capacity
> based on whether that LSM module is built-in will lock out loadable LSM modules.
> Thus, I'm not happy with LSMID_ENTRIES.
>
>
>
> On 2022/10/24 2:20, Casey Schaufler wrote:
>> On 10/23/2022 3:10 AM, Tetsuo Handa wrote:
>>> On 2022/10/23 16:27, Tetsuo Handa wrote:
>>>> On 2022/10/21 8:42, Casey Schaufler wrote:
>>>>> I will, on the other hand, listen to compelling arguments. It is not the
>>>>> intention of this code to lock out loadable modules. If I thought it would
>>>>> I would not have proposed it.
>>>> This code is exactly for locking out loadable modules.
>>>>
>>> Imagine a situation where two individuals independently develop their own
>>> web applications using the same identifier, and then their web applications
>>> started working together with other web applications using that identifier.
>>> When they published their web applications for public and wider use, a problem
>>> that both web applications are already using the same identifier arises.
>>> It is too late to reassign the identifier.
>>>
>>> The same trouble can happen with loadable LSM modules. Unless the upstream kernel
>>> behaves as if a DNS registerer that assigns a unique domainname for whatever web
>>> sites (regardless of whether a web site is for public or not), defining a permanent
>>> constant for LSM module is a way towards locking out loadable LSM modules. And it
>>> is well possible that a loadable LSM module wants to run on older kernels which
>>> do not have LSM id defined yet.
>>>
>>> This "define LSM id as userspace visible constant" is more dangerous than just
>>> reserving some space for future use. You are trying to control all IP addresses
>>> for the sake of only in-tree LSM modules. No, no, no, please don't do that...
>> It's really no more dangerous than using the LSM name. What if two developers
>> implement modules and both name it "belllapadula"? User space won't be able to
>> tell the difference if they base behavior on the module name. That's one thing
>> that a loadable module mechanism is going to need to address that a built-in
>> mechanism doesn't.
> If the upstream kernel assigns an LSM id for all LSM modules including out-of-tree
> and/or private LSM modules (that's why I described that the upstream kernel behaves
> as if a DNS registerer), we can assign LSM id = 100 to "belllapadula" from A and
> LSM id = 101 to "belllapadula" from B, and both "belllapadula" modules can work
> without conflicts by using LSM id. Of course, this implies that we need to preserve
> unused space in lsm_idlist[LSMID_ENTRIES] etc. for such LSM modules (if we use
> fixed-sized array rather than a linked list).
Of course the upstream kernel isn't going to have LSM IDs for out-of-tree
security modules. That's one of many reasons loadable modules are going to
have to be treated differently from built-in modules, if they're allowed
at all.
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
next prev parent reply other threads:[~2022-10-24 16:38 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220927195421.14713-1-casey.ref@schaufler-ca.com>
2022-09-27 19:53 ` [PATCH v38 00/39] LSM: Module stacking for AppArmor Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 01/39] LSM: Identify modules by more than name Casey Schaufler
2022-10-12 21:14 ` Mickaël Salaün
2023-03-03 15:17 ` Georgia Garcia
2023-03-03 16:52 ` Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 02/39] LSM: Add an LSM identifier for external use Casey Schaufler
2022-10-12 21:14 ` Mickaël Salaün
2022-10-20 22:47 ` Casey Schaufler
2023-03-03 17:14 ` Georgia Garcia
2022-09-27 19:53 ` [PATCH v38 03/39] LSM: Identify the process attributes for each module Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 04/39] LSM: Maintain a table of LSM attribute data Casey Schaufler
2022-10-13 10:04 ` Tetsuo Handa
2022-10-20 23:42 ` Casey Schaufler
2022-10-23 7:27 ` Tetsuo Handa
2022-10-23 10:10 ` Tetsuo Handa
2022-10-23 17:20 ` Casey Schaufler
2022-10-23 17:13 ` Casey Schaufler
2022-10-24 15:13 ` Tetsuo Handa
2022-10-24 16:37 ` Casey Schaufler [this message]
2022-10-25 9:59 ` Tetsuo Handa
2022-09-27 19:53 ` [PATCH v38 05/39] proc: Use lsmids instead of lsm names for attrs Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 06/39] LSM: lsm_self_attr syscall for LSM self attributes Casey Schaufler
2022-09-27 22:45 ` kernel test robot
2022-09-28 11:04 ` kernel test robot
2022-10-12 21:16 ` Mickaël Salaün
2022-10-20 15:44 ` Paul Moore
2022-10-20 16:13 ` Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 07/39] integrity: disassociate ima_filter_rule from security_audit_rule Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 08/39] LSM: Infrastructure management of the sock security Casey Schaufler
2022-10-12 21:17 ` Mickaël Salaün
2022-09-27 19:53 ` [PATCH v38 09/39] LSM: Add the lsmblob data structure Casey Schaufler
2022-10-12 21:18 ` Mickaël Salaün
2022-09-27 19:53 ` [PATCH v38 10/39] LSM: provide lsm name and id slot mappings Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 11/39] IMA: avoid label collisions with stacked LSMs Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 12/39] LSM: Use lsmblob in security_audit_rule_match Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 13/39] LSM: Use lsmblob in security_kernel_act_as Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 14/39] LSM: Use lsmblob in security_secctx_to_secid Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 15/39] LSM: Use lsmblob in security_secid_to_secctx Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 16/39] LSM: Use lsmblob in security_ipc_getsecid Casey Schaufler
2022-09-27 19:53 ` [PATCH v38 17/39] LSM: Use lsmblob in security_current_getsecid Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 18/39] LSM: Use lsmblob in security_inode_getsecid Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 19/39] LSM: Use lsmblob in security_cred_getsecid Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 20/39] LSM: Specify which LSM to display Casey Schaufler
2022-10-12 21:19 ` Mickaël Salaün
2022-09-27 19:54 ` [PATCH v38 21/39] LSM: Ensure the correct LSM context releaser Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 22/39] LSM: Use lsmcontext in security_secid_to_secctx Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 23/39] LSM: Use lsmcontext in security_inode_getsecctx Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 24/39] Use lsmcontext in security_dentry_init_security Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 25/39] LSM: security_secid_to_secctx in netlink netfilter Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 26/39] NET: Store LSM netlabel data in a lsmblob Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 27/39] binder: Pass LSM identifier for confirmation Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 28/39] LSM: security_secid_to_secctx module selection Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 29/39] Audit: Keep multiple LSM data in audit_names Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 30/39] Audit: Create audit_stamp structure Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 31/39] LSM: Add a function to report multiple LSMs Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 32/39] Audit: Allow multiple records in an audit_buffer Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 33/39] Audit: Add record for multiple task security contexts Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 34/39] audit: multiple subject lsm values for netlabel Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 35/39] Audit: Add record for multiple object contexts Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 36/39] netlabel: Use a struct lsmblob in audit data Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 37/39] LSM: Removed scaffolding function lsmcontext_init Casey Schaufler
2022-09-27 19:54 ` [PATCH v38 38/39] AppArmor: Remove the exclusive flag Casey Schaufler
2022-09-27 20:31 ` [PATCH v38 39/39] LSM: Create lsm_module_list system call Casey Schaufler
2022-09-28 14:27 ` kernel test robot
2022-10-12 21:19 ` Mickaël Salaün
2022-10-20 20:28 ` Casey Schaufler
2022-10-12 22:04 ` Kees Cook
2022-10-25 0:39 ` Casey Schaufler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7263e155-9024-0508-370c-72692901b326@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=casey.schaufler@intel.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox