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] [day] [month] [year] [list]
Message-ID: <aGaySZ-CO4l9PrC_@slm.duckdns.org>
Date: Thu, 3 Jul 2025 06:39:37 -1000
From: Tejun Heo <tj@...nel.org>
To: Dennis Zhou <dennis@...nel.org>
Cc: Jeongjun Park <aha310510@...il.com>,
	"Christoph Lameter (Ampere)" <cl@...two.org>,
	akpm@...ux-foundation.org, vbabka@...e.cz, rientjes@...gle.com,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	syzbot+e5bd32b79413e86f389e@...kaller.appspotmail.com
Subject: Re: [PATCH] mm/percpu: prevent concurrency problem for
 pcpu_nr_populated read with spin lock

On Wed, Jul 02, 2025 at 10:51:25PM -0700, Dennis Zhou wrote:
> > However, since pcpu_nr_pages(), which performs a read operation on
> > pcpu_nr_populated, is not protected by pcpu_lock, races between read/write
> > can easily occur.
> > 
> > Therefore, I think it is appropriate to protect it through pcpu_lock
> > according to the comment written in the definition of pcpu_nr_populated.
> 
> You're right that this is a race condition, but this was an intention
> choice done because the value read here is only being used to pass
> information to userspace for /proc/meminfo. As Christoph mentioned, the
> caller of pcpu_nr_pages() will never see an invalid value nor does it
> really matter either.

This isn't an actual race condition. The value can be read atomically and an
unprotected read can't lead to a result which wouldn't be possible when
reading under the lock. ie. Whether the lock is added or not, the end result
doesn't change. It's just that syzbot can't tell the difference.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ