bpf: Refactor btf_struct_access
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 14 Nov 2022 19:15:28 +0000 (00:45 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 15 Nov 2022 05:52:45 +0000 (21:52 -0800)
commit6728aea7216c0c06c98e2e58d753a5e8b2ae1c6f
tree4397a958819a861067daa29aaa3c3a4983ffc89e
parent894f2a8b1673a355a1a7507a4dfa6a3c836d07c1
bpf: Refactor btf_struct_access

Instead of having to pass multiple arguments that describe the register,
pass the bpf_reg_state into the btf_struct_access callback. Currently,
all call sites simply reuse the btf and btf_id of the reg they want to
check the access of. The only exception to this pattern is the callsite
in check_ptr_to_map_access, hence for that case create a dummy reg to
simulate PTR_TO_BTF_ID access.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20221114191547.1694267-8-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
include/linux/filter.h
kernel/bpf/btf.c
kernel/bpf/verifier.c
net/bpf/bpf_dummy_struct_ops.c
net/core/filter.c
net/ipv4/bpf_tcp_ca.c
net/netfilter/nf_conntrack_bpf.c