selftests/bpf: Add tests for RCU lock transfer between subprogs
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 5 Feb 2024 05:56:46 +0000 (05:56 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 6 Feb 2024 04:00:14 +0000 (20:00 -0800)
commit8be6a0147af314fd60db9da2158cd737dc6394a7
tree5633630512456d6639125786010e2125253f83eb
parent6fceea0fa59f6786a2847a4cae409117624e8b58
selftests/bpf: Add tests for RCU lock transfer between subprogs

Add selftests covering the following cases:
- A static or global subprog called from within a RCU read section works
- A static subprog taking an RCU read lock which is released in caller works
- A static subprog releasing the caller's RCU read lock works

Global subprogs that leave the lock in an imbalanced state will not
work, as they are verified separately, so ensure those cases fail as
well.

Acked-by: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20240205055646.1112186-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c
tools/testing/selftests/bpf/progs/rcu_read_lock.c