]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Allow empty module BTFs
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 10 Jan 2021 07:03:40 +0000 (23:03 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 12 Jan 2021 20:11:30 +0000 (21:11 +0100)
commit1ecb2cb0a1c3bef4ecbdb3354d123c55d0d776e2
tree113f20d0f937679d41cc01f996b67f0bbf30b0e1
parentbf5b9b61d7ff9a1f0d8812e5622dd45ed5858eea
bpf: Allow empty module BTFs

Some modules don't declare any new types and end up with an empty BTF,
containing only valid BTF header and no types or strings sections. This
currently causes BTF validation error. There is nothing wrong with such BTF,
so fix the issue by allowing module BTFs with no types or strings.

Fixes: 1e772326c4aa ("bpf: Load and verify kernel module BTFs")
Reported-by: Christopher William Snowhill <chris@kode54.net>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210110070341.1380086-1-andrii@kernel.org
kernel/bpf/btf.c