Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: libbpf: fix BTF dedup to support recursive typedef
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1022919

Paul Houssel added 2 commits November 13, 2025 03:22
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.

Co-developed-by: Martin Horth <[email protected]>
Signed-off-by: Martin Horth <[email protected]>
Co-developed-by: Ouail Derghal <[email protected]>
Signed-off-by: Ouail Derghal <[email protected]>
Co-developed-by: Guilhem Jazeron <[email protected]>
Signed-off-by: Guilhem Jazeron <[email protected]>
Co-developed-by: Ludovic Paillat <[email protected]>
Signed-off-by: Ludovic Paillat <[email protected]>
Co-developed-by: Robin Theveniaut <[email protected]>
Signed-off-by: Robin Theveniaut <[email protected]>
Suggested-by: Tristan d'Audibert <[email protected]>
Signed-off-by: Paul Houssel <[email protected]>
Add several ./test_progs tests:
    1.  btf/dedup:recursive typedef ensures that deduplication no
	longer fails on recursive typedefs.
    2.  btf/dedup:typedef ensures that typedefs are deduplicated correctly
	just as they were before this patch.

Signed-off-by: Paul Houssel <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 3249e8a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1022919
version: 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant