Re: [PATCH] bpf: fix btf_types_are_same for cross-BTF type comparison
From: Leon Hwang
Date: Tue Apr 07 2026 - 05:01:01 EST
pls also check sashiko's review:
https://sashiko.dev/#/patchset/20260407080900.551797-1-chenyuan_fl%40163.com.
Target tree should be specified: [PATCH bpf] bpf: ...
On 7/4/26 16:09, chenyuan_fl@xxxxxxx wrote:
> From: Yuan Chen <chenyuan@xxxxxxxxxx>
>
> When comparing types from different BTF objects (e.g., module BTF vs
> vmlinux BTF), the original btf_types_are_same() returns false because:
> - Type IDs are local to each BTF
> - Pointer comparison of btf_type_by_id results always fails
>
> This prevents kfuncs with KF_IMPLICIT_ARGS flag from modules (like
> bpf_kfunc_multi_st_ops_test_1_assoc) from properly recognizing implicit
> arguments such as 'struct bpf_prog_aux *', causing the verifier to not
> inject the aux pointer value during fixup.
Should add a selftest to verify the BUG and this fix.
Thanks,
Leon
>
> Fix by comparing actual type content (kind, size, name) when BTFs are
> different instead of comparing pointers.
>
> Signed-off-by: Yuan Chen <chenyuan@xxxxxxxxxx>
> ---
[...]