bpf: Factor out helpers for ctx access checking
authorHou Tao <houtao1@huawei.com>
Mon, 25 Oct 2021 06:40:23 +0000 (14:40 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 1 Nov 2021 21:10:00 +0000 (14:10 -0700)
commit35346ab64132d0f5919b06932d708c0d10360553
treedfa39e7231a75a2e84dbfc6fad96ad52321042ea
parent31a645aea4f8da5bb190ce322c6e5aacaef13855
bpf: Factor out helpers for ctx access checking

Factor out two helpers to check the read access of ctx for raw tp
and BTF function. bpf_tracing_ctx_access() is used to check
the read access to argument is valid, and bpf_tracing_btf_ctx_access()
checks whether the btf type of argument is valid besides the checking
of argument read. bpf_tracing_btf_ctx_access() will be used by the
following patch.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20211025064025.2567443-3-houtao1@huawei.com
include/linux/bpf.h
kernel/trace/bpf_trace.c
net/ipv4/bpf_tcp_ca.c