On Fri, Feb 4, 2022 at 2:24 PM Mauricio Vásquez Bernal <mauricio@xxxxxxxxxx> wrote: > > On Fri, Feb 4, 2022 at 5:05 PM Mauricio Vásquez <mauricio@xxxxxxxxxx> 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@xxxxxxxxxx> > > 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.