]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - kernel/bpf/verifier.c
bpf: Process in-kernel BTF
authorAlexei Starovoitov <ast@kernel.org>
Wed, 16 Oct 2019 03:24:57 +0000 (20:24 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 17 Oct 2019 14:44:35 +0000 (16:44 +0200)
commit8580ac9404f6240668a026785d7d8856f0530409
tree2858fc3bdfcb0d3de7bcb1eede0cabf3dcc6a89e
parent7c6a469e3416fa23568c2395a3faa7dd6e376dcb
bpf: Process in-kernel BTF

If in-kernel BTF exists parse it and prepare 'struct btf *btf_vmlinux'
for further use by the verifier.
In-kernel BTF is trusted just like kallsyms and other build artifacts
embedded into vmlinux.
Yet run this BTF image through BTF verifier to make sure
that it is valid and it wasn't mangled during the build.
If in-kernel BTF is incorrect it means either gcc or pahole or kernel
are buggy. In such case disallow loading BPF programs.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191016032505.2089704-4-ast@kernel.org
include/linux/bpf_verifier.h
include/linux/btf.h
kernel/bpf/btf.c
kernel/bpf/verifier.c