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: <CAO9qdTEL1xhBOXbSR4KHgmh0vpEeiia5ii9Ae959ahFHLVycRQ@mail.gmail.com>
Date: Thu, 8 May 2025 13:47:32 +0900
From: Jeongjun Park <aha310510@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: urezki@...il.com, edumazet@...gle.com, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm/vmalloc: fix data race in show_numa_info()

Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Wed,  7 May 2025 23:25:52 +0900 Jeongjun Park <aha310510@...il.com> wrote:
>
> > The following data-race was found in show_numa_info():
> >
> > ...
> >
> >
> > According to this report, there is a read/write data-race because m->private
> > is accessible to multiple CPUs. To fix this, instead of allocating the heap
> > in proc_vmalloc_init() and passing the heap address to m->private,
> > show_numa_info() should allocate the heap.
> >
> > One thing to note is that show_numa_info() is called in a critical section
> > of a spinlock, so it must be allocated on the heap with GFP_ATOMIC flag.
>
> GFP_ATOMIC is unfortunate.  Can vmalloc_info_show() allocate the
> storage outside the lock and pass that pointer into show_numa_info()?
> That way will be more efficient also, less allocating and freeing.
>
>

That's good idea! Definitely, if you modify vmalloc_info_show() to
allocate the heap before taking the spinlock and initialize the heap
to 0 at the beginning of the loop, we don't need to use GFP_ATOMIC,
and we only need to allocate the heap once, which is much more efficient.

I'll send you v4 patch that reflects this right away.

Regards,

Jeongjun Park

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ