diff options
| author | Andrii Nakryiko <[email protected]> | 2024-01-29 16:06:45 -0800 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2024-01-30 09:41:50 -0800 |
| commit | e2b3c4ff5d183da6d1863c2321413406a2752e7a (patch) | |
| tree | f72b7b9a230cda038b505d3a98732b658440bd3f /tools/testing/selftests/bpf/prog_tests/autoload.c | |
| parent | 24219056805f3988bf93e494499b2329453fc706 (diff) | |
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 <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions