From: Song Liu <songliubraving@meta.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Song Liu <song@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
"apparmor@lists.ubuntu.com" <apparmor@lists.ubuntu.com>,
"selinux@vger.kernel.org" <selinux@vger.kernel.org>,
"tomoyo-users_en@lists.sourceforge.net"
<tomoyo-users_en@lists.sourceforge.net>,
"tomoyo-users_ja@lists.sourceforge.net"
<tomoyo-users_ja@lists.sourceforge.net>,
Kernel Team <kernel-team@meta.com>,
"andrii@kernel.org" <andrii@kernel.org>,
"eddyz87@gmail.com" <eddyz87@gmail.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"martin.lau@linux.dev" <martin.lau@linux.dev>,
"brauner@kernel.org" <brauner@kernel.org>,
"jack@suse.cz" <jack@suse.cz>,
"kpsingh@kernel.org" <kpsingh@kernel.org>,
"mattbobrowski@google.com" <mattbobrowski@google.com>,
"amir73il@gmail.com" <amir73il@gmail.com>,
"repnop@google.com" <repnop@google.com>,
"jlayton@kernel.org" <jlayton@kernel.org>,
"josef@toxicpanda.com" <josef@toxicpanda.com>,
"mic@digikod.net" <mic@digikod.net>,
"gnoack@google.com" <gnoack@google.com>,
"m@maowtm.org" <m@maowtm.org>,
"john.johansen@canonical.com" <john.johansen@canonical.com>,
"john@apparmor.net" <john@apparmor.net>,
"stephen.smalley.work@gmail.com" <stephen.smalley.work@gmail.com>,
"omosnace@redhat.com" <omosnace@redhat.com>,
"takedakn@nttdata.co.jp" <takedakn@nttdata.co.jp>,
"penguin-kernel@i-love.sakura.ne.jp"
<penguin-kernel@i-love.sakura.ne.jp>,
"enlightened@chromium.org" <enlightened@chromium.org>
Subject: Re: [RFC] vfs: security: Parse dev_name before calling security_sb_mount
Date: Wed, 9 Jul 2025 17:06:36 +0000 [thread overview]
Message-ID: <1959367A-15AB-4332-B1BC-7BBCCA646636@meta.com> (raw)
In-Reply-To: <CAHC9VhSS1O+Cp7UJoJnWNbv-Towia72DitOPH0zmKCa4PBttkw@mail.gmail.com>
Hi Al and Paul,
Thanks for your comments!
> On Jul 9, 2025, at 8:19 AM, Paul Moore <paul@paul-moore.com> wrote:
>
> On Wed, Jul 9, 2025 at 6:24 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>> On Tue, Jul 08, 2025 at 04:05:04PM -0700, Song Liu wrote:
>>> security_sb_mount handles multiple types of mounts: new mount, bind
>>> mount, etc. When parameter dev_name is a path, it need to be parsed
>>> with kern_path.
>
> ...
>
>> security_sb_mount() is and had always been a mind-boggling trash of an API.
>>
>> It makes no sense in terms of operations being requested. And any questions
>> regarding its semantics had been consistently met with blanket "piss off,
>> LSM gets to do whatever it wants to do, you are not to question the sanity
>> and you are not to request any kind of rules - give us the fucking syscall
>> arguments and let us at it".
>
> I'm not going to comment on past remarks made by other devs, but I do
> want to make it clear that I am interested in making sure we have LSM
> hooks which satisfy both the needs of the existing in-tree LSMs while
> also presenting a sane API to the kernel subsystems in which they are
> placed. I'm happy to revisit any of our existing LSM hooks to
> restructure them to better fit these goals; simply send some patches
> and let's discuss them.
>
>> Come up with a saner API. We are done accomodating that idiocy. The only
>> changes you get to make in fs/namespace.c are "here's our better-defined
>> hooks, please call <this hook> when you do <that>".
Right now, we have security_sb_mount and security_move_mount, for
syscall “mount” and “move_mount” respectively. This is confusing
because we can also do move mount with syscall “mount”. How about
we create 5 different security hooks:
security_bind_mount
security_new_mount
security_reconfigure_mount
security_remount
security_change_type_mount
and remove security_sb_mount. After this, we will have 6 hooks for
each type of mount (the 5 above plus security_move_mount).
>
> I don't have the cycles to revisit the security_sb_mount() hook
> myself, but perhaps Song Liu does with some suggestions/guidance from
> you or Christian on what an improved LSM hook would look like from a
> VFS perspective.
Thanks,
Song
next prev parent reply other threads:[~2025-07-09 17:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 23:05 Song Liu
2025-07-09 10:24 ` Al Viro
2025-07-09 15:19 ` Paul Moore
2025-07-09 17:06 ` Song Liu [this message]
2025-07-10 11:46 ` Christian Brauner
2025-07-10 17:00 ` Song Liu
2025-07-11 9:36 ` Christian Brauner
2025-07-11 16:22 ` Song Liu
2025-07-14 8:45 ` Christian Brauner
2025-07-14 15:10 ` Song Liu
2025-07-15 10:18 ` Christian Brauner
2025-07-15 22:31 ` Song Liu
2025-07-16 8:31 ` Christian Brauner
2025-07-16 17:12 ` Song Liu
2025-07-11 23:09 ` Song Liu
2025-07-10 21:40 ` 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=1959367A-15AB-4332-B1BC-7BBCCA646636@meta.com \
--to=songliubraving@meta.com \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=apparmor@lists.ubuntu.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=enlightened@chromium.org \
--cc=gnoack@google.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=john.johansen@canonical.com \
--cc=john@apparmor.net \
--cc=josef@toxicpanda.com \
--cc=kernel-team@meta.com \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=m@maowtm.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=mic@digikod.net \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=repnop@google.com \
--cc=selinux@vger.kernel.org \
--cc=song@kernel.org \
--cc=stephen.smalley.work@gmail.com \
--cc=takedakn@nttdata.co.jp \
--cc=tomoyo-users_en@lists.sourceforge.net \
--cc=tomoyo-users_ja@lists.sourceforge.net \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®