Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3386859rwb; Tue, 16 Aug 2022 01:55:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR7j2SA7sy2XQXD9/KzAbqT35eJWVMUVtkmedCHoNelwaxWnzre1YAJSVSGbtIPmBoic1sEB X-Received: by 2002:a17:902:f54b:b0:170:d34b:9104 with SMTP id h11-20020a170902f54b00b00170d34b9104mr20838463plf.100.1660640112355; Tue, 16 Aug 2022 01:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660640112; cv=none; d=google.com; s=arc-20160816; b=qEAxbH9V0ffYrttZcBH+Yl8+c+lr7yEGXK6/HmNv8vzOYATRUSBG2NQCc0Q77C4NRJ Dc2t6iULOZEsb41NgDMyxO92pIIanfkeZC1z3GYHbWZFYmzKh63zVFri/0YdwChN6B85 tPUl7wlKsuvbxbTTxoLlAt0ljrzHAJsGDGmekZvFgO30yH4cyyA/9oYDEtwDNm1ZfIFK phHOLCCjPsuH9lCbBl6yVbdALOselPHgP7b00bwBlbPgvev7eE8k63Eumv2mOSTuLUYa C9qEmgmX50MnlbElqL+ghrdLSwtv0tHYTMndzYsWC7uQvsejBEUul7tYhDWR7YH/TgAi qqww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=pPUTqGD+sP3ezxLwnt0c7tuUbBQUdzAoCl2reyf8VkU=; b=KWGxQMQ3petL7Qe3ojCAyp6uF/C8RXZPS7Fc3OzMvE4vwyXMmX0OrCaqYctcw1rjOD Cca8nmia1rksbWj/Ar2uhH2gP/b6aEoU4WqXeQPei6v0D61BYt+pkbi8K4BmVqBNkU2X 9ZNmgvDSwNR+iU4T/O2BQlO25P6/0r7AGhYn5X4QptTx56lT41aohDmZ0S57BFsrfGs0 umAyIsS80c5UU3E/Dv4HstgQJRvHJtDdMeE/lbedfKjrvlNONaVK9k1H8pOreM3TOWbX xGpfx+plNwx/aGvqHXpYU7psNrN1wE1Jn4DMVkNMeTFvdmKASztsBwxrKk2z9z3VGn3h 0e0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw6-20020a17090b4d0600b001fa581da1fcsi12697104pjb.24.2022.08.16.01.55.01; Tue, 16 Aug 2022 01:55:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233269AbiHPIcj (ORCPT + 99 others); Tue, 16 Aug 2022 04:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbiHPIbX (ORCPT ); Tue, 16 Aug 2022 04:31:23 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B60512F705; Mon, 15 Aug 2022 22:49:19 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oNpRY-00BVlw-CO; Tue, 16 Aug 2022 15:48:49 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Tue, 16 Aug 2022 13:48:48 +0800 Date: Tue, 16 Aug 2022 13:48:48 +0800 From: Herbert Xu To: Linus Torvalds Cc: Will Deacon , Tejun Heo , marcan@marcan.st, peterz@infradead.org, jirislaby@kernel.org, maz@kernel.org, mark.rutland@arm.com, boqun.feng@gmail.com, catalin.marinas@arm.com, oneukum@suse.com, roman.penyaev@profitbricks.com, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2022 at 10:27:10PM -0700, Linus Torvalds wrote: > > The bug seems to go back to commit e986a0d6cb36 ("locking/atomics, > asm-generic/bitops/atomic.h: Rewrite using atomic_*() APIs"), and the > fix looks to be as simple as just removing that early READ_ONCE return > case (test_and_clear has the same bug). > > Will? I think this is the source of all this: commit 61e02392d3c7ecac1f91c0a90a8043d67e081846 Author: Will Deacon Date: Tue Feb 13 13:30:19 2018 +0000 locking/atomic/bitops: Document and clarify ordering semantics for failed test_and_{}_bit() Unfortunately it doesn't work because lots of kernel code rely on the memory barrier semantics of test_and_set_bit. If ARM really wants this change, then eitehr create a new API for it or audit every single existing use in the kernel. Patching the documentation and then relying on it is magical thinking. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt