Re: [BUG] bpf, lsm: new first argument in 7.4 inode hooks silently breaks BPF LSMs
From: Andrii Nakryiko
Date: Thu Nov 19 2026 - 13:00:21 EST
On Wed, Nov 18, 2026 at 7:14 AM Paul Mabileau
<paul.mabileau@xxxxxxxxxxxxx> wrote:
>
> Hello,
>
> On our end, we also have already merged code to adapt our eBPFs to the argument order change. However, we would still prefer if this easily-avoidable breakage could be fixed by moving the argument to the end, even if it means having to revert our fix.
>
> This is motivated by the fact that such a change is not made in place on our end because we ship our software to environments we don't control, meaning that any and potentially all versions ranging from 4.11 to the very latest should be supported, so the change is made by compiling and shipping a new variant of the concerned eBPFs for the version interval it is valid for (7.4+ in this case). And that has to be done every time there is an upstream change like this, so the total installation size and overall complexity grows accordingly.
>
> If we could avoid that, especially for such trivial root causes, it would be nice.
>
I agree, and that's why I'm asking Paul to accept the patch reordering
the newly added argument before 7.4 final is released.
I do not think that the maintainer's personal preference for argument
ordering beats real user pain.
> Best regards,
> Paul.
>
> ________________________________________
> From: Daan De Meyer <daan@xxxxxxxxxxxx>
> Sent: Wednesday, November 18, 2026 3:18 PM
> To: Ihor Solodrai
> Cc: roblabla; Andrii Nakryiko; Paul Moore; bpf@xxxxxxxxxxxxxxx; linux-security-module@xxxxxxxxxxxxxxx; Paul Mabileau; linux-kernel@xxxxxxxxxxxxxxx; Andrii Nakryiko
> Subject: Re: [BUG] bpf, lsm: new first argument in 7.4 inode hooks silently breaks BPF LSMs
>
> Note that we've already merged code in systemd that depends on the
> current argument order, so I'd really prefer if it didn't change. If
> it does, do cc me on the patch so I can fix the issue in systemd.
>
> Cheers,
>
> Daan
>
> On Wed, Nov 18, 2026 at 1:52 AM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
> >
> > On 11/9/26 8:07 AM, roblabla wrote:
> > > Hi,
> > >
> > > Thanks for the replies!
> > >
> > >> [...]
> > >
> > > So what would be really nice is a way to make eBPF code robust against
> > > kernel changes such that it either works, or fails to load, but doesn't
> > > do the halfway "loads but silently misbehaves". Here are two ideas that
> > > have been in the back of my mind that could help solve this issue (though
> > > I understand that they may be rather large changes, I'm putting them out
> > > there mostly as a conversation starter):
> > >
> > > 1. Could libbpf/the kernel have a mismatch check on hook arguments? I
> > > understand that libbpf and the verifier don't know the types a
> > > program expects, since BPF_PROG() only casts u64s. But the macro
> > > does know the types at compile time. Could it (or an opt-in variant)
> > > record the expected prototype in the program's BTF, so that libbpf
> > > can compare it against the LSM hook's prototype in vmlinux BTF and
> > > refuse to load on a mismatch?
> > >
> > > 2. Since kernel BTF has parameter names for the bpf_lsm_* functions,
> > > could we maybe have CO-RE-style relocation to resolve "the argument
> > > named dentry" to the argument index at load time? This way, adding a
> > > new argument could happen anywhere in the argument list without
> > > breaking eBPFs, and removing an argument will (correctly) cause our
> > > eBPF to stop loading. It does mean the eBPF programs must provide the
> > > same argument names, but maybe that's an acceptable tradeoff?
> >
[...]
> >
> > ---
> >
> > And just my 2c re argument ordering:
> >
> > Paul, with all due respect, prioritizing code style and personal
> > preferences over backwards compatibility is unreasonable even for
> > unimportant applications. And here we are talking about apps
> > implementing security policies, which many organizations (not just
> > companies) in the world rely on. Given the recent flood of
> > cybersecurity issues (in Linux and beyond), I don't see why would we,
> > as in kernel devs, intentionally make the defenders' job harder.
> >
> >
> > >
> > > Thanks,
> > > roblabla
> >