Re: [PATCH bpf-next] selftests/bpf: add btf dedup test covering module BTF dedup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/06/2025 14:51, Jiri Olsa wrote:
> On Fri, Jun 20, 2025 at 03:34:14PM +0200, Jiri Olsa wrote:
>> On Wed, Apr 30, 2025 at 02:42:49PM +0100, Alan Maguire wrote:
>>> Recently issues were observed with module BTF deduplication failures
>>> [1].  Add a dedup selftest that ensures that core kernel types are
>>> referenced from split BTF as base BTF types.  To do this use bpf_testmod
>>> functions which utilize core kernel types, specifically
>>>
>>> ssize_t
>>> bpf_testmod_test_write(struct file *file, struct kobject *kobj,
>>>                        struct bin_attribute *bin_attr,
>>>                        char *buf, loff_t off, size_t len);
>>>
>>> __bpf_kfunc struct sock *bpf_kfunc_call_test3(struct sock *sk);
>>>
>>> __bpf_kfunc void bpf_kfunc_call_test_pass_ctx(struct __sk_buff *skb);
>>>
>>> For each of these ensure that the types they reference -
>>> struct file, struct kobject, struct bin_attr etc - are in base BTF.
>>> Note that because bpf_testmod.ko is built with distilled base BTF
>>> the associated reference types - i.e. the PTR that points at a
>>> "struct file" - will be in split BTF.  As a result the test resolves
>>> typedef and pointer references and verifies the pointed-at or
>>> typedef'ed type is in base BTF.  Because we use BTF from
>>> /sys/kernel/btf/bpf_testmod relocation has occurred for the
>>> referenced types and they will be base - not distilled base - types.
>>>
>>> For large-scale dedup issues, we see such types appear in split BTF and
>>> as a result this test fails.  Hence it is proposed as a test which will
>>> fail when large-scale dedup issues have occurred.
>>>
>>> [1] https://lore.kernel.org/dwarves/CAADnVQL+-LiJGXwxD3jEUrOonO-fX0SZC8496dVzUXvfkB7gYQ@xxxxxxxxxxxxxx/
>>>
>>> Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
>>
>> hi Alan,
>> this one started to fail in my tests.. it's likely some screw up in
>> my environment, but I haven't found the cause yet, I'm using the
>> pahole 1.30 .. just cheking if it's known issue already ;-)
> 
> hum, it might be my gcc-14 .. will upgrade
>

hi Jiri, is it possible you were using the pre-dedup-fix pahole, i.e.
the official 1.30, or a version without

commit 6362d1f1657e3381e3e622d70364145f72804504
Author: Alan Maguire <alan.maguire@xxxxxxxxxx>
Date:   Tue Apr 29 20:49:05 2025 +0100

    pahole: Sync with libbpf mainline

    To pull in dedup fix in

    commit 8e64c387c942 ("libbpf: Add identical pointer detection to
btf_dedup_is_equiv()")

    sync with latest libbpf.

? That would mean you would hit the module dedup failure and the test
would fail as a result. If that's the case, if you could try syncing to
the "next" branch of pahole and see if it recurs, that would be great!
Thanks!

Alan

> jirka





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux