lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240722065604.GA2770066@alecto.usersys.redhat.com>
Date: Mon, 22 Jul 2024 08:56:04 +0200
From: Artem Savkov <asavkov@...hat.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
	Daniel Borkmann <daniel@...earbox.net>,
	Alexei Starovoitov <ast@...nel.org>,
	Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
	Network Development <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: fix compilation failure when
 CONFIG_NET_FOU!=y

On Fri, Jul 19, 2024 at 11:44:34AM -0700, Andrii Nakryiko wrote:
> On Fri, Jul 19, 2024 at 10:09 AM Alexei Starovoitov
> <alexei.starovoitov@...il.com> wrote:
> >
> > On Fri, Jul 19, 2024 at 8:45 AM Daniel Borkmann <daniel@...earbox.net> wrote:
> > >
> > > Hi Artem,
> > >
> > > On 7/18/24 4:31 PM, Artem Savkov wrote:
> > > > Without CONFIG_NET_FOU bpf selftests are unable to build because of
> > > > missing definitions. Add ___local versions of struct bpf_fou_encap and
> > > > enum bpf_fou_encap_type to fix the issue.
> > > >
> > > > Signed-off-by: Artem Savkov <asavkov@...hat.com>
> > >
> > > This breaks BPF CI, ptal:
> > >
> > > https://github.com/kernel-patches/bpf/actions/runs/9999691294/job/27641198557
> > >
> > >    [...]
> > >      CLNG-BPF [test_maps] btf__core_reloc_existence___wrong_field_defs.bpf.o
> > >      CLNG-BPF [test_maps] verifier_bswap.bpf.o
> > >      CLNG-BPF [test_maps] test_core_reloc_existence.bpf.o
> > >      CLNG-BPF [test_maps] test_global_func8.bpf.o
> > >      CLNG-BPF [test_maps] verifier_bitfield_write.bpf.o
> > >      CLNG-BPF [test_maps] local_storage_bench.bpf.o
> > >      CLNG-BPF [test_maps] verifier_runtime_jit.bpf.o
> > >      CLNG-BPF [test_maps] test_pkt_access.bpf.o
> > >    progs/test_tunnel_kern.c:39:5: error: conflicting types for 'bpf_skb_set_fou_encap'
> > >       39 | int bpf_skb_set_fou_encap(struct __sk_buff *skb_ctx,
> > >          |     ^
> > >    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/vmlinux.h:107714:12: note: previous declaration is here
> > >     107714 | extern int bpf_skb_set_fou_encap(struct __sk_buff *skb_ctx, struct bpf_fou_encap *encap, int type) __weak __ksym;
> > >            |            ^
> > >    progs/test_tunnel_kern.c:41:5: error: conflicting types for 'bpf_skb_get_fou_encap'
> > >       41 | int bpf_skb_get_fou_encap(struct __sk_buff *skb_ctx,
> > >          |     ^
> > >    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/vmlinux.h:107715:12: note: previous declaration is here
> > >     107715 | extern int bpf_skb_get_fou_encap(struct __sk_buff *skb_ctx, struct bpf_fou_encap *encap) __weak __ksym;
> > >            |            ^
> > >      CLNG-BPF [test_maps] verifier_typedef.bpf.o
> > >      CLNG-BPF [test_maps] user_ringbuf_fail.bpf.o
> > >      CLNG-BPF [test_maps] verifier_map_in_map.bpf.o
> > >    progs/test_tunnel_kern.c:782:35: error: incompatible pointer types passing 'struct bpf_fou_encap___local *' to parameter of type 'struct bpf_fou_encap *' [-Werror,-Wincompatible-pointer-types]
> > >      782 |         ret = bpf_skb_set_fou_encap(skb, &encap, FOU_BPF_ENCAP_GUE___local);
> > >          |                                          ^~~~~~
> > >    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/vmlinux.h:107714:83: note: passing argument to parameter 'encap' here
> > >     107714 | extern int bpf_skb_set_fou_encap(struct __sk_buff *skb_ctx, struct bpf_fou_encap *encap, int type) __weak __ksym;
> >
> > It's a good idea to introduce struct bpf_fou_encap___local
> > for !FOU builds, but kfunc signature needs to stay and
> > __local variable needs to be type casted to (struct bpf_fou_encap *)
> > when calling kfunc.
> 
> Given we specify
> 
> CONFIG_NET_FOU=y (not =m)
> 
> in selftests/bpf/config, do we really need to work around this? I bet
> we have a bunch of other missing types if we don't set all the
> settings as required by selftests/bpf/config.

We do have other missing types and a lot of them (not all) are fixed
the same way with ___local versions by interested parties.

-- 
 Artem


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ