diff options
author | 2024-01-29 16:06:45 -0800 | |
---|---|---|
committer | 2024-01-30 09:41:50 -0800 | |
commit | e2b3c4ff5d183da6d1863c2321413406a2752e7a (patch) | |
tree | f72b7b9a230cda038b505d3a98732b658440bd3f /tools/lib/bpf/bpf_helpers.h | |
parent | bpf: Move -Wno-compare-distinct-pointer-types to BPF_CFLAGS (diff) | |
download | wireguard-linux-e2b3c4ff5d183da6d1863c2321413406a2752e7a.tar.xz wireguard-linux-e2b3c4ff5d183da6d1863c2321413406a2752e7a.zip |
bpf: add __arg_trusted global func arg tag
Add support for passing PTR_TO_BTF_ID registers to global subprogs.
Currently only PTR_TRUSTED flavor of PTR_TO_BTF_ID is supported.
Non-NULL semantics is assumed, so caller will be forced to prove
PTR_TO_BTF_ID can't be NULL.
Note, we disallow global subprogs to destroy passed in PTR_TO_BTF_ID
arguments, even the trusted one. We achieve that by not setting
ref_obj_id when validating subprog code. This basically enforces (in
Rust terms) borrowing semantics vs move semantics. Borrowing semantics
seems to be a better fit for isolated global subprog validation
approach.
Implementation-wise, we utilize existing logic for matching
user-provided BTF type to kernel-side BTF type, used by BPF CO-RE logic
and following same matching rules. We enforce a unique match for types.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240130000648.2144827-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions