]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add test case for rbtree nodes that contain both bpf_refcount and...
authorKaitao Cheng <chengkaitao@kylinos.cn>
Sat, 14 Feb 2026 12:40:42 +0000 (20:40 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Feb 2026 01:37:06 +0000 (17:37 -0800)
commited8fa4b8894f7e80d3a6bf63e4cb880c7545c63a
tree6d7f94232c2320da8a90de8bde29c155d2f24eee
parentfb1590448ff7e79e304f9bbe662fc20334038b50
selftests/bpf: Add test case for rbtree nodes that contain both bpf_refcount and kptr fields.

Allow bpf_kptr_xchg to directly operate on pointers marked with
NON_OWN_REF | MEM_RCU.

In the example demonstrated in this patch, as long as "struct
bpf_refcount ref" exists, the __kptr pointer is guaranteed to
carry the MEM_RCU flag. The ref member itself does not need to
be explicitly used.

Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
Link: https://lore.kernel.org/r/20260214124042.62229-6-pilgrimtao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/rbtree_search_kptr.c