mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: "Dr. Greg" <greg@enjellic.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	 Justin Suess <utilityemal77@gmail.com>,
	Paul Moore <paul@paul-moore.com>,
	ast@kernel.org,  daniel@iogearbox.net, andrii@kernel.org,
	kpsingh@kernel.org, matt@bobrowski.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: Wed, 16 Sep 2026 22:58:40 +0200	[thread overview]
Message-ID: <20260916.aiPhaw6einoh@digikod.net> (raw)
In-Reply-To: <aqrLsbnzbbX4HPr-@wind.enjellic.com>

On Wed, Sep 16, 2026 at 12:02:41PM -0500, Dr. Greg wrote:
> On Tue, Sep 15, 2026 at 11:25:13AM +0200, Micka??l Sala??n wrote:
> 
> > Hi,
> 
> Hezzie says hi too.
> 
> > 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:
> > 
> > [...]
> > 
> > > landlock was designed for unprivileged users. bpf needs CAP_BPF.
> 
> > Yep, and this series would kind of bridge these two worlds. ;)
> 
> See my comments to Justin about this 'Mixing of the Blood'... ;-)

I'm pragmatic and there are different use cases, different constraints,
and different trust models...  Landlock has some good properties which
makes it fit for being used by unprivileged/untrusted processes, and who
can do more can do less.

> 
> > > There is a fundamental disconnect. If you can tolerate CAP_BPF then
> > > just use bpf-lsm and implement whatever policy you need there.
> > > If bpf-lsm is missing a feature we can fix that.
> 

Please keep this in mind:
> > The question is not if BPF LSM can or cannot do what Landlock does.

> > Landlock provides a way for userspace to sandbox processes, and that
> > comes with a well-defined semantic, logs, and an user space ABI, which
> > are specific and dedicated to Landlock.  Some user space depend on that.
> > 
> > The goal of this patch series is to improve BPF LSM to enable it to
> > (also) enforce a Landlock security policy defined by user space thanks
> > to the Landlock syscalls.  The security policy still has the properties
> > that makes it possible to safely compose different ones (e.g.
> > monotonicity/stacking enforcement, inheritance, separation of duty, no
> > cover channel, safe privilege reduction without confused deputy issues).
> > 
> > A process can currently define such security policy, get a file
> > descriptor referring to it, and pass this FD to another process that
> > would enforce it.  This helps design secure architectures by splitting
> > ownership, trust, and privileges (e.g. CAP_BPF).  Being able to use BPF
> > programs instead of user space programs to enforce (e.g. an already
> > defined) security policy would make this enforcement more powerful
> > thanks to the context BPF have access to.  Of course, BPF LSM can (and
> > should) also enforce other kind of complementary restrictions.
> 
> This may be the answer to the question that I was asking Justin, lets
> see if we can unpack it a bit for those of us that are dense.
> 
> Big picture, as Justin so elegantly pointed out, there are a bunch of
> things that eBPF cannot do now, and may never be able to do in the
> future, particularily when it comes to 'raceless free' path based
> security controls, ie. TOCTOU avoidance.

That's a different problem/challenge, but BPF is gradually being
improved, and I'm sure your contributions would be welcome.

> 
> So, the objective is to have a program, systemd for example, compose a
> set of different security policies, that it then hands out to various
> process heirarchies, which then uses eBPF to call LandLock kernel
> internals to do the heavy security lifting with kernel level
> privileges and capabilities, particularily when it comes to path based
> controls.
> 
> Is that close?

That's kind of the opposite: systemd, as a privileged process, is in
charge of loading BPF programs, but this is not a good example here.
That would make more sense with e.g., a dedicated process that manages a
set of security policies (which might be owned by different teams), pass
these (Landlock) policies to the a privileged process that enrich them
with context, and load the related BPF programs to the kernel.  That's
only one simple example, but it should give a good idea of what is
possible.

> 
> If so, the question remains, why take on this amount of drama?
> 
> Something like systemd does at least 10,000 other things, composing
> and handing out multiple variants of file descriptor based process
> hierarchy security policies would seem like chump change to it.
> 
> I'm assuming the answer is that the eBPF programs involved are going
> to be implementing other, perhaps proprietary, security controls that
> extend beyond the path based controls that eBPF can't do.

Yes, that's a possibility, but a simpler approach would be to just map a
runtime context to a set of security policies (e.g. sandbox all
instances of /usr/bin/foo with a custom profile).

> 
> We will be interested in your reflections.

  reply	other threads:[~2026-09-16 21:05 UTC|newest]

Thread overview: 49+ 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 21:18                       ` Dr. Greg
2026-09-15 13:00                       ` Christian Brauner
2026-09-15 13:48                         ` Paul Moore
2026-09-16  8:48                           ` Christian Brauner
2026-09-14  0:20               ` Justin Suess
2026-09-14  2:31                 ` Alexei Starovoitov
2026-09-15  1:13                   ` Justin Suess
2026-09-16 17:37                     ` Dr. Greg
2026-09-16 16:06                 ` Dr. Greg
2026-09-15  9:25               ` Mickaël Salaün
2026-09-16 17:02                 ` Dr. Greg
2026-09-16 20:58                   ` Mickaël Salaün [this message]
2026-09-16 20:20                 ` Günther Noack
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=20260916.aiPhaw6einoh@digikod.net \
    --to=mic@digikod.net \
    --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=greg@enjellic.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=paul@paul-moore.com \
    --cc=song@kernel.org \
    --cc=utilityemal77@gmail.com \
    --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®