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]
Date: Tue, 13 Jun 2023 23:05:34 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Ricardo Nabinger Sanchez <rnsanchez@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
	netdev@...r.kernel.org
Subject: Re: panic in udp_init() when using FORCE_NR_CPUS

On Tue, Jun 13, 2023 at 10:19 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Tue, Jun 13, 2023 at 9:56 PM Ricardo Nabinger Sanchez
> <rnsanchez@...il.com> wrote:
> >
> > Hello,
> >
> > I have hit again an old panic that, in the past, I could not check in
> > more depth.  But today I was able to pinpoint to a single config knob:
> >
> > $ diff -u /mnt/tmp/Kernel/linux-6.4-rc6/.config{.old,}
> > --- /mnt/tmp/Kernel/linux-6.4-rc6/.config.old   2023-06-13
> > 10:34:11.881004307 -0300 +++
> > /mnt/tmp/Kernel/linux-6.4-rc6/.config   2023-06-13
> > 13:42:46.396967635 -0300 @@ -4996,7 +4996,7 @@ CONFIG_SGL_ALLOC=y
> >  CONFIG_CHECK_SIGNATURE=y
> >  CONFIG_CPUMASK_OFFSTACK=y
> > -CONFIG_FORCE_NR_CPUS=y
> > +# CONFIG_FORCE_NR_CPUS is not set
> >  CONFIG_CPU_RMAP=y
> >  CONFIG_DQL=y
> >  CONFIG_GLOB=y
> >
>
> Sure, but you did not give NR_CPUS value ?

I suspect you run with LOCKDEP enabled (CONFIG_PROVE_LOCKING=y)
and a very big NR_CPUS ?

LOCKDEP makes spinlock_t 16 times bigger :/

If so, please try the following fix.

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9482def1f310379efde1a1a8c86999b4b826cf17..ad19a37a49e78715c813b17a1097226dd1450671
100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -3481,8 +3481,13 @@ void __init udp_init(void)

        /* 16 spinlocks per cpu */
        udp_busylocks_log = ilog2(nr_cpu_ids) + 4;
-       udp_busylocks = kmalloc(sizeof(spinlock_t) << udp_busylocks_log,
-                               GFP_KERNEL);
+       while (udp_busylocks_log >= 4) {
+               udp_busylocks = kmalloc(sizeof(spinlock_t) << udp_busylocks_log,
+                                       GFP_KERNEL | __GFP_NOWARN);
+               if (udp_busylocks)
+                       break;
+               udp_busylocks_log--;
+       }
        if (!udp_busylocks)
                panic("UDP: failed to alloc udp_busylocks\n");
        for (i = 0; i < (1U << udp_busylocks_log); i++)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ