diff options
| author | Kaitao Cheng <chengkaitao@kylinos.cn> | 2026-02-14 15:40:41 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-02-24 04:37:06 +0300 |
| commit | fb1590448ff7e79e304f9bbe662fc20334038b50 (patch) | |
| tree | cee1470c81ad00f40719b351f9c84696d4eace17 /tools/testing | |
| parent | 580fa3430b5d164fe8841e99825601d7a85af0d3 (diff) | |
| download | linux-fb1590448ff7e79e304f9bbe662fc20334038b50.tar.xz | |
bpf: allow using bpf_kptr_xchg even if the MEM_RCU flag is set
For the following scenario:
struct tree_node {
struct bpf_refcount ref;
struct bpf_rb_node node;
struct node_data __kptr * node_data;
u64 key;
};
This means node_data would have the type PTR_TO_BTF_ID | MEM_ALLOC |
NON_OWN_REF | MEM_RCU.
When traversing an rbtree using bpf_rbtree_left/right, if we need to
use bpf_kptr_xchg to read the __kptr pointer, we still need to follow
the remove-read-add sequence.
This patch allows us to use bpf_kptr_xchg to directly read the __kptr
pointer without any prior operations.
Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
Link: https://lore.kernel.org/r/20260214124042.62229-5-pilgrimtao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing')
0 files changed, 0 insertions, 0 deletions
