bpf: Allow to specify kernel module BTFs when attaching BPF programs
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 3 Dec 2020 20:46:30 +0000 (12:46 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Dec 2020 01:38:21 +0000 (17:38 -0800)
commit290248a5b7d829871b3ea3c62578613a580a1744
tree0aa6d260cddaf939128e4645fdc695fcfa4ce0e0
parent22dc4a0f5ed11b6dc8fd73a0892fa0ea1a4c3cdf
bpf: Allow to specify kernel module BTFs when attaching BPF programs

Add ability for user-space programs to specify non-vmlinux BTF when attaching
BTF-powered BPF programs: raw_tp, fentry/fexit/fmod_ret, LSM, etc. For this,
attach_prog_fd (now with the alias name attach_btf_obj_fd) should specify FD
of a module or vmlinux BTF object. For backwards compatibility reasons,
0 denotes vmlinux BTF. Only kernel BTF (vmlinux or module) can be specified.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201203204634.1325171-11-andrii@kernel.org
include/linux/btf.h
include/uapi/linux/bpf.h
kernel/bpf/btf.c
kernel/bpf/syscall.c
tools/include/uapi/linux/bpf.h