]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Validate that .BTF and .BTF.ext sections contain data
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 3 Nov 2021 17:32:11 +0000 (10:32 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 3 Nov 2021 20:25:37 +0000 (13:25 -0700)
commit85cbf840e90fbd139359936e27e9620873ce4458
treebca9ea3dbbbc86ca5a738ed497a31dbc0b32871e
parentb2f0affc00bedf0c560d1596761569b033689960
libbpf: Validate that .BTF and .BTF.ext sections contain data

.BTF and .BTF.ext ELF sections should have SHT_PROGBITS type and contain
data. If they are not, ELF is invalid or corrupted, so bail out.
Otherwise this can lead to data->d_buf being NULL and SIGSEGV later on.
Reported by oss-fuzz project.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211103173213.1376990-4-andrii@kernel.org
tools/lib/bpf/libbpf.c