]> git.ipfire.org Git - thirdparty/linux.git/commit
libbpf: Support sanitization of BTF layout for older kernels
authorAlan Maguire <alan.maguire@oracle.com>
Thu, 26 Mar 2026 14:54:41 +0000 (14:54 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 26 Mar 2026 20:53:56 +0000 (13:53 -0700)
commit081677d03d8b8aea528cd8f14f4767c641457e2d
tree413ee1dfa7fb72110aa0c0cd04ac2492bb2aa541
parent6ad89285996add14b5d69cb302980bff9032ba2c
libbpf: Support sanitization of BTF layout for older kernels

Add a FEAT_BTF_LAYOUT feature check which checks if the
kernel supports BTF layout information.  Also sanitize
BTF if it contains layout data but the kernel does not
support it.  The sanitization requires rewriting raw
BTF data to update the header and eliminate the layout
section (since it lies between the types and strings),
so refactor sanitization to do the raw BTF retrieval
and creation of updated BTF, returning that new BTF
on success.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260326145444.2076244-7-alan.maguire@oracle.com
tools/lib/bpf/features.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf_internal.h
tools/lib/bpf/libbpf_probes.c