[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvsZvwxACuGw3KIt@gondor.apana.org.au>
Date: Tue, 16 Aug 2022 12:14:55 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Hector Martin <marcan@...can.st>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: tj@...nel.org, will@...nel.org, peterz@...radead.org,
jirislaby@...nel.org, maz@...nel.org, mark.rutland@....com,
boqun.feng@...il.com, catalin.marinas@....com, oneukum@...e.com,
roman.penyaev@...fitbricks.com, asahi@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
marcan@...can.st, stable@...r.kernel.org
Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*()
Hector Martin <marcan@...can.st> 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).
test_and_set_bit is supposed to contain a full memory barrier.
If it doesn't then your arch is broken and needs to be fixed.
Changing this one spot is pointless because such assumptions
are all over the kernel.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists