Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3339205rwb; Tue, 16 Aug 2022 00:39:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6kaIK+iO1wlRYCx0jE2p6DQdVf7yDT5Y0OkNHR/QpLBWl2Lp+C2aglxgIsAJHl5nQvRnfg X-Received: by 2002:a17:90b:3805:b0:1f4:ebfe:558b with SMTP id mq5-20020a17090b380500b001f4ebfe558bmr32151940pjb.48.1660635577590; Tue, 16 Aug 2022 00:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660635577; cv=none; d=google.com; s=arc-20160816; b=0wCPquabrhMPW5iU6UExiAPHJJ5yekj9U4dFa/OeOnSa6rzm9Xe1M20FAxJNEYW1nw IbCfNrlugvfFtkqxY/8fui0tyjU9Cm4s6ioVkogSiL7Bn8u2bN/5W9oAdZ1HDoj3NouM 03qSiDM0Juu+X/mZaaXyNMNmRl0ElLt/tpXusw+bYnrjwcau6g9jDlDIpGdQNVewAR8n 5Ffi3lCrfHhfqTyK/PGB/o2wJUIKZFUOkHVoMl+r8i7cAoWzlSAm+AZUeKrpIj7ReXUs MVMj5PNO6uU8QFztquD5vMvPsJQciofmwMbppDv47cq17glz+PNN4rap5AG2DqeY5Lp1 4qiA== 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 :message-id:subject:cc:to:from:date; bh=Z124IwH9Twn7jWIe5aywtncFhPJaLSMPQfQspU/z6Xc=; b=oIcrO2UJCn6yNp/04Oc3nDeeZbGhXL/AGyBAuIJNz+CDzJS+jaPgsKh77S2Ka55qYp ++sM8IILImxzmlAyjGMztprJegPv6ykSmwV3YKLSMFHAUIYxT6WBpF3cuhWdzkzX+Itb SNyFBOzKYeCvkOZcBEq9p5kRxlSQ2QiqkfQspRjWweEEwDSh1gzlepdYi2eAPvYOeqTd n1+85ckIepdTgV8MwGI6We8cgPHtl83GNvXwfif4AHOAAfzXxFUtcJiiedJfLbZOwyxk /NuD3qCk0Pc0UnWCraUwVYxHxUMQkRL6ZhqKPo07YzlY6Njq++ESYNsYxK2ymgcQ04KX rZqQ== 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 e14-20020a63d94e000000b00422d6db433bsi1576562pgj.317.2022.08.16.00.39.27; Tue, 16 Aug 2022 00:39:37 -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 S231958AbiHPHfI (ORCPT + 99 others); Tue, 16 Aug 2022 03:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232213AbiHPHec (ORCPT ); Tue, 16 Aug 2022 03:34:32 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5262D4763; Mon, 15 Aug 2022 21:15:33 -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 1oNnyh-00BTJZ-RG; Tue, 16 Aug 2022 14:14:56 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Tue, 16 Aug 2022 12:14:55 +0800 Date: Tue, 16 Aug 2022 12:14:55 +0800 From: Herbert Xu To: Hector Martin , Linus Torvalds Cc: tj@kernel.org, will@kernel.org, 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, marcan@marcan.st, stable@vger.kernel.org Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220815175810.17780-1-marcan@marcan.st> X-Newsgroups: apana.lists.os.linux.kernel 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 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). 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 Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt