bpf: add BPF token support to BPF_PROG_LOAD command
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 30 Nov 2023 18:52:18 +0000 (10:52 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Dec 2023 18:02:59 +0000 (10:02 -0800)
commite1cef620f598853a90f17701fcb1057a6768f7b8
tree95d4f672f64ffeba968c3f8b8174783e52b093cb
parentee54b1a910e4d49c9a104f31ae3f5b979131adf8
bpf: add BPF token support to BPF_PROG_LOAD command

Add basic support of BPF token to BPF_PROG_LOAD. Wire through a set of
allowed BPF program types and attach types, derived from BPF FS at BPF
token creation time. Then make sure we perform bpf_token_capable()
checks everywhere where it's relevant.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231130185229.2688956-7-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/inode.c
kernel/bpf/syscall.c
kernel/bpf/token.c
tools/include/uapi/linux/bpf.h
tools/testing/selftests/bpf/prog_tests/libbpf_probes.c
tools/testing/selftests/bpf/prog_tests/libbpf_str.c