libbpf: split initialization and loading of BTF
authorAndrii Nakryiko <andriin@fb.com>
Mon, 17 Jun 2019 19:26:55 +0000 (12:26 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 17 Jun 2019 22:10:41 +0000 (00:10 +0200)
commit063183bf0486c7e61a2b454896bba2f7908b4ab0
tree866c9d1246da8901607b84b20eed09849d83e0b8
parentdb48814bd2833ee231f48bd2030082369b88f9ef
libbpf: split initialization and loading of BTF

Libbpf does sanitization of BTF before loading it into kernel, if kernel
doesn't support some of newer BTF features. This removes some of the
important information from BTF (e.g., DATASEC and VAR description),
which will be used for map construction. This patch splits BTF
processing into initialization step, in which BTF is initialized from
ELF and all the original data is still preserved; and
sanitization/loading step, which ensures that BTF is safe to load into
kernel. This allows to use full BTF information to construct maps, while
still loading valid BTF into older kernels.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c