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: <4597fb15-a7ed-468b-a7e3-48618e6ff18e@lucifer.local>
Date: Mon, 8 Jul 2024 09:41:29 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Linux regressions mailing list <regressions@...ts.linux.dev>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Mohammad Shehar Yaar Tausif <sheharyaar48@...il.com>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
        Yonghong Song <yonghong.song@...ux.dev>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
        Javier Carrasco <javier.carrasco.cruz@...il.com>,
        Christian Kujau <lists@...dbynature.de>,
        Péter Ujfalusi <peter.ujfalusi@...el.com>,
        Lorenzo Stoakes <lstoakes@...il.com>
Subject: Re: [PATCH RESEND] bpf: fix order of args in call to bpf_map_kvcalloc

On Mon, Jul 08, 2024 at 10:20:33AM GMT, Linux regression tracking (Thorsten Leemhuis) wrote:
> [CCing the regressions list and people mentioned below]
>
> On 12.06.24 16:53, Alexei Starovoitov wrote:
> > On Wed, Jun 12, 2024 at 2:51 AM Mohammad Shehar Yaar Tausif
> > <sheharyaar48@...il.com> wrote:
> >>
> >> The original function call passed size of smap->bucket before the number of
> >> buckets which raises the error 'calloc-transposed-args' on compilation.
> >>
> >> Fixes: 62827d612ae5 ("bpf: Remove __bpf_local_storage_map_alloc")
> >> Reviewed-by: Andrii Nakryiko <andrii@...nel.org>
> >> Signed-off-by: Mohammad Shehar Yaar Tausif <sheharyaar48@...il.com>
> >> ---
> >> - already merged in linux-next
> >> - [1] suggested sending as a fix for 6.10 cycle
> >
> > No. It's not a fix.
>
> If you have a minute, could you please explain why that is? From what I
> can see a quite a few people run into build problems with 6.10-rc
> recently that are fixed by the patch:

This is explicitly breaking my build in Linus's kernel (and subsequently
mm-unstable where I hit it first).

I have gcc 14.1.1, and can easily repro this with a defconfig on x86-64 with:

 make mrproper && make defconfig && scripts/config --enable bpf_syscall && \
 make olddefconfig && make -j $(nproc)

kernel/bpf/bpf_local_storage.c:785:60: error: ‘kvmalloc_array_node_noprof’ sizes
specified with ‘sizeof’ in the earlier argument and not in the laterargument
[-Werror=calloc-transposed-args]
  785 |         smap->buckets = bpf_map_kvcalloc(&smap->map, sizeof(*smap->buckets),


It's kind of surprising no build bot caught this (maybe somebody needs to
look into that), but it's proactively causing problems right now, I have to
keep the kernel patched in order for it to build.

So a fix of some kind is needed, urgently.

>
> * Péter Ujfalusi
> https://lore.kernel.org/bpf/363ad8d1-a2d2-4fca-b66a-3d838eb5def9@intel.com/
>
> * Christian Kujau
> https://lore.kernel.org/bpf/48360912-b239-51f2-8f25-07a46516dc76@nerdbynature.de/
> https://lore.kernel.org/lkml/d0dd2457-ab58-1b08-caa4-93eaa2de221e@nerdbynature.de/
>
> * Lorenzo Stoakes
> https://fosstodon.org/@ljs@social.kernel.org/112734050799590482
>
> At the same time I see that the culprit mentioned above is from 6.4-rc1,
> so I guess it there must be some other reason why a few people seem to
> tun into this now. Did some other change expose this problem? Or are
> updated compilers causing this?

I suspect the latter. It seems x86-64 defconfig unables CONFIG_WERROR by default.

>
> Ciao, Thorsten
>
> >> [1] https://lore.kernel.org/all/363ad8d1-a2d2-4fca-b66a-3d838eb5def9@intel.com/
> >> ---
> >>  kernel/bpf/bpf_local_storage.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> >> index 976cb258a0ed..c938dea5ddbf 100644
> >> --- a/kernel/bpf/bpf_local_storage.c
> >> +++ b/kernel/bpf/bpf_local_storage.c
> >> @@ -782,8 +782,8 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
> >>         nbuckets = max_t(u32, 2, nbuckets);
> >>         smap->bucket_log = ilog2(nbuckets);
> >>
> >> -       smap->buckets = bpf_map_kvcalloc(&smap->map, sizeof(*smap->buckets),
> >> -                                        nbuckets, GFP_USER | __GFP_NOWARN);
> >> +       smap->buckets = bpf_map_kvcalloc(&smap->map, nbuckets,
> >> +                                        sizeof(*smap->buckets), GFP_USER | __GFP_NOWARN);
> >>         if (!smap->buckets) {
> >>                 err = -ENOMEM;
> >>                 goto free_smap;
> >>
> >> ---
> >> base-commit: 2ef5971ff345d3c000873725db555085e0131961
> >> change-id: 20240612-master-fe9e63ab5c95
> >>
> >> Best regards,
> >> --
> >> Mohammad Shehar Yaar Tausif <sheharyaar48@...il.com>
> >>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ