bpf: take into account BPF token when fetching helper protos
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 30 Nov 2023 18:52:19 +0000 (10:52 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Dec 2023 18:02:59 +0000 (10:02 -0800)
commit4cbb270e115bc197ff2046aeb54cc951666b16ec
tree649b1a6a47043000dff55125dc5a91ad91fd24b7
parente1cef620f598853a90f17701fcb1057a6768f7b8
bpf: take into account BPF token when fetching helper protos

Instead of performing unconditional system-wide bpf_capable() and
perfmon_capable() calls inside bpf_base_func_proto() function (and other
similar ones) to determine eligibility of a given BPF helper for a given
program, use previously recorded BPF token during BPF_PROG_LOAD command
handling to inform the decision.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231130185229.2688956-8-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
drivers/media/rc/bpf-lirc.c
include/linux/bpf.h
kernel/bpf/cgroup.c
kernel/bpf/helpers.c
kernel/bpf/syscall.c
kernel/trace/bpf_trace.c
net/core/filter.c
net/ipv4/bpf_tcp_ca.c
net/netfilter/nf_bpf_link.c