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: <20250423135101.GA28646@redhat.com>
Date: Wed, 23 Apr 2025 15:51:02 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Jiayuan Chen <jiayuan.chen@...ux.dev>
Cc: linux-kernel@...r.kernel.org, mrpre@....com, mkoutny@...e.com,
	syzbot+adcaa842b762a1762e7d@...kaller.appspotmail.com,
	syzbot+fab52e3459fa2f95df57@...kaller.appspotmail.com,
	syzbot+0718f65353d72efaac1e@...kaller.appspotmail.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	Christian Brauner <brauner@...nel.org>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Suren Baghdasaryan <surenb@...gle.com>,
	Wei Yang <richard.weiyang@...il.com>,
	David Hildenbrand <david@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Mateusz Guzik <mjguzik@...il.com>,
	Joel Granados <joel.granados@...nel.org>,
	Jens Axboe <axboe@...nel.dk>, Wei Liu <wei.liu@...nel.org>,
	Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH v1] pid: annotate data-races around pid_ns->pid_allocated

On 04/23, Jiayuan Chen wrote:
>
> Suppress syzbot reports by annotating these accesses using
> READ_ONCE() / WRITE_ONCE().
...
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -122,7 +122,8 @@ void free_pid(struct pid *pid)
>  	for (i = 0; i <= pid->level; i++) {
>  		struct upid *upid = pid->numbers + i;
>  		struct pid_namespace *ns = upid->ns;
> -		switch (--ns->pid_allocated) {
> +		WRITE_ONCE(ns->pid_allocated, READ_ONCE(ns->pid_allocated) - 1);
> +		switch (READ_ONCE(ns->pid_allocated)) {

I keep forgetting how kcsan works, but we don't need
READ_ONCE(ns->pid_allocated) under pidmap_lock?

Same for other functions which read/modify ->pid_allocated with
this lock held.

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ