Re: [PATCH] selftests/bpf: Use vmlinux.h for BPF programs

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

 



On Fri, Aug 8, 2025 at 8:32 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Thu, Aug 7, 2025 at 4:47 AM Hengqi Chen <hengqi.chen@xxxxxxxxx> wrote:
> >
> > Some of the bpf test progs still use linux/libc headers.
> > Let's use vmlinux.h instead like the rest of test progs.
> > This will also ease cross compiling.
>
> only if...
>
> > diff --git a/tools/testing/selftests/bpf/progs/loop6.c b/tools/testing/selftests/bpf/progs/loop6.c
> > index e4ff97fbcce1..f8e2628c1083 100644
> > --- a/tools/testing/selftests/bpf/progs/loop6.c
> > +++ b/tools/testing/selftests/bpf/progs/loop6.c
> > @@ -1,8 +1,6 @@
> >  // SPDX-License-Identifier: GPL-2.0
> >
> > -#include <linux/ptrace.h>
> > -#include <stddef.h>
> > -#include <linux/bpf.h>
> > +#include "vmlinux.h"
> >  #include <bpf/bpf_helpers.h>
> >  #include <bpf/bpf_tracing.h>
> >  #include "bpf_misc.h"
> > @@ -26,12 +24,6 @@ char _license[] SEC("license") = "GPL";
> >  #define SG_CHAIN       0x01UL
> >  #define SG_END         0x02UL
> >
> > -struct scatterlist {
> > -       unsigned long   page_link;
> > -       unsigned int    offset;
> > -       unsigned int    length;
> > -};
> > -
>
> Pls test your patch before submitting, so that maintainers
> don't need to point to CI that complains about this.
>

Sorry, my bad.

> scetterlist here is not the same as in vmlinux.h which causes issues.
>

After some investigation (with GPT 5), it seems like the issue is raised by
__attribute__((preserve_access_index)) not struct size.

> --
> pw-bot: cr





[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