]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Relax check whether BTF is mandatory
authorAndrii Nakryiko <andriin@fb.com>
Thu, 20 Feb 2020 06:26:35 +0000 (22:26 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 20 Feb 2020 19:03:39 +0000 (11:03 -0800)
commit5eaf3b1ef89999804ce36891df96a77b7b828b6e
treea21295e7bfb9fc349419565cb2af344b4b0e2f31
parent87dc289a4f2e8208af6d2e8c06a7b35679cce48a
libbpf: Relax check whether BTF is mandatory

If BPF program is using BTF-defined maps, BTF is required only for
libbpf itself to process map definitions. If after that BTF fails to
be loaded into kernel (e.g., if it doesn't support BTF at all), this
shouldn't prevent valid BPF program from loading. Existing
retry-without-BTF logic for creating maps will succeed to create such
maps without any problems. So, presence of .maps section shouldn't make
BTF required for kernel. Update the check accordingly.

Validated by ensuring simple BPF program with BTF-defined maps is still
loaded on old kernel without BTF support and map is correctly parsed and
created.

Fixes: b6effa363406 ("libbpf: allow specifying map definitions using BTF")
Reported-by: Julia Kartseva <hex@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200220062635.1497872-1-andriin@fb.com
tools/lib/bpf/libbpf.c