[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaTWa9fELJLh+bxnOb0P1EMQmaRbJVG0L+nXZdy0b8G3Q@mail.gmail.com>
Date: Fri, 4 Feb 2022 14:54:15 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Mauricio Vásquez Bernal <mauricio@...volk.io>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Quentin Monnet <quentin@...valent.com>
Subject: Re: [PATCH bpf-next] libbpf: Fix strict mode calculation
On Fri, Feb 4, 2022 at 2:24 PM Mauricio Vásquez Bernal
<mauricio@...volk.io> wrote:
>
> On Fri, Feb 4, 2022 at 5:05 PM Mauricio Vásquez <mauricio@...volk.io> wrote:
> >
> > The correct formula to get all possible values is
> > ((__LIBBPF_STRICT_LAST - 1) * 2 - 1) as stated in
> > libbpf_set_strict_mode().
> >
> > Fixes: 93b8952d223a ("libbpf: deprecate legacy BPF map definitions")
> >
> > Signed-off-by: Mauricio Vásquez <mauricio@...volk.io>
>
> This patch fixes the problem but I'm not totally convinced it's the
> right approach. As a user I'd expected that `LIBBPF_STRICT_ALL &
> ~LIBBPF_STRICT_MAP_DEFINITIONS` disables
> `LIBBPF_STRICT_MAP_DEFINITIONS`, but it doesn't work because the test
> at libbpf_set_strict_mode() returns -EINVAL.
>
> What about using one of the following ideas instead?
> 1. Remove the check from libbpf_set_strict_mode().
> 2. Define `LIBBPF_STRICT_ALL` containing only the bits set of the
> existing options. `LIBBPF_STRICT_ALL = ((__LIBBPF_STRICT_LAST - 1) *
> 2)- 1`.
can't do the 2) because the point was that applications that compiled
against older libbpf_legacy.h would still be opting into latest
LIBBPF_STRICT_ALL features. I think removing entire check in
libbpf_set_strict_mode() is ok. Let's do that and simplify selftests
and bpftool by straightforward turning off of the bit with
LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS.
Powered by blists - more mailing lists