]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commite04ccb3f4474d1db60467da6ba4000ff29a5e875
tree2858fc3bdfcb0d3de7bcb1eede0cabf3dcc6a89e
parent4d706401e6a135ad05c1125b033c739acba38621
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