<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/lib/bpf/btf.c, branch linux-7.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-14T00:21:56+00:00</updated>
<entry>
<title>btf: Refactor the code by calling str_is_empty</title>
<updated>2026-01-14T00:21:56+00:00</updated>
<author>
<name>Donglin Peng</name>
<email>pengdonglin@xiaomi.com</email>
</author>
<published>2026-01-09T13:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9282a42a1fe16c61a253293af439d6fecd8b5b6c'/>
<id>urn:sha1:9282a42a1fe16c61a253293af439d6fecd8b5b6c</id>
<content type='text'>
Calling the str_is_empty function to clarify the code and
no functional changes are introduced.

Signed-off-by: Donglin Peng &lt;pengdonglin@xiaomi.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20260109130003.3313716-12-dolinux.peng@gmail.com
</content>
</entry>
<entry>
<title>libbpf: Verify BTF sorting</title>
<updated>2026-01-14T00:16:59+00:00</updated>
<author>
<name>Donglin Peng</name>
<email>pengdonglin@xiaomi.com</email>
</author>
<published>2026-01-09T12:59:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=33ecca574f1c27cbf560aee9c1b3045dcb9f8de5'/>
<id>urn:sha1:33ecca574f1c27cbf560aee9c1b3045dcb9f8de5</id>
<content type='text'>
This patch checks whether the BTF is sorted by name in ascending
order. If sorted, binary search will be used when looking up types.

Signed-off-by: Donglin Peng &lt;pengdonglin@xiaomi.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20260109130003.3313716-6-dolinux.peng@gmail.com
</content>
</entry>
<entry>
<title>libbpf: Optimize type lookup with binary search for sorted BTF</title>
<updated>2026-01-14T00:16:58+00:00</updated>
<author>
<name>Donglin Peng</name>
<email>pengdonglin@xiaomi.com</email>
</author>
<published>2026-01-09T12:59:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d836e5e64992363b5fa9b121f1ab4a1a1b89162d'/>
<id>urn:sha1:d836e5e64992363b5fa9b121f1ab4a1a1b89162d</id>
<content type='text'>
This patch introduces binary search optimization for BTF type lookups
when the BTF instance contains sorted types.

The optimization significantly improves performance when searching for
types in large BTF instances with sorted types. For unsorted BTF, the
implementation falls back to the original linear search.

Signed-off-by: Donglin Peng &lt;pengdonglin@xiaomi.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20260109130003.3313716-5-dolinux.peng@gmail.com
</content>
</entry>
<entry>
<title>libbpf: Add BTF permutation support for type reordering</title>
<updated>2026-01-14T00:10:39+00:00</updated>
<author>
<name>Donglin Peng</name>
<email>pengdonglin@xiaomi.com</email>
</author>
<published>2026-01-09T12:59:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6fbf129c49905e9e34801b362c9c30ae383d7a90'/>
<id>urn:sha1:6fbf129c49905e9e34801b362c9c30ae383d7a90</id>
<content type='text'>
Introduce btf__permute() API to allow in-place rearrangement of BTF types.
This function reorganizes BTF type order according to a provided array of
type IDs, updating all type references to maintain consistency.

Signed-off-by: Donglin Peng &lt;pengdonglin@xiaomi.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20260109130003.3313716-2-dolinux.peng@gmail.com
</content>
</entry>
<entry>
<title>libbpf: Add debug messaging in dedup equivalence/identity matching</title>
<updated>2025-12-05T23:55:54+00:00</updated>
<author>
<name>Alan Maguire</name>
<email>alan.maguire@oracle.com</email>
</author>
<published>2025-12-03T19:15:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81f88f6ab674973d361b6d176aa4d3ebd32253ab'/>
<id>urn:sha1:81f88f6ab674973d361b6d176aa4d3ebd32253ab</id>
<content type='text'>
We have seen a number of issues like [1]; failures to deduplicate
key kernel data structures like task_struct.  These are often hard
to debug from pahole even with verbose output, especially when
identity/equivalence checks fail deep in a nested struct comparison.

Here we add debug messages of the form

libbpf: STRUCT 'task_struct' size=2560 vlen=194 cand_id[54222] canon_id[102820] shallow-equal but not equiv for field#23 'sched_class': 0

These will be emitted during dedup from pahole when --verbose/-V
is specified.  This greatly helps identify exactly where dedup
failures are experienced.

[1] https://lore.kernel.org/bpf/b8e8b560-bce5-414b-846d-0da6d22a9983@oracle.com/

Changes since v1:

- updated debug messages to refer to shallow-equal, added ids (Andrii)

Signed-off-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20251203191507.55565-1-alan.maguire@oracle.com
</content>
</entry>
<entry>
<title>libbpf: Fix BTF dedup to support recursive typedef definitions</title>
<updated>2025-11-15T01:07:20+00:00</updated>
<author>
<name>Paul Houssel</name>
<email>paulhoussel2@gmail.com</email>
</author>
<published>2025-11-13T12:39:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3781413465df6e0fb7f3c2001f986c9886b7f126'/>
<id>urn:sha1:3781413465df6e0fb7f3c2001f986c9886b7f126</id>
<content type='text'>
Handle recursive typedefs in BTF deduplication

Pahole fails to encode BTF for some Go projects (e.g. Kubernetes and
Podman) due to recursive type definitions that create reference loops
not representable in C. These recursive typedefs trigger a failure in
the BTF deduplication algorithm.

This patch extends btf_dedup_ref_type() to properly handle potential
recursion for BTF_KIND_TYPEDEF, similar to how recursion is already
handled for BTF_KIND_STRUCT. This allows pahole to successfully
generate BTF for Go binaries using recursive types without impacting
existing C-based workflows.

Suggested-by: Tristan d'Audibert &lt;tristan.daudibert@gmail.com&gt;
Co-developed-by: Martin Horth &lt;martin.horth@telecom-sudparis.eu&gt;
Co-developed-by: Ouail Derghal &lt;ouail.derghal@imt-atlantique.fr&gt;
Co-developed-by: Guilhem Jazeron &lt;guilhem.jazeron@inria.fr&gt;
Co-developed-by: Ludovic Paillat &lt;ludovic.paillat@inria.fr&gt;
Co-developed-by: Robin Theveniaut &lt;robin.theveniaut@irit.fr&gt;
Signed-off-by: Martin Horth &lt;martin.horth@telecom-sudparis.eu&gt;
Signed-off-by: Ouail Derghal &lt;ouail.derghal@imt-atlantique.fr&gt;
Signed-off-by: Guilhem Jazeron &lt;guilhem.jazeron@inria.fr&gt;
Signed-off-by: Ludovic Paillat &lt;ludovic.paillat@inria.fr&gt;
Signed-off-by: Robin Theveniaut &lt;robin.theveniaut@irit.fr&gt;
Signed-off-by: Paul Houssel &lt;paul.houssel@orange.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/bf00857b1e06f282aac12f6834de7396a7547ba6.1763037045.git.paul.houssel@orange.com
</content>
</entry>
<entry>
<title>libbpf: Fix parsing of multi-split BTF</title>
<updated>2025-11-04T21:44:12+00:00</updated>
<author>
<name>Alan Maguire</name>
<email>alan.maguire@oracle.com</email>
</author>
<published>2025-11-04T20:33:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f596acc260e691a2e348f64230392f3472feea3'/>
<id>urn:sha1:4f596acc260e691a2e348f64230392f3472feea3</id>
<content type='text'>
When creating multi-split BTF we correctly set the start string offset
to be the size of the base string section plus the base BTF start
string offset; the latter is needed for multi-split BTF since the
offset is non-zero there.

Unfortunately the BTF parsing case needed that logic and it was
missed.

Fixes: 4e29128a9ace ("libbpf/btf: Fix string handling to support multi-split BTF")
Signed-off-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20251104203309.318429-2-alan.maguire@oracle.com
</content>
</entry>
<entry>
<title>libbpf: move libbpf_errstr() into libbpf_utils.c</title>
<updated>2025-10-01T22:27:25+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2025-10-01T17:13:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c68b6fdc3600466e3c265bad34d099eb8c5280f1'/>
<id>urn:sha1:c68b6fdc3600466e3c265bad34d099eb8c5280f1</id>
<content type='text'>
Get rid of str_err.{c,h} by moving implementation of libbpf_errstr()
into libbpf_utils.c and declarations into libbpf_internal.h.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20251001171326.3883055-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
</content>
</entry>
<entry>
<title>libbpf: Handle unsupported mmap-based /sys/kernel/btf/vmlinux correctly</title>
<updated>2025-06-06T21:07:07+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2025-06-06T20:21:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=02670deede2288d8e4e3d800477b27c091080fae'/>
<id>urn:sha1:02670deede2288d8e4e3d800477b27c091080fae</id>
<content type='text'>
libbpf_err_ptr() helpers are meant to return NULL and set errno, if
there is an error. But btf_parse_raw_mmap() is meant to be used
internally and is expected to return ERR_PTR() values. Because of this
mismatch, when libbpf tries to mmap /sys/kernel/btf/vmlinux, we don't
detect the error correctly with IS_ERR() check, and never fallback to
old non-mmap-based way of loading vmlinux BTF.

Fix this by using proper ERR_PTR() returns internally.

Reported-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Reviewed-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Fixes: 3c0421c93ce4 ("libbpf: Use mmap to parse vmlinux BTF from sysfs")
Cc: Lorenz Bauer &lt;lmb@isovalent.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20250606202134.2738910-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Use mmap to parse vmlinux BTF from sysfs</title>
<updated>2025-05-23T17:06:28+00:00</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@isovalent.com</email>
</author>
<published>2025-05-20T13:01:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3c0421c93ce4ff0f5f2612666122c34fc941d569'/>
<id>urn:sha1:3c0421c93ce4ff0f5f2612666122c34fc941d569</id>
<content type='text'>
Teach libbpf to use mmap when parsing vmlinux BTF from /sys. We don't
apply this to fall-back paths on the regular file system because there
is no way to ensure that modifications underlying the MAP_PRIVATE
mapping are not visible to the process.

Signed-off-by: Lorenz Bauer &lt;lmb@isovalent.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Tested-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20250520-vmlinux-mmap-v5-3-e8c941acc414@isovalent.com
</content>
</entry>
</feed>
