From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 259AAC433EF for ; Tue, 19 Apr 2022 20:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JmMjjN6njznqu17NBSfVZIQTqSQdjje7sBN4MEghsJ4=; b=KyNJ1FZ76SYJrO KfDHx3IPHcC2kbHeK8WqS99mZsnDlXdMLWfuq5TShI2cNfdq7b55xVbNaKHCUIm3dRzS7rf3UQZNH Y7JiugZN9czdxMZKdTruyezipmIS5DPaR4ufnecPVm8UP08chNABzYGuzbze3YjOy9lj2j3AV+1Yz aR2aOsvUJA2HwhIepxiIryYIIrgKWs+vGPthkUmt77iBLHhaPnfkEyLWEeySpZVWfGpajyRTtGBfe uUlIw7y2oyjE3VJFqTLk9NAlk3ElEES5528/xvRQudS5abheJjDAOb1aTMIFsAYYWzOSZ8QD3ukK5 teZjM3FRc0W6f0IjkaEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nguGW-0065W4-7V; Tue, 19 Apr 2022 20:16:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nguGS-0065VW-Ds for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 20:15:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F401E1063; Tue, 19 Apr 2022 13:15:52 -0700 (PDT) Received: from [10.57.41.251] (unknown [10.57.41.251]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B021B3F73B; Tue, 19 Apr 2022 13:15:50 -0700 (PDT) Message-ID: <2768d617-1c61-3b12-e32f-3901881ebe3d@arm.com> Date: Tue, 19 Apr 2022 21:15:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] iommu/arm-smmu-v3: Align size in __arm_smmu_tlb_inv_range Content-Language: en-GB To: Nicolin Chen , Jason Gunthorpe Cc: will@kernel.org, joro@8bytes.org, thunder.leizhen@huawei.com, tglx@linutronix.de, john.garry@huawei.com, jean-philippe@linaro.org, christophe.jaillet@wanadoo.fr, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20220413041745.35174-1-nicolinc@nvidia.com> <37c02fc4-d793-b003-f612-206c987a8a42@arm.com> <13c91dfb-c540-ed8d-daa7-eab7207df221@arm.com> <20220419200233.GN64706@ziepe.ca> From: Robin Murphy In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220419_131556_560635_A3AA72EE X-CRM114-Status: GOOD ( 16.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-04-19 21:05, Nicolin Chen wrote: > On Tue, Apr 19, 2022 at 05:02:33PM -0300, Jason Gunthorpe wrote: > >>> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c >>> index d816759a6bcf..e280568bb513 100644 >>> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c >>> @@ -183,7 +183,7 @@ static void arm_smmu_mm_invalidate_range(struct mmu_notifier *mn, >>> { >>> struct arm_smmu_mmu_notifier *smmu_mn = mn_to_smmu(mn); >>> struct arm_smmu_domain *smmu_domain = smmu_mn->domain; >>> - size_t size = end - start + 1; >>> + size_t size = end - start; >> >> +1 to this bug fix. You should send a formal patch for stable with a fixes/etc >> >> mmu notifiers uses 'end' not 'last' in alignment with how VMA's work: >> >> include/linux/mm_types.h: unsigned long vm_end; /* The first byte after our end address > > Thanks for the review! > > Yea, I will send a new patch. Yup, +1 from me too - this is exactly the kind of thing I suspected - and I reckon it might even be worth a comment in the code here that mm's "end" is an exclusive limit, to help us remember in future. If there doesn't look to be any way for completely arbitrarily-aligned addresses to slip through then I'd be tempted to leave it at that (i.e. reason that if the infinite loop can only happen due to catastrophic failure then it's beyond the scope of things that are worth trying to mitigate), but I'll let Jean and Will have the final say there. Cheers, Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel