linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Windsor <dwindsor@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	 andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	kpsingh@kernel.org,  john.fastabend@gmail.com,
	brauner@kernel.org, jack@suse.cz,  linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: Add dentry kfuncs for BPF LSM programs
Date: Wed, 24 Sep 2025 20:56:08 -0400	[thread overview]
Message-ID: <CAEXv5_hD_4ON3MVBa7+gpapQs+Vkvo6Ln+BKT+Qz_S7x+Up6hg@mail.gmail.com> (raw)
In-Reply-To: <20250925004725.GY39973@ZenIV>

On Wed, Sep 24, 2025 at 8:47 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Wed, Sep 24, 2025 at 08:44:24PM -0400, David Windsor wrote:
>
> > > You can safely clone and retain file references.  You can't do that
> > > to dentries unless you are guaranteed an active reference to superblock
> > > to stay around for as long as you are retaining those.  Note that
> > > LSM hooks might be called with ->s_umount held by caller, so the locking
> > > environment for superblocks depends upon the hook in question.
> >
> > Yeah good point about ->s_umount, why don't we just create a new "safe
> > dentry hooks" BTF ID set and restrict this to those and filter in
> > bpf_fs_kfuncs_filter, where there's existing filtering going on
> > anyway?
>
> Again, you can't just call dget(), stash the reference into a map and move
> on.  That's asking for UAF.

These can't be stored in a map (guaranteed by verifier during addr leak checks)

  reply	other threads:[~2025-09-25  0:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 23:24 [PATCH bpf-next 0/2] bpf: Add more dentry kfuncs for BPF LSM programs David Windsor
2025-09-24 23:24 ` [PATCH bpf-next 1/2] bpf: Add " David Windsor
2025-09-24 23:55   ` Al Viro
2025-09-25  0:08     ` David Windsor
2025-09-25  0:29       ` Al Viro
2025-09-25  0:44         ` David Windsor
2025-09-25  0:47           ` Al Viro
2025-09-25  0:56             ` David Windsor [this message]
2025-09-29  8:24     ` Christian Brauner
2025-09-24 23:24 ` [PATCH bpf-next 2/2] selftests/bpf: Add tests for dentry kfuncs David Windsor

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=CAEXv5_hD_4ON3MVBa7+gpapQs+Vkvo6Ln+BKT+Qz_S7x+Up6hg@mail.gmail.com \
    --to=dwindsor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jack@suse.cz \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).