From: Song Liu <songliubraving@meta.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Song Liu <songliubraving@meta.com>, Song Liu <song@kernel.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
"jmorris@namei.org" <jmorris@namei.org>,
"serge@hallyn.com" <serge@hallyn.com>,
Kernel Team <kernel-team@meta.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Subject: Re: [PATCH] lsm: make SECURITY_PATH always enabled
Date: Wed, 23 Apr 2025 04:57:01 +0000 [thread overview]
Message-ID: <60CAF154-DADA-4C46-ADE8-403318EFDDAD@fb.com> (raw)
In-Reply-To: <CAHC9VhShOxu4Q9yV3tkST3P9SoiL3j3ET_O4_cPAV1ES5usd-A@mail.gmail.com>
Hi Paul,
Thanks for your comments!
> On Apr 22, 2025, at 2:13 PM, Paul Moore <paul@paul-moore.com> wrote:
[...]
>>
>> However, I don't think existing CONFIG_SECURITY_* are doing the right
>> things. Among all the configs, CONFIG_SECURITY_PATH is the most awkward
>> to me. Say , if we have CONFIG_SECURITY_PATH, shouldn't we also have
>> CONFIG_SECURITY_INODE? IOW, something like:
>>
>> #ifdef CONFIG_SECURITY_INODE
>> int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
>> #endif
>>
>> #ifdef CONFIG_SECURITY_PATH
>> int security_path_rmdir(struct inode *dir, struct dentry *dentry);
>> #endif
>
> Without putting much thought into what would fall under
> CONFIG_SECURITY_INODE, I think it would be interesting to see what
> hooks one might be able to make conditional on such a Kconfig knob.
> Using security_inode_permission() as a simple test, it looks like only
> SELinux and Smack provide implementations, spot checks on a few other
> security_*inode*() hooks shows similar, or even more limited, results.
>
> You would need to spend some time to determine what LSM hooks are used
> by which LSMs and adjust their Kconfigs appropriately for the new
> CONFIG_SECURITY_INODE knob, but if you do that then I think that would
> be okay.
Well, I was hoping to simplify the CONFIGs by removing one. So I am
not sure whether adding a new CONFIG is the right thing to do.
>
>> OR, maybe we should just remove security_inode_rmdir(), and users of
>> security_inode_rmdir() can just use security_path_rmdir() instead?
>
> Those two LSM hooks are called from slightly different places in the
> codepath which has an impact on their environment. For example, the
> inode variant doesn't have to deal with directory inodes that don't
> have a defined rmdir op, whereas the path variant does; the inode
> variant doesn't have to worry about S_KERNEL_FILE files, the inode
> variant has a refcount'd and locked dentry, etc. Moving an existing
> LSM, especially complex ones, from one LSM hook to another, is a
> delicate operation and might not be worth it for such a small return.
Given there is pushback when a new LSM hook is added, I assume
removing a hook (or merge two hooks into one) may be a good move.
Well, it is totally possible that I underestimated the complexity of
the work.
Thanks,
Song
next prev parent reply other threads:[~2025-04-23 4:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 18:44 [PATCH] lsm: make SECURITY_PATH always enabled Song Liu
2025-04-22 19:53 ` Paul Moore
2025-04-22 20:31 ` Song Liu
2025-04-22 21:13 ` Paul Moore
2025-04-23 4:57 ` Song Liu [this message]
2025-04-23 14:58 ` Paul Moore
2025-04-23 20:54 ` Song Liu
2025-04-23 21:23 ` Paul Moore
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=60CAF154-DADA-4C46-ADE8-403318EFDDAD@fb.com \
--to=songliubraving@meta.com \
--cc=jmorris@namei.org \
--cc=kernel-team@meta.com \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=serge@hallyn.com \
--cc=song@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.