public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	bpf@vger.kernel.org, KP Singh <kpsingh@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] bpf: classify block device hooks appropriately
Date: Fri, 20 Feb 2026 10:28:24 -0800	[thread overview]
Message-ID: <aZinyCqhKYSFLj43@infradead.org> (raw)
In-Reply-To: <20260220-work-bpf-bdev-v1-1-c53e852c4702@kernel.org>

On Fri, Feb 20, 2026 at 06:48:48PM +0100, Christian Brauner wrote:
> A bunch of new hooks for managing block devices were added a while ago
> but they weren't actually appropriately classified.

> 
> * bpf_lsm_bdev_alloc() is called when the inode for the block
>   device is allocated. This happens from a sleepable context so mark the
>   function as sleepable. When this function is called the memory for the
>   block device storage embedded into the inode is zeroed. That block
>   device cannot be meaningfully reference or interacted with at this
>   point. So mark it as untrusted for now.
> 
> * bpf_lsm_bdev_free() is called when the inode for the block
>   device is freed. A bunch of memory associated with the block device
>   has already been freed and there's dangling pointers in there. So mark
>   it as untrusted. It cannot be meaningfully referenced or interacted
>   with anymore. It is also called from sb->s_op->free_inode:: which
>   means it runs in rcu context (most of the times). So leave it as
>   non-sleepable.

How did this even get added?  None of this should be of any business
to LSM hooks :(


  reply	other threads:[~2026-02-20 18:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 17:48 [PATCH 0/2] bpf: classify block device hooks and add selftests Christian Brauner
2026-02-20 17:48 ` [PATCH 1/2] bpf: classify block device hooks appropriately Christian Brauner
2026-02-20 18:28   ` Christoph Hellwig [this message]
2026-02-23 13:42     ` Christian Brauner
2026-02-20 17:48 ` [PATCH 2/2] selftests/bpf: add block device management selftests Christian Brauner
2026-03-23 14:22 ` [PATCH 0/2] bpf: classify block device hooks and add selftests Christian Brauner

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=aZinyCqhKYSFLj43@infradead.org \
    --to=hch@infradead.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@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