Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp41496lqb; Tue, 4 Jun 2024 04:38:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUiAC95KzXqm93MwNjfdaJ1HSYZ0chnhlHCN5RcDk1LJyiab4gmr7Gjmt16oR3NkZQh1yhObrDZzs5NYhPH5mwnPqNJk0BbQEHLAqRnlw== X-Google-Smtp-Source: AGHT+IFBnrq1SB8XMoohoGzgr5BFFaH5svBppFewghf63zCKXROy8J9SCZU7UmJtL9v7DRx870fN X-Received: by 2002:a17:907:9483:b0:a68:f6b7:714e with SMTP id a640c23a62f3a-a68f6b7722amr539654466b.6.1717501132593; Tue, 04 Jun 2024 04:38:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717501132; cv=pass; d=google.com; s=arc-20160816; b=DXwmdPrHyVUU8mYLjC47sc1Fm46ijmCIl0lyJD+NdNcQXr4SluO7pdPF6IsFjfVG8V t8UjKDunOFDsxyCiE8ckz/8OftiYLTLFFaMxfqUx6PlmB1GTGptKVJ+7P+VptweBWw8d Ae1hGuB2pnrpeSRi8T3OXBSKMP2Lxu1i2BmjZq8bd97PtBwAmb4EWg9lrMEubHF8s/PT DwLiqW76z/f1C9cINc0prTdoPLcwr6O5+bKuX+x1GJqXE30BobfS3FaNhCupJjD7nK7V URCQ6o/2Kx0t5hOsrHBsKO4RAOisgMs92DYb7XCeWTToqRJ4CnoqtwGUyZJ2i0TE//DQ RChg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Zx5gzWvsX1CLYXF4Eo80o5aX4EsZsHxwME8G8ouxS70=; fh=OZ6i+ePaJR7rwMeySWalthsdP2CJSbOEbcYJNINvpjs=; b=B3fmLKoGLRZpBS4bpYQxdBYJEnRKyk83ksbOJUB14cRsYB5qiMJhGgMcAafzqIjDxe Yc/2i/5Vix36A/fYdHL50YeTen/QvfnNF48w8g4FjXcELR9lNNB2kNkH5vakJ8nazQwf GLsQEHpocQo7Iua6aTTwJ86dHjb7EOO1NJkLLv/Qcy3MUXfK1otHLPV4auEWCQFnhEVk uAbRfvdWSDeGs6ay9iVs9tMGsdxJOld4+3MJ+qEM1W7XagDhUL/MIvZr9v4NSagIkTZU 8hgMb6+j5Psddx3T38Euc2GyS2DRAigtvWqgtmWLwCkfnrxOTljhs+z4+ews7nyRow6k QvsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CnTyLfnr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-200522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a69095a7d7esi201441066b.231.2024.06.04.04.38.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 04:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CnTyLfnr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-200522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 529B81F23702 for ; Tue, 4 Jun 2024 11:38:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB791145A04; Tue, 4 Jun 2024 11:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CnTyLfnr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C58E1422D1; Tue, 4 Jun 2024 11:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717501120; cv=none; b=P9oxVr3cxnOPZqheftZGFyxt742I7iWBQpFBayAEIVWOUbgF7WTJfPKFkg2f3fv/4Fl0D7DjWXv9sFxGjfP5PU3m6NQUH9DYjd64/EBAQNxLa0NrL3ny2I0DUwDwaKhK086t/pAtR+jg83glgJEgwNdic7A1xcjWTfsMFXAG7Jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717501120; c=relaxed/simple; bh=GtcAYrRqb6w1aZ+SFaBxNrVc7F5CbXLwhUVHHa87tRE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=at32HhmYE+RHjSaXBqhlGncO4EECLveAkIqPinHSEyVVdgWNBrF8NC7Hs5pi8TfiTVzMoTF8JqfhdbSQrfe3wvqC1JSF8qSBTyIY9ZcG7nGIKrxMflkGAedof2oZCMEPw8vZwSZzhJk2CwOueLQ4KxyyTOdhikJYtapST6cfHc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CnTyLfnr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D5E9C4AF07; Tue, 4 Jun 2024 11:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717501119; bh=GtcAYrRqb6w1aZ+SFaBxNrVc7F5CbXLwhUVHHa87tRE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CnTyLfnr4EboZbPq1pMFsHretWsJBnWnfbhKZSEmBqgwfjw+QRkLYDZAGSYk2RURT tTewdlPn07ynKSBXtPkxIdO3KqLYYWDHDsAB8X+rDyTBV6z1Oh5AcMk3c6hf0a4uVY iTgnsNcbkxm0EfAkXuWTyPyBe6NEGpCsyoYoiJA1mZkWNdW+pi9gAGr6QmWC1LpUge Q0W6haGun23zoK5mqRVcIz2t1YMfLZXFvV2iG/DqO0s1zsRleaYM5puf++rVrMG6rJ jxsV6qa+lYumBUFOgv33R/brUzyJB3sMnoNRqxsA4FDuAzDlkYVSj1KqE/6ORtIgGe jKPQY3aQrC1Bg== Date: Tue, 4 Jun 2024 14:38:34 +0300 From: Leon Romanovsky To: Hillf Danton , Tejun Heo Cc: Peter Zijlstra , Lai Jiangshan , Zqiang , linux-kernel@vger.kernel.org, Gal Pressman , Tariq Toukan , RDMA mailing list Subject: Re: [PATCH -rc] workqueue: Reimplement UAF fix to avoid lockdep worning Message-ID: <20240604113834.GO3884@unreal> References: <4c4f1fb769a609a61010cb6d884ab2841ef716d3.1716885172.git.leon@kernel.org> <20240531034851.GF3884@unreal> <20240604105456.1668-1-hdanton@sina.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240604105456.1668-1-hdanton@sina.com> On Tue, Jun 04, 2024 at 06:54:56PM +0800, Hillf Danton wrote: > On Tue, 4 Jun 2024 11:09:58 +0300 Leon Romanovsky > > On Mon, Jun 03, 2024 at 10:10:36AM -1000, Tejun Heo wrote: > > > > > > And KASAN is reporting use-after-free on a completely unrelated VFS object. > > > I can't tell for sure from the logs alone but lockdep_register_key() > > > iterates entries in the hashtable trying to find whether the key is a > > > duplicate and it could be that that walk is triggering the use-after-free > > > warning. If so, it doesn't really have much to do with workqueue. The > > > corruption happened elsewhere and workqueue just happens to traverse the > > > hashtable afterwards. > > > > The problem is that revert of commit 643445531829 > > ("workqueue: Fix UAF report by KASAN in pwq_release_workfn()") > > fixed these use-after-free reports. > > > Given revert makes sense, Thanks, it is very rare situation where call to flush/drain queue (in our case kthread_flush_worker) in the middle of the allocation flow can be correct. I can't remember any such case. So even we don't fully understand the root cause, the reimplementation is still valid and improves existing code. Thanks