[PATCH 0/8] ns: fixes for the namespace LSM hooks
Paul Moore
paul at paul-moore.com
Wed Oct 28 15:59:12 UTC 2026
On Wed, Oct 28, 2026 at 6:45 AM Christian Brauner <brauner at kernel.org> wrote:
> On Tue, Oct 27, 2026 at 06:37:43PM -0400, Paul Moore wrote:
> > The hooks were merged into the LSM tree on August 31st, and due to
> > timing I'm guessing they appeared in linux-next the next day,
> > September 1st. Considering the merge window opened on October
> > 18th/19th, that's conservatively a month and a half during which
> > testing could have uncovered this issue and the behavior of the hook
> > could have been changed to accommodate your use-case.
>
> That's what the rc cycle is for.
I believe the understanding is that basic functional testing occurs
before the RC cycle. Considering the NULL check causing problems for
your use case was present in your first RFC posting back in February,
it's unlikely that you, or anyone in the BPF LSM space, tested this
prior to the merge window.
> I'm not asking for changes to behavior
> of the hooks to accommodate anything.
The LSM changes in this patchset do change the behavior, that's the
point. The security_namespace_free() hook does not call into the
individual LSM callbacks if no LSM blobs have been requested; what you
are proposing now is that we change the hook so that the callback is
always called, regardless of the LSM blob state.
> > I know the
> > Landlock folks were testing the hooks for their usage, but I've gone
> > back through my inbox and I don't see any reports of BPF LSM failures
> > using these new hooks in v7.4 until you posted this patchset during
> > the merge window.
>
> Because I sent fixes instead of a bug report.
... which you sent *after* the merge window opened. Once again, I see
no indication that the use case you are concerned about was ever
tested prior to the merge window.
> > The LSM namespace hooks are new to Linux v7.4, they did not exist in
> > Linus' tree prior to this merge window which is why I consider both
> > the BPF LSM and Landlock usage of these hooks to be "new".
>
> Yes, they're new. That's the argument for fixing them now. Not against
> it. No released kernel has these hooks. Once v7.4 is out every one of
> these fixes is a behavior change in a released kernel, needs a stable
> backport that by your own rules doesn't qualify.
>
> And on top of that nonsense, userspace has to probe for it forever.
It's a one line change in kernel/bpf/bpf_lsm.c to add the
security_namespace_free() to the existing list of disabled BPF LSM
callbacks. No need for a patchset spanning 16 files and over 350
lines of changes; the BPF LSM callback can be enabled in Linux v7.5
after it has been properly tested.
It is probably also worth mentioning again to casual observers that
the LSM hooks, and their associated callbacks, are intentionally not a
stable API. LSMs are advised to implement abstractions before
exposing the hook/callback API directly to user-visible interfaces
such as configuration policy, policy as code, etc.
> > As mentioned previously, I'm pretty consistent about what goes up to
> > Linus once the merge window opens: there is the initial pull-request
> > with the changes from the last development cycle and then after that
> > I'm pretty strict about only serious bugs/panics and regressions.
>
> Your README says "serious problems", not panics.
Are we really going to argue about how one defines "serious problems"
and "panics"? You'll notice that I've used "serious problems" and
"panic" somewhat loosely in this email thread because the distinction
doesn't really apply to our discussion. The issue you've brought up
is that a use case that was never tested prior to the merge window
doesn't work like you want it to work. There is no kernel panic nor
any functional regression from previous kernel releases (user visible
or otherwise). We'll change how the security_namespace_free() LSM
hook works for the next release which should give you plenty of time
to test that it works properly.
> A hook that is
> exported to bpf as an attach point and never called is a serious
> problem for an API.
I'll repeat myself again, a little louder for those in the back: the
LSM hooks and callbacks are not a stable API, if an individual LSM
needs a stable API to expose to userspace it needs to provide its own
abstraction layer.
> And it's not how you've handled this before: lsm_get_self_attr() was new
> in v6.8 and got fixed for apparmor and selinux at v6.8-rc7 (cf. [2]).
> v7.1-rc5 took Stephen's cred_guard_mutex change for lsm_set_self_attr()
> without a crash see (cf. [3]).
There is an important difference between those issues and the one
you've identified with this patchset: lsm_get_self_attr() and
lsm_set_self_attr() are syscalls while security_namespace_free() is a
LSM hook. Linux syscalls are subject to the Linux kernel stable API,
LSM hooks are not. Linux syscalls are directly accessible from
userspace, LSM hooks are not. We could dive into other minutiae about
the differences between those issues, but the distinction between
syscalls and LSM hooks is really the only one that should matter here.
> > Disabling the BPF LSM support for the new hooks in Linux v7.4 should
> > be relatively easy, much simpler than this patchset, and eliminate any
> > claimed harm.
>
> No. That's a change to kernel/bpf/bpf_lsm.c which you don't maintain
> and the people who do have acked the fixes and asked for the whole
> series in v7.4.
:D
Instead you're asking someone else to accept your changes in a
subsystem you don't maintain and when they push back due to lack of
testing and existing conventions you decide the proper approach is to
bully them and force the issue with Linus? I'm used to dealing with
hypocrisy but this is truly something else ...
> You're proposing to rip working functionality out of someone else's code
> so you don't have to take a three line deletion. namespace_init and
> namespace_install work fine for bpf.
>
> It's also not simpler. The LSM part of this series is deleting three
> lines I wrote in security.c. The rest is my code and bpf's code with
> acks. Your version needs a revert in v7.5 so it's two cross-tree changes
> instead of one.
Adding security_namespace_free() the the disabled BPF LSM hook list
should be a one line change in Linux v7.4 (maybe three if you need a
Kconfig conditional for something) and then a one (maybe three) line
change in Linux v7.5 to allow it again. Two patches, each at most
three lines, all contained within the BPF subsystem.
> > Also, as the ongoing friction between the LSM and BPF developers was
> > brought up, I want to point out that SELinux support for the new LSM
> > namespace hooks was delayed to Linux v7.5 due to issues uncovered with
> > these new hooks during the Linux v7.4 development cycle (well before
> > the merge window opened).
>
> That's not what happened. Stephen posted the fix on September 16, v3 on
> September 18. I reviewed it on September 25 and offered to carry it in
> the namespace tree for v7.4.
>
> On September 29 you said you'd rather take it through lsm/dev. It's not
> in lsm/dev. It's not in v7.4. A reviewed fix that was ready three weeks
> before the merge window didn't get applied. That's the same decision
> you're making now and it's not a precedent for it.
If you look at that thread, you'll notice I ended my last mail with a
"Are we all okay with that for this patch?" because I wanted to make
sure everyone was okay with the patch, and the process before merging
it. Stephen answered that he was okay with the approach and you never
responded; I held the patch back exactly because you never explicitly
okay'd the approach. I suspect one could make a lot of interesting
observations both about how that patch was handled, and how that
handling is now viewed from different perspectives.
> > I told you "next merge window", which is far from "no".
>
> For v7.4 it is "no". That's the release these hooks go out in. It means
> v7.4 ships with a namespace_free hook that never fires and v7.4.y stays
> that way because by your own rules the fix doesn't qualify for stable.
>
> > I'll admit to finding it odd that you seem to keep inserting yourself
> > into that friction point
>
> A large portion of code where new security functionality is added or
> modified all of the time is maintained by me and others.
... and when it suits you, or the BPF developers, you override or
otherwise steal ownership from the LSM space. We obviously see things
different here, but if you're trying to convince me that you are doing
the Right Thing by inserting yourself into some of these discussions,
e.g. the recent LSM kfunc discussion, you are wasting your time. To
borrow a phrase from Alexei's last email on that subject, "I don't
feel we will converge here".
> You're objection is noted and I'll mention it to Linus and then he can
> decide.
Please CC the LSM list and me. I would also encourage you to disclose
the lack of testing you have done prior to the merge window as well as
your insistence that the LSM hooks become a stable API; if Linus is
going to change any of these policies it would be good to know.
--
paul-moore.com
More information about the Linux-security-module-archive
mailing list