]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Split BTF presence checks into libbpf- and kernel-specific parts
authorAndrii Nakryiko <andriin@fb.com>
Thu, 12 Mar 2020 18:50:33 +0000 (11:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 12 Mar 2020 23:15:16 +0000 (00:15 +0100)
commitb80bb5b5db1b2873996e52a925071f2f726c96ce
tree06612def5679797955f2e506c2d2f28cf3504a6c
parenta3df3d9078d3cde1c61da1a355bdd1296c721dcd
libbpf: Split BTF presence checks into libbpf- and kernel-specific parts

Needs for application BTF being present differs between user-space libbpf needs and kernel
needs. Currently, BTF is mandatory only in kernel only when BPF application is
using STRUCT_OPS. While libbpf itself relies more heavily on presense of BTF:
  - for BTF-defined maps;
  - for Kconfig externs;
  - for STRUCT_OPS as well.

Thus, checks for presence and validness of bpf_object's BPF needs to be
performed separately, which is patch does.

Fixes: 5eaf3b1ef899 ("libbpf: Relax check whether BTF is mandatory")
Reported-by: Michal Rostecki <mrostecki@opensuse.org>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20200312185033.736911-1-andriin@fb.com
tools/lib/bpf/libbpf.c