bpf: Add __bpf_dynptr_data* for in kernel use
authorSong Liu <song@kernel.org>
Tue, 7 Nov 2023 04:57:23 +0000 (20:57 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 10 Nov 2023 03:07:38 +0000 (19:07 -0800)
commit74523c06ae20b83c5508a98af62393ac34913362
treefed41c7eb41d0ded5f654e08fc939648363ddae9
parent9b75dbeb36fcd9fc7ed51d370310d0518a387769
bpf: Add __bpf_dynptr_data* for in kernel use

Different types of bpf dynptr have different internal data storage.
Specifically, SKB and XDP type of dynptr may have non-continuous data.
Therefore, it is not always safe to directly access dynptr->data.

Add __bpf_dynptr_data and __bpf_dynptr_data_rw to replace direct access to
dynptr->data.

Update bpf_verify_pkcs7_signature to use __bpf_dynptr_data instead of
dynptr->data.

Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://lore.kernel.org/bpf/20231107045725.2278852-2-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/helpers.c
kernel/trace/bpf_trace.c