[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzb4LZK5p08t1y-32wAFDGoRGKR1w1T_je6+a_EOE2uSYQ@mail.gmail.com>
Date: Thu, 15 May 2025 10:53:10 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Kees Cook <kees@...nel.org>
Cc: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Shung-Hsi Yu <shung-hsi.yu@...e.com>,
bpf@...r.kernel.org, linux-mm@...ck.org, Andrii Nakryiko <andrii@...nel.org>,
Ihor Solodrai <ihor.solodrai@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>, Vlastimil Babka <vbabka@...e.cz>, Uladzislau Rezki <urezki@...il.com>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
regressions@...ts.linux.dev, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Eduard Zingerman <eddyz87@...il.com>
Subject: Re: [REGRESSION] bpf verifier slowdown due to vrealloc() change since 6.15-rc6
On Thu, May 15, 2025 at 10:41 AM Kees Cook <kees@...nel.org> wrote:
>
> On Thu, May 15, 2025 at 10:18:21AM -0700, Pawan Gupta wrote:
> > On Thu, May 15, 2025 at 09:51:15AM -0700, Kees Cook wrote:
> > > On Thu, May 15, 2025 at 07:51:26AM -0700, Kees Cook wrote:
> > > > On May 15, 2025 6:12:25 AM PDT, Shung-Hsi Yu <shung-hsi.yu@...e.com> wrote:
> > > > >There is an observable slowdown when running BPF selftests on 6.15-rc6
> > > > >kernel[1] built with tools/testing/selftests/bpf/{config,config.x86_64}.
> > > > [...]
> > > > Where can I find the .config for the slow runs?
> > >
> > > Oops, I can read. :) Doing a build now...
> > >
> > > > And how do I run the test myself directly?
> > >
> > > I found:
> > > https://docs.kernel.org/bpf/bpf_devel_QA.html
> > >
> > > But it doesn't seem to cover a bunch of stuff (no way to prebuild the
> > > tests, no info on building the test modules).
> > >
> > > This seems to be needed:
> > >
> > > make O=regression-bug -C tools/testing/selftests/bpf/test_kmods
> > >
> > > But then the booted kernel doesn't load it (missing signatures?)
> > >
> > > Anyway, I'll keep digging...
> >
> > After struggling with this for a while, I figured vmtest.sh is the easiest
> > way to test bpf:
> >
> > ./tools/testing/selftests/bpf/vmtest.sh -i ./test_progs
>
> I can't even build the test_progs. :(
>
> $ make test_progs
> ...
> CLNG-BPF [test_progs] bpf_iter_tasks.bpf.o
> progs/bpf_iter_tasks.c:98:8: error: call to undeclared function 'bpf_copy_from_user_task_str'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 98 | ret = bpf_copy_from_user_task_str((char *)task_str1, sizeof(task_str1), ptr, task, 0
> );
> | ^
> 1 error generated.
>
BPF selftests expect that there was a successful kernel build done
before that. So generally speaking:
0) cd <linux/repo/path>
1) export O=/path/to/build
2) cat tools/testing/selftests/bpf/config >> /path/to/build/.config
3) make O=/path/to/build -j$(nproc) oldefconfig all
4) cd tools/testing/selftests/bpf # everything is built within this
directory, we don't support KBUILD_PATH or O for BPF selftests build
artifacts
5) make O=/path/to/build -j$(nproc)
step #5 will search for vmlinux image across O, KBUILD_PATH or in
current linux source repo (in that order), and will generate necessary
vmlinux.h header out of BTF information embedded in vmlinux, which is
necessary for tests
You might need some dependent packages (libelf-devel, zlib-devel,
maybe some other, don't remember) to build everything, but if you are
on recent enough Clang (19? might work with a bit older one), you
should be good.
But tbh, if the above causes you problems, I don't think you need to
spend that much time trying to build BPF selftests, given you know
what the issue is and you are fixing it.
>
> --
> Kees Cook
>
Powered by blists - more mailing lists