[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c33ab7a31ccbc1235bd183a5e4bfa4f94896c63.camel@gmail.com>
Date: Fri, 07 Nov 2025 11:45:04 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: paulhoussel2@...il.com, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org
Cc: bpf@...r.kernel.org, linux-kernel@...r.kernel.org, Paul Houssel
<paul.houssel@...nge.com>, Martin Horth <martin.horth@...ecom-sudparis.eu>,
Ouail Derghal <ouail.derghal@...-atlantique.fr>, Guilhem Jazeron
<guilhem.jazeron@...ia.fr>, Ludovic Paillat <ludovic.paillat@...ia.fr>,
Robin Theveniaut <robin.theveniaut@...t.fr>, Tristan d'Audibert
<tristan.daudibert@...il.com>
Subject: Re: [PATCH] libbpf: fix BTF dedup to support recursive typedef
definitions
On Fri, 2025-11-07 at 16:34 +0100, paulhoussel2@...il.com wrote:
> From: Paul Houssel <paul.houssel@...nge.com>
>
> 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 <martin.horth@...ecom-sudparis.eu>
> Signed-off-by: Martin Horth <martin.horth@...ecom-sudparis.eu>
> Co-developed-by: Ouail Derghal <ouail.derghal@...-atlantique.fr>
> Signed-off-by: Ouail Derghal <ouail.derghal@...-atlantique.fr>
> Co-developed-by: Guilhem Jazeron <guilhem.jazeron@...ia.fr>
> Signed-off-by: Guilhem Jazeron <guilhem.jazeron@...ia.fr>
> Co-developed-by: Ludovic Paillat <ludovic.paillat@...ia.fr>
> Signed-off-by: Ludovic Paillat <ludovic.paillat@...ia.fr>
> Co-developed-by: Robin Theveniaut <robin.theveniaut@...t.fr>
> Signed-off-by: Robin Theveniaut <robin.theveniaut@...t.fr>
> Suggested-by: Tristan d'Audibert <tristan.daudibert@...il.com>
> Signed-off-by: Paul Houssel <paul.houssel@...nge.com>
>
> ---
> The issue was originally observed when attempting to encode BTF for
> Kubernetes binaries (kubectl, kubeadm):
>
> $ git clone --depth 1 https://github.com/kubernetes/kubernetes
> $ cd ./kubernetes
> $ make kubeadm DBG=1
> $ pahole --btf_encode_detached=kubeadm.btf _output/bin/kubeadm
> btf_encoder__encode: btf__dedup failed!
> Failed to encode BTF
Hi Paul,
Could you please provide some details on why would you like to use BTF
for golang programs? Also, is this the only scenario when golang
generated DWARF has loops not possible in C code?
[...]
Powered by blists - more mailing lists