Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1143116rdf; Wed, 22 Nov 2023 06:47:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcjuHEpSG4jyvhyo5iMxSXmOm+wdoGjj2tcMTJmXx0u9gqDjGYgRSwnf9i9Mxm/nGlPrmK X-Received: by 2002:a05:6e02:2146:b0:35b:4b9:7883 with SMTP id d6-20020a056e02214600b0035b04b97883mr2960217ilv.25.1700664426417; Wed, 22 Nov 2023 06:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700664426; cv=none; d=google.com; s=arc-20160816; b=vMUlXqgezmsdv+tITC1CepklhEbX4kZIN+opH/IGRU5OAPFqsoM/Xdj375togfK9HA xaTlSpDlaZ0NbmyT7sZch13ypBj4qj/aRFYLILY6oyWYdF2AkkxpSaD+LMlMTgEuIFIb fr/ALKeWrlozGCJ70PkbIJbnA2j9xit850DtRQSYd5pC6eaAHXlWtrU/HcsR3QyLR0sS ILZFe/ucVjVX4RsK9omE/pi0JOl0gZGAVWKozm1Ka5ZFyD4gAYXHBD/m0GictoE4FDRV JM6AIFOt9A2C1FVkgy2M9MCTGGIOfyv4agf9y4RSA3wgxzkJStiknReDL27I+k+IqkYj G5Tw== 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:dkim-signature; bh=JpgEUrp/50w0ygdTn3qYFOn1Z48OxgwgA95p41uKPy0=; fh=Y09HqJQ3L2wbqtVhbN0iEApEMW0m85cBd1//v+0aZQo=; b=Ccc7OuBjziX3Lvr3cma5FhxzGo1QksbAarMuk2vRyPlo8QLNLrjxny0CdRxK5lZsVC kpn3J0pYeziJJB0wFtQIwx2JSUTOFpY5jquZADPANTffDm6O9Icu5vKz9FQ3eHzG1kn/ /KpDzwBNdozrS8SrG7T5pmKoePA80UXZFMM5u6F+SyvkEZtNjydedG+C71i47wTg16T4 qJRBHy4gbsVhwWzF1XKGQKjlHi5SPRj5Ay14FEF6bD714wqGJFUVAMv75IwCyO+HmsVj 12pVxBE1p3S41u6y/NxfnEL0cf2EW/Hjmfx9sP4CFk7tCg8MaEfSf3Niii4BNFHSxcpG CccQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tQN/Apdw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id j36-20020a635524000000b00578eafd0826si12728293pgb.398.2023.11.22.06.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 06:47:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tQN/Apdw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7689D80C92F9; Wed, 22 Nov 2023 06:45:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232064AbjKVOpB (ORCPT + 99 others); Wed, 22 Nov 2023 09:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbjKVOo7 (ORCPT ); Wed, 22 Nov 2023 09:44:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B54419D for ; Wed, 22 Nov 2023 06:44:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FAC0C433C7; Wed, 22 Nov 2023 14:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700664295; bh=h5w3izkPOTDID1ezFWef52/xpayVyQG+sKxK2opBXic=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tQN/ApdwId0YZXaPIOrYdYglm5uofDpV92WPDX9Oea02vjC+1xvKsc0ECsUP2pSb/ q7ugkyRzFQ8Hij4vHm/bfs6SZ/og9LQjuGE6TFB2rHqbR4eCv4p49bbrwEr5RJjsPl TEzrcBuanxqqk4aZPZ/FHbiAwDl87d2tZMcc0XtU= Date: Wed, 22 Nov 2023 14:44:53 +0000 From: Greg KH To: Jason Gunthorpe Cc: Robin Murphy , joro@8bytes.org, will@kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, rafael@kernel.org, lenb@kernel.org, lpieralisi@kernel.org, andre.draszik@linaro.org, quic_zhenhuah@quicinc.com Subject: Re: [PATCH] iommu: Avoid more races around device probe Message-ID: <2023112238-sierra-chewable-86fc@gregkh> References: <16f433658661d7cadfea51e7c65da95826112a2b.1700071477.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 06:45:18 -0800 (PST) On Thu, Nov 16, 2023 at 01:05:58PM -0400, Jason Gunthorpe wrote: > On Wed, Nov 15, 2023 at 06:25:44PM +0000, Robin Murphy wrote: > > It turns out there are more subtle races beyond just the main part of > > __iommu_probe_device() itself running in parallel - the dev_iommu_free() > > on the way out of an unsuccessful probe can still manage to trip up > > concurrent accesses to a device's fwspec. Thus, extend the scope of > > iommu_probe_device_lock() to also serialise fwspec creation and initial > > retrieval. > > > > Reported-by: Zhenhua Huang > > Link: https://lore.kernel.org/linux-iommu/e2e20e1c-6450-4ac5-9804-b0000acdf7de@quicinc.com/ > > Fixes: 01657bc14a39 ("iommu: Avoid races around device probe") > > Signed-off-by: Robin Murphy > > --- > > > > This is my idea of a viable fix, since it does not need a 700-line > > diffstat to make the code do what it was already *trying* to do anyway. > > This stuff should fundamentally not be hanging off driver probe in the > > first place, so I'd rather get on with removing the underlying > > brokenness than waste time and effort polishing it any further. > > I'm fine with this as some hacky backport, but I don't want to see > this cross-layer leakage left in the next merge window. > > ie we should still do my other series on top of and reverting this. > > I've poked at moving parts of it under probe and I think we can do > substantial amounts in about two more series and a tidy a bunch of > other stuff too. I agree, it's messy and acpi should not need this, BUT at the moment, I can't see any other way to resolve this simply. So here's a begrudged ack: Acked-by: Greg Kroah-Hartman and hopefully the larger series should resolve this correctly? Can that be rebased on top of this? Also, cc: stable on this for whomever applies it? thanks, greg k-h