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: <0c0ba856-a4ba-7133-e751-3a81c82311a9@marcan.st>
Date:   Tue, 16 Aug 2022 17:01:39 +0900
From:   Hector Martin <marcan@...can.st>
To:     Herbert Xu <herbert@...dor.apana.org.au>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Will Deacon <will@...nel.org>, Tejun Heo <tj@...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,
        stable@...r.kernel.org
Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*()

On 2022/08/16 16:48, Herbert Xu wrote:
> On Tue, Aug 16, 2022 at 03:28:50PM +0900, Hector Martin wrote:
>>
>> This is the same reason I argued queue_work() itself needs to have a
>> similar guarantee, even when it doesn't queue work (and I updated the
>> doc to match). If test_and_set_bit() is used in this kind of context
>> often in the kernel, clearly the current implementation/doc clashes with
>> that.
> 
> Kernel code all over the place rely on the fact that test_and_set_bit
> provides a memory barrier.  So this bug that you've discovered is
> not at all isolated to the workqeueue system.  It'll break the kernel
> in lots of places in exactly the same way.

Now I'm surprised this isn't failing all over the place, given that...
these things are annoyingly subtle.

Still would want Will & Peter to chime in, of course.

>> As I said, I don't have any particular beef in this fight, but this is
>> horribly broken on M1/2 right now, so I'll send a patch to change the
>> bitops instead and you all can fight it out over which way is correct :)
> 
> Please do.

Already did, but I just realized I forgot to Cc you. Sorry about that,
hope you can pick it up through the MLs:

https://lore.kernel.org/asahi/20220816070311.89186-1-marcan@marcan.st/T/#u

- Hector

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ