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 2C20CC47422 for ; Thu, 25 Jan 2024 17:44:20 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GJU3iyDMOrI0S/zpMdpGAGNoJnlwlzFtQ7cxXaFZiEg=; b=Z+Xv/i4UonZSOC FuZASSwWoygWQVd9XDCGXcuSswU2xjxs9JE3QKdq/JCEY04jWnHNO8OdGRMIHmIrT/FV6B07tswRi YbA+ejnIPO6hAvFT1pbtWy/y+Alb19ugkGSMIGPN21z/hhJn4AdsEGxXRIAaajRTcb1UWlfbaRzuU zDk8N7oTQUB20yUiUqTS0r0aF55Y04YDc+rZXaeBAue5ftt+c4Jwh5hlLaYw4QRcu3dIw40k0yoLP nlcdlmRcnkS618Po8DAHV4j0etEINhI6gRxmri7KTimAMnKEr//HkF8VyfVG3p0imsZ1RAAKGBslT 3UPBt7PquspLUGsvYw/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT3lq-00000001CIp-3gYO; Thu, 25 Jan 2024 17:44:10 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT3ln-00000001CHV-2MWe for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 17:44:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D60D1CE2219; Thu, 25 Jan 2024 17:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 174F1C43390; Thu, 25 Jan 2024 17:44:01 +0000 (UTC) Date: Thu, 25 Jan 2024 17:43:59 +0000 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Andrew Morton , David Hildenbrand , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] arm64/mm: Make set_ptes() robust when OAs cross 48-bit boundary Message-ID: References: <20240125173534.1659317-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240125173534.1659317-1-ryan.roberts@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_094407_872768_FE547932 X-CRM114-Status: GOOD ( 17.30 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 25, 2024 at 05:35:34PM +0000, Ryan Roberts wrote: > Since the high bits [51:48] of an OA are not stored contiguously in the > PTE, there is a theoretical bug in set_ptes(), which just adds PAGE_SIZE > to the pte to get the pte with the next pfn. This works until the pfn > crosses the 48-bit boundary, at which point we overflow into the upper > attributes. > > Of course one could argue (and Matthew Wilcox has :) that we will never > see a folio cross this boundary because we only allow naturally aligned > power-of-2 allocation, so this would require a half-petabyte folio. So > its only a theoretical bug. But its better that the code is robust > regardless. > > I've implemented pte_next_pfn() as part of the fix, which is an opt-in > core-mm interface. So that is now available to the core-mm, which will > be needed shortly to support forthcoming fork()-batching optimizations. > > Fixes: 4a169d61c2ed ("arm64: implement the new page table range API") > Closes: https://lore.kernel.org/linux-mm/fdaeb9a5-d890-499a-92c8-d171df43ad01@arm.com/ > Signed-off-by: Ryan Roberts > --- > > Hi All, > > This applies on top of v6.8-rc1. It's a dependency for David's fork-batch > work, so once Catalin has acked it, it will go through mm-unstable attached to > David's series. Reviewed-by: Catalin Marinas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel