diff options
| author | Andrii Nakryiko <[email protected]> | 2024-02-02 19:05:27 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2024-02-03 02:08:58 +0000 |
| commit | 8f13c34087d3eb64329529b8517e5a6251653176 (patch) | |
| tree | a3fb464c0e39b7aeab5aa2ee9c514bda0e0af6b7 /tools/testing/selftests/bpf/prog_tests/sockmap_basic.c | |
| parent | selftests/bpf: trace_helpers.c: do not use poisoned type (diff) | |
| download | kernel-8f13c34087d3eb64329529b8517e5a6251653176.tar.gz kernel-8f13c34087d3eb64329529b8517e5a6251653176.zip | |
bpf: handle trusted PTR_TO_BTF_ID_OR_NULL in argument check logic
Add PTR_TRUSTED | PTR_MAYBE_NULL modifiers for PTR_TO_BTF_ID to
check_reg_type() to support passing trusted nullable PTR_TO_BTF_ID
registers into global functions accepting `__arg_trusted __arg_nullable`
arguments. This hasn't been caught earlier because tests were either
passing known non-NULL PTR_TO_BTF_ID registers or known NULL (SCALAR)
registers.
When utilizing this functionality in complicated real-world BPF
application that passes around PTR_TO_BTF_ID_OR_NULL, it became apparent
that verifier rejects valid case because check_reg_type() doesn't handle
this case explicitly. Existing check_reg_type() logic is already
anticipating this combination, so we just need to explicitly list this
combo in the switch statement.
Fixes: e2b3c4ff5d18 ("bpf: add __arg_trusted global func arg tag")
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/sockmap_basic.c')
0 files changed, 0 insertions, 0 deletions
