On Thu, 2024-04-25 at 18:28 -0600, 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. I tried to double-check results produced by this patch and found that decl_tag for one kfunc is missing, namely, the following function: [66020] FUNC 'update_socket_protocol' type_id=66018 linkage=static And it is present in symbols table (15 is a number of the .BTF_ids section): 60433: ffffffff8293a7fc 4 OBJECT LOCAL DEFAULT 15 __BTF_ID__func__update_socket_protocol__78624 Interestingly, this is the last symbol printed for the section. I'll try to debug this issue.