Re: [PATCH bpf-next v1 7/8] resolve_btfids: Discover kfuncs from BTF ID sets

Eduard Zingerman <[email protected]> Tue, 28 Jul 2026 18:39:02 -0700
Newsgroups org.kernel.vger.linux-input,org.kernel.vger.bpf
Message-ID <[email protected]>
On Wed, 2026-07-22 at 16:35 -0700, Ihor Solodrai wrote:
> collect_kfuncs() currently uses bpf_kfunc decl tags to identify the
> list of kfuncs. The decl tags are generated by pahole, which makes
> current implementation implicitly rely on those tags being generated.
> 
> The authoritative source, used by the the BPF verifier for kfunc
> registration, of functions being BPF kfuncs are
> BTF_KFUNCS_START()/END() declarations. These are BTF_ID_SET8 under the
> hood. Currently resolve_btfids reads kfunc flags from these sets, and
> populates them with BTF IDs.
> 
> Implement kfunc discovery from BTF_ID_SET8 symbols in resolve_btfids,
> removing the dependency on pahole's emmission of decl tags.
> 
> Walk BTF_ID_KIND_SET8 sets, and use the address-to-symbol index to
> look up set entry's BTF_ID symbol name (before .BTF_ids is patched),
> recording the paired flags directly. This makes find_kfunc_flags()
> helper unnecessary, so it's removed.
> 
> Signed-off-by: Ihor Solodrai <[email protected]>
> ---

Reviewed-by: Eduard Zingerman <[email protected]>

...