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: <aAkHrjU22pCSkWif@slm.duckdns.org>
Date: Wed, 23 Apr 2025 05:30:54 -1000
From: Tejun Heo <tj@...nel.org>
To: Jiayuan Chen <jiayuan.chen@...ux.dev>
Cc: linux-kernel@...r.kernel.org, mrpre@....com, mkoutny@...e.com,
	syzbot+01affb1491750534256d@...kaller.appspotmail.com,
	Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [PATCH v1] workqueue: annotate data-races around pwq->stats

On Wed, Apr 23, 2025 at 08:53:41PM +0800, Jiayuan Chen wrote:
> Suppress warning by annotating these accesses using
> READ_ONCE() / WRITE_ONCE().
> 
> Reported-by: syzbot+01affb1491750534256d@...kaller.appspotmail.com
> Signed-off-by: Jiayuan Chen <jiayuan.chen@...ux.dev>
> ---
>  kernel/workqueue.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index cf6203282737..d78640b5d188 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -3241,7 +3241,7 @@ __acquires(&pool->lock)
>  	 * point will only record its address.
>  	 */
>  	trace_workqueue_execute_end(work, worker->current_func);
> -	pwq->stats[PWQ_STAT_COMPLETED]++;
> +	WRITE_ONCE(pwq->stats[PWQ_STAT_COMPLETED], READ_ONCE(pwq->stats[PWQ_STAT_COMPLETED]) + 1);

The function acquires pool->lock down below. Can you move it down inside the
locked region instead of adding READ/WRITE_ONCE()?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ