]> Gentwo Git Trees - linux/.git/commit
bpf: support nested rcu critical sections
authorPuranjay Mohan <puranjay@kernel.org>
Mon, 17 Nov 2025 20:04:09 +0000 (20:04 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 22 Nov 2025 02:34:59 +0000 (18:34 -0800)
commit4167096cb964325ed88cd558f5b0c61fcaab44c1
tree84542577e84db2cc7c41b0943380d21827cc897f
parent8f7cf305a15eec663d5084e417f4773f1ef24e23
bpf: support nested rcu critical sections

Currently, nested rcu critical sections are rejected by the verifier and
rcu_lock state is managed by a boolean variable. Add support for nested
rcu critical sections by make active_rcu_locks a counter similar to
active_preempt_locks. bpf_rcu_read_lock() increments this counter and
bpf_rcu_read_unlock() decrements it, MEM_RCU -> PTR_UNTRUSTED transition
happens when active_rcu_locks drops to 0.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20251117200411.25563-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf_verifier.h
kernel/bpf/verifier.c
tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c