From: Justin Suess <utilityemal77@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Paul Moore <paul@paul-moore.com>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
kpsingh@kernel.org, matt@bobrowski.net, mic@digikod.net,
viro@zeniv.linux.org.uk, brauner@kernel.org, kees@kernel.org,
casey@schaufler-ca.com, gnoack@google.com, jack@suse.cz,
song@kernel.org, yonghong.song@linux.dev, martin.lau@linux.dev,
eddyz87@gmail.com, memxor@gmail.com, jolsa@kernel.org,
m@maowtm.org, bpf@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 04/15] lsm: Add the bpf_lsm_policy_release kfunc and policy object destructor
Date: Sun, 13 Sep 2026 20:20:41 -0400 [thread overview]
Message-ID: <aqcb2eXw61LaFaqY@zenbox> (raw)
In-Reply-To: <DLDL7KK3FZKU.17ADLLWJVXB5F@gmail.com>
On Sat, Sep 12, 2026 at 12:33:13PM -0700, Alexei Starovoitov wrote:
> On Fri Sep 11, 2026 at 10:26 PM PDT, Justin Suess wrote:
> >
> > If fs/, mm/, drivers/, net/, are permitted to have kfuncs, then why not
> > security/? kfuncs.rst doesn't seem to forbid this.
>
> because fs, mm, net see the value in bpf. bpf helps these subsytems
> to focus on their core technologies and moves policy decisions out of
> kernel and into bpf.
> while lsm people treat bpf as arch-enemy.
> kfuncs are not stable. we keep refactoring them.
> while lsm folks treat anything within *lsm* and *security* as stable apis.
> So any kfunc where they have a say, will become a huge burden for further
> bpf development.
>
There are patches on the front page of
lore.kernel.org/linux-security-module refactoring security
hooks and changing signatures. Security hooks and the LSM interface
is not stable, this is explicitly documented.
I deliberately chose kfuncs over helpers to avoid having the interface
be ossified.
> > Where would you point me to?
>
> landlock was designed for unprivileged users. bpf needs CAP_BPF.
> There is a fundamental disconnect. If you can tolerate CAP_BPF then
Landlock is for privileged and unprivileged users alike.
This patchset is designed to compose with unprivileged use seamlessly,
which works because of Landlock's monotonicity.
> just use bpf-lsm and implement whatever policy you need there.
> If bpf-lsm is missing a feature we can fix that.
Sure, in some perfect world in the future where every verifier
challenge is solved and BPF has feature parity with in-tree c on
a 1:1 basis, you could implement something like SELinux, or Landlock
in pure eBPF. It would be about as easy and trivial as building a
skyscraper from lego bricks.
There is an entire in-tree ecosystem of LSMs that would provide
BPF users with well-maintained, versioned, and tested access
control. Why force every eBPF program that needs to make security
decisions to reeinvent the wheel?
There are real eBPF users such as Tetragon, Falco, Tracee, that
could use an actively maintained implementation of security models that
exist in-tree in security/. This would make access control in eBPF much
less painful.
Instead of implementing every filesystem, network, and
socket access control, they can use existing solutions, and with
the userspace tooling that already exists. And they can
mix-and-match, doing custom logic/policy in BPF, and use what
they need in LSM, with BPF making policy decisions.
It would fix a real challenge that users have with eBPF, and wouldn't
take away from BPF's ability to do what it already does.
>
> and bpf shouldn't be calling into selinux/landlock internals.
>
Agreed. And this patchset doesn't call into landlock, it calls a
security hook. The LSM hook then dispatches to whatever LSM
owns the object.
BPF already calls into LSM through security hooks. This is no
different than bpf_map_create hooks.
Nothing about the way BPF works changes with this patchset.
There's no verifier internal changes. It doesn't call into
BPF internals at all, or define any new core constructs.
It just uses the same kfunc and kptr interface that is available
to everyone else in the kernel. I think this code could even
be written with zero changes in kernel/bpf, or files in
BPF's maintainer's entry, though I'd rather have both subsystems
coordinating and cooperating on the interface.
Thanks for your feedback (genuinely), I hope you know I make these
arguments in good faith even when things seem heated.
Thanks,
Justin
next prev parent reply other threads:[~2026-09-14 0:20 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 19:37 [PATCH bpf-next v3 00/15] BPF interface for applying Landlock rulesets Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 01/15] lsm: Add the LSM policy object lifetime hooks Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 02/15] lsm: Add the bprm_apply_policy_object LSM hook Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 03/15] lsm: Move the lsm_for_each_hook() macro to security/lsm.h Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 04/15] lsm: Add the bpf_lsm_policy_release kfunc and policy object destructor Justin Suess
2026-09-09 20:29 ` bot+bpf-ci
2026-09-09 21:34 ` Paul Moore
2026-09-09 22:20 ` Justin Suess
2026-09-09 23:08 ` Paul Moore
2026-09-12 3:37 ` Alexei Starovoitov
2026-09-12 5:26 ` Justin Suess
2026-09-12 19:33 ` Alexei Starovoitov
2026-09-13 19:41 ` Paul Moore
2026-09-13 23:24 ` LSM boundaries. Was: " Alexei Starovoitov
2026-09-14 0:10 ` Paul Moore
2026-09-14 2:24 ` Alexei Starovoitov
2026-09-14 0:20 ` Justin Suess [this message]
2026-09-14 2:31 ` Alexei Starovoitov
2026-09-09 19:37 ` [PATCH bpf-next v3 05/15] lsm: Add the bpf_lsm_policy_from_fd kfunc Justin Suess
2026-09-09 20:46 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 06/15] lsm: Add the bpf_lsm_policy_acquire kfunc Justin Suess
2026-09-09 20:30 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 07/15] lsm: Add the bpf_lsm_policy_apply_bprm kfunc Justin Suess
2026-09-12 3:38 ` Alexei Starovoitov
2026-09-12 5:39 ` Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 08/15] lsm: Document the LSM policy object interface Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 09/15] selftests/bpf: Add tests for the LSM policy object kfuncs Justin Suess
2026-09-09 20:30 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 10/15] landlock: Expose the ruleset fd lookup to the rest of Landlock Justin Suess
2026-09-09 19:37 ` [PATCH bpf-next v3 11/15] landlock: Factor the credential restriction out of landlock_restrict_self() Justin Suess
2026-09-09 20:29 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 12/15] landlock: Free rulesets after an RCU grace period Justin Suess
2026-09-09 20:46 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 13/15] landlock: Implement the LSM policy object hooks Justin Suess
2026-09-09 20:46 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 14/15] selftests/bpf: Test the LSM policy object kfuncs with Landlock Justin Suess
2026-09-09 20:46 ` bot+bpf-ci
2026-09-09 19:37 ` [PATCH bpf-next v3 15/15] landlock: Document the BPF policy interface Justin Suess
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=aqcb2eXw61LaFaqY@zenbox \
--to=utilityemal77@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=casey@schaufler-ca.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gnoack@google.com \
--cc=jack@suse.cz \
--cc=jolsa@kernel.org \
--cc=kees@kernel.org \
--cc=kpsingh@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=matt@bobrowski.net \
--cc=memxor@gmail.com \
--cc=mic@digikod.net \
--cc=paul@paul-moore.com \
--cc=song@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yonghong.song@linux.dev \
/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®