[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvqaK3hxix9AaQBO@slm.duckdns.org>
Date: Mon, 15 Aug 2022 09:10:35 -1000
From: Tejun Heo <tj@...nel.org>
To: Hector Martin <marcan@...can.st>
Cc: Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, jirislaby@...nel.org,
Marc Zyngier <maz@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Boqun Feng <boqun.feng@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Oliver Neukum <oneukum@...e.com>,
Roman Pen <roman.penyaev@...fitbricks.com>,
Asahi Linux <asahi@...ts.linux.dev>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*()
On Tue, Aug 16, 2022 at 02:58:10AM +0900, Hector Martin wrote:
> This has been broken since the dawn of time, and it was incompletely
> fixed by 346c09f80459, which added the necessary barriers in the work
> execution path but failed to account for the missing barrier in the
> test_and_set_bit() failure case. Fix it by switching to
> atomic_long_fetch_or(), which does have unconditional barrier semantics
> regardless of whether the bit was already set or not (this is actually
> just test_and_set_bit() minus the early exit path).
...
Oh, tricky one and yeah you're absolutely right that it makes no sense to
not guarantee barrier semantics when already pending. I didn't even know
test_and_set_bit() wasn't a barrier when it failed. Thanks a lot for hunting
down and fixing this. Applied to wq/for-6.0-fixes.
Thanks.
--
tejun
Powered by blists - more mailing lists