Hi Alan, On Thu, Apr 25, 2024 at 09:16:07AM +0100, Alan Maguire wrote: > On 24/04/2024 18:33, Daniel Xu wrote: > > This commit teaches pahole to parse symbols in .BTF_ids section in > > vmlinux and discover exported kfuncs. Pahole then takes the list of > > kfuncs and injects a BTF_KIND_DECL_TAG for each kfunc. > > > > Example of encoding: > > > > $ bpftool btf dump file .tmp_vmlinux.btf | rg "DECL_TAG 'bpf_kfunc'" | wc -l > > 121 > > > > $ bpftool btf dump file .tmp_vmlinux.btf | rg 56337 > > [56337] FUNC 'bpf_ct_change_timeout' type_id=56336 linkage=static > > [127861] DECL_TAG 'bpf_kfunc' type_id=56337 component_idx=-1 > > > > This enables downstream users and tools to dynamically discover which > > kfuncs are available on a system by parsing vmlinux or module BTF, both > > available in /sys/kernel/btf. > > > > This feature is enabled with --btf_features=decl_tag,decl_tag_kfuncs. > > > > Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx> > > Tested-by: Jiri Olsa <jolsa@xxxxxxxxxx> > > Reviewed-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > > Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > > Signed-off-by: Daniel Xu <dxu@xxxxxxxxx> > > I ran into failures running the reproducible build test in tests/ > with this patch. > > You can reproduce this by running that via > > bash reproducible_build.sh /path/2/vmlinux > > or just doing > > pahole --btf_features=default > --btf_encode_detached=/tmp/vmlinux.btf.serial /path/2/vmlinux > > The problem seems to be with detached encoding. It stems from the > assumption that encoder->filename is the source of the BTF and the > destination. In the case of detached BTF, source and destination are > different, so I think we just need to store both the source and > destination for encoding in struct btf_encoder. > > The following change fixed this for me: > Thanks, I can confirm the patch works. Will respin. Daniel