From: Christian Brauner <brauner@kernel.org>
To: Song Liu <songliubraving@meta.com>
Cc: Paul Moore <paul@paul-moore.com>,
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>,
"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: Thu, 10 Jul 2025 13:46:42 +0200 [thread overview]
Message-ID: <20250710-roden-hosen-ba7f215706bb@brauner> (raw)
In-Reply-To: <1959367A-15AB-4332-B1BC-7BBCCA646636@meta.com>
On Wed, Jul 09, 2025 at 05:06:36PM +0000, Song Liu wrote:
> 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've multiple times pointed out that the current mount security hooks
aren't working and basically everything in the new mount api is
unsupervised from an LSM perspective.
My recommendation is make a list of all the currently supported
security_*() hooks in the mount code (I certainly don't have them in my
head). Figure out what each of them allow to mediate effectively and how
the callchains are related.
Then make a proposal how to replace them with something that a) doesn't
cause regressions which is probably something that the LSMs care about
and b) that covers the new mount API sufficiently to be properly
mediated.
I'll happily review proposals. Fwiw, I'm pretty sure that this is
something that Mickael is interested in as well.
next prev parent reply other threads:[~2025-07-10 11:46 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
2025-07-10 11:46 ` Christian Brauner [this message]
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=20250710-roden-hosen-ba7f215706bb@brauner \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=apparmor@lists.ubuntu.com \
--cc=ast@kernel.org \
--cc=bpf@vger.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=songliubraving@meta.com \
--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®