Re: [PATCH v2 bpf-next 2/4] bpf: Introduce kptr_rcu.
From: Alexei Starovoitov <hidden>
Date: 2023-02-27 17:52:33
Also in:
bpf
From: Alexei Starovoitov <hidden>
Date: 2023-02-27 17:52:33
Also in:
bpf
On Wed, Feb 22, 2023 at 7:07 PM Alexei Starovoitov [off-list ref] wrote:
diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h index 7d12d3e620cc..affc0997f937 100644 --- a/tools/lib/bpf/bpf_helpers.h +++ b/tools/lib/bpf/bpf_helpers.h@@ -176,6 +176,7 @@ enum libbpf_tristate { #define __ksym __attribute__((section(".ksyms"))) #define __kptr_untrusted __attribute__((btf_type_tag("kptr_untrusted"))) #define __kptr __attribute__((btf_type_tag("kptr"))) +#define __kptr_rcu __attribute__((btf_type_tag("kptr_rcu")))
Realized that the mechanism can work without requiring bpf prog to use this new tag. The kernel can determine whether __kptr is RCU or not via rcu_protected_object(). So BPF_KPTR_RCU vs BPF_KPTR_REF will be kernel internal distinction. Eventually all __kptr kernel objects will be RCU anyway. I'll respin.