diff options
| author | Dave Marchevsky <[email protected]> | 2023-03-10 23:07:42 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2023-03-11 00:38:05 +0000 |
| commit | 738c96d5e2e3700b370f02ac84a9dc159ca81f25 (patch) | |
| tree | 8da5ca672f2f3e602ba1606a2d930b07aa537aa6 /tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c | |
| parent | bpf: Support __kptr to local kptrs (diff) | |
| download | kernel-738c96d5e2e3700b370f02ac84a9dc159ca81f25.tar.gz kernel-738c96d5e2e3700b370f02ac84a9dc159ca81f25.zip | |
bpf: Allow local kptrs to be exchanged via bpf_kptr_xchg
The previous patch added necessary plumbing for verifier and runtime to
know what to do with non-kernel PTR_TO_BTF_IDs in map values, but didn't
provide any way to get such local kptrs into a map value. This patch
modifies verifier handling of bpf_kptr_xchg to allow MEM_ALLOC kptr
types.
check_reg_type is modified accept MEM_ALLOC-flagged input to
bpf_kptr_xchg despite such types not being in btf_ptr_types. This could
have been done with a MAYBE_MEM_ALLOC equivalent to MAYBE_NULL, but
bpf_kptr_xchg is the only helper that I can forsee using
MAYBE_MEM_ALLOC, so keep it special-cased for now.
The verifier tags bpf_kptr_xchg retval MEM_ALLOC if and only if the BTF
associated with the retval is not kernel BTF.
Signed-off-by: Dave Marchevsky <[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/tcp_hdr_options.c')
0 files changed, 0 insertions, 0 deletions
