selftests/bpf: Test bpf_kptr_xchg stashing of bpf_rb_root
authorDave Marchevsky <davemarchevsky@fb.com>
Mon, 4 Dec 2023 21:17:22 +0000 (13:17 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 5 Dec 2023 14:06:47 +0000 (15:06 +0100)
commit1b4c7e20bfd6cfe0efbc51756d930a9406d41ea7
tree039941b0e3e680eb0957a1cc32f62f43012a19bd
parentce3c49da11d77aa7d53cd549d308eb5f7fed8576
selftests/bpf: Test bpf_kptr_xchg stashing of bpf_rb_root

There was some confusion amongst Meta sched_ext folks regarding whether
stashing bpf_rb_root - the tree itself, rather than a single node - was
supported. This patch adds a small test which demonstrates this
functionality: a local kptr with rb_root is created, a node is created
and added to the tree, then the tree is kptr_xchg'd into a mapval.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20231204211722.571346-1-davemarchevsky@fb.com
tools/testing/selftests/bpf/prog_tests/local_kptr_stash.c
tools/testing/selftests/bpf/progs/local_kptr_stash.c