From: Puranjay Mohan <puranjay@kernel.org>
To: Ning Ding <dingning04@gmail.com>,
bpf@vger.kernel.org, "Paul E. McKenney" <paulmck@kernel.org>
Cc: Ning Ding <dingning04@gmail.com>, Puranjay Mohan <puranjay12@gmail.com>
Subject: Re: [PATCH bpf-next v2 0/2] bpf: Invalidate RCU pointers after final spin unlock
Date: Tue, 04 Aug 2026 11:50:10 +0100 [thread overview]
Message-ID: <m2zez2i2hp.fsf@kernel.org> (raw)
In-Reply-To: <20260803112615.3362122-1-dingning04@gmail.com>
Ning Ding <dingning04@gmail.com> writes:
> In a sleepable BPF program, a spin lock can provide the only RCU protection
> for a kptr. The final spin unlock ends that protection, but the verifier
> leaves the pointer valid. Another CPU can then free the object before the
> pointer is used. A capability-limited runtime PoC triggered a
> KASAN-confirmed task_struct use-after-free.
>
> Patch 1 invalidates RCU-protected pointers only when an unlock leaves the
> final RCU-protected context. Patch 2 adds a negative sleepable test and
> positive controls for non-sleepable and explicit-RCU contexts.
I think if we are doing this we should do it for all things that act as
an entry to a RCU read side critical section [1]:
1. Disabling preemption
2. Disabling bottom halves
3. Disabling interrupts
4. Acquiring a spin lock
As you are doing it for 4, can you also do it for 1 and 3? I don't think
BPF can disable bottom halves right now.
Paul, can you ack this? Let us know if there are more things that can
make a BPF program enter a read side critical section.
Thanks,
Puranjay
[1] https://docs.kernel.org/RCU/whatisRCU.html#:~:text=Note%20that%20anything,side%20critical%20sections.
next prev parent reply other threads:[~2026-08-04 10:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 11:26 [PATCH bpf-next v2 0/2] bpf: Invalidate RCU pointers after final spin unlock Ning Ding
2026-08-03 11:26 ` [PATCH bpf-next v2 1/2] " Ning Ding
2026-08-04 9:30 ` Kumar Kartikeya Dwivedi
2026-08-03 11:26 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test RCU pointer invalidation after " Ning Ding
2026-08-04 9:40 ` [PATCH bpf-next v2 0/2] bpf: Invalidate RCU pointers after final " patchwork-bot+netdevbpf
2026-08-04 10:50 ` Puranjay Mohan [this message]
2026-08-04 16:28 ` Paul E. McKenney
2026-08-05 7:00 ` Ning Ding
2026-08-06 9:02 ` Kumar Kartikeya Dwivedi
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=m2zez2i2hp.fsf@kernel.org \
--to=puranjay@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dingning04@gmail.com \
--cc=paulmck@kernel.org \
--cc=puranjay12@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.