Skip to content

bpf: Track overlapping RCU protection

Ning Ding bpf linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Account for preempt and IRQ state in RCU protectionkernel/bpf/verifier.c+10 -32 replies
2/2selftests/bpf: Test overlapping RCU protectiontools/testing/selftests/bpf/prog_tests/task_kfunc.c tools/testing/selftests/bpf/progs/task_kfunc_common.h tools/testing/selftests/bpf/progs/task_kfunc_failure.c +1 more+204 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchEduard Zingerman
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/2] bpf: Track overlapping RCU protection

Preemption-disabled and IRQ-disabled regions provide RCU protection, but the verifier does not account for them. Current implementation can invalidate a task kptr while another RCU source remains active, or keep it valid after the final source ends.

Track these regions and invalidate RCU-protected pointers only after the last protection ends. Add task kptr tests for overlapping protection and final-exit rejection.

This follows review of the applied spin-unlock fix series [1].

Tested in QEMU/KVM:
./test_progs -t task_kfunc
./test_progs -t preempt_lock
./test_progs -t irq

[1] https://lore.kernel.org/r/[email protected]

Ning Ding (2):
bpf: Account for preempt and IRQ state in RCU protection selftests/bpf: Test overlapping RCU protection

 kernel/bpf/verifier.c                         |  13 +-
 .../selftests/bpf/prog_tests/task_kfunc.c     |   6 +
 .../selftests/bpf/progs/task_kfunc_common.h   |   2 +
 .../selftests/bpf/progs/task_kfunc_failure.c  |  49 ++++++
 .../selftests/bpf/progs/task_kfunc_success.c  | 147 ++++++++++++++++++
 5 files changed, 214 insertions(+), 3 deletions(-)

base-commit: 11c1e836710dcba03e50454a4eedfdbaf8d3050e

Signature · 1 line
2.43.0