Subject: Re: [PATCH bpf-next v8 09/10] selftests/bpf: Extend kfunc selftests

From: Benjamin Poirier <[email-masked]>
Date: Thu, 26 May 2022 15:19:17 +0900

On 2022-05-26 10:45 +0530, Kumar Kartikeya Dwivedi wrote:
> On Thu, May 26, 2022 at 06:52:59AM IST, Benjamin Poirier wrote:
> > On 2022-01-14 22:09 +0530, Kumar Kartikeya Dwivedi wrote:
> > > Use the prog_test kfuncs to test the referenced PTR_TO_BTF_ID kfunc
> > > support, and PTR_TO_CTX, PTR_TO_MEM argument passing support. Also
> > > testing the various failure cases for invalid kfunc prototypes.
> > >
> > > Signed-off-by: Kumar Kartikeya Dwivedi <[email-masked]>
> > > ---
> > >  net/bpf/test_run.c                            | 129 +++++++++++++++++-
> > >  .../selftests/bpf/prog_tests/kfunc_call.c     |   6 +
> > >  .../selftests/bpf/progs/kfunc_call_test.c     |  52 ++++++-
> > >  tools/testing/selftests/bpf/verifier/calls.c  |  75 ++++++++++
> > >  4 files changed, 258 insertions(+), 4 deletions(-)
> > >
> >
> > It looks like this patch broke building the bpf tests:
> >
> > tools/testing/selftests/bpf$ make
> >   CLNG-BPF [test_maps] kfunc_call_test.o
> > progs/kfunc_call_test.c:13:46: error: declaration of 'struct prog_test_pass1' will not be visible outside of this function [-Werror,-Wvisibility]
> > extern void bpf_kfunc_call_test_pass1(struct prog_test_pass1 *p) __ksym;
> >                                              ^
> >
> > The only definition of struct prog_test_pass1 that I see is in
> > net/bpf/test_run.c. How is this supposed to work?
> >
> >
> > commit 87091063df5d ("selftests/bpf: Add test for unstable CT lookup
> > API") from the same series added a similar problem in
> > progs/test_bpf_nf.c:
> >
> > progs/test_bpf_nf.c:31:21: error: variable has incomplete type 'struct bpf_ct_opts'
> >         struct bpf_ct_opts opts_def = { .l4proto = IPPROTO_TCP, .netns_id = -1 };
> >
> 
> Both of them should have their definition in vmlinux.h. Can you check?

My bad, I didn't realize it was generated from the running kernel. The
build works after trying again while running v5.18.