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 EB8EFCFD313 for ; Mon, 24 Nov 2025 18:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=kQNMYKd9siYIhB9tFjsATcj9sVR0Byk2z5xo7rABYOc=; b=WUyNkyhsPzq5I4pig8t6KKFcdq ntqn/b3SpumYZQQaegEFUwgr+337jgkqBHnilW4dxWcx5mc+bwRclAXbqb/u1eBuC+wPf0F95bwje NKgZDZXwZSVELMF/bxStowciN2K7NaqjQx0G3pf+pOycf+kWPe0aQqJxnsfFZrExV/jPJhg9x/YKe lXKEgTMrAYQEmABXxfEM2UMMxGJVoZBUGtR5/ZRh4WI8z9ShVAnPngPgmXCK1O/9enMCTqqI0EsMm W3av8L8ytSwAOXaSaBAdvYU97vrkfMpMiykp/O56vpJ3kCQZgO3i5QRh0ZJ7Ww/Cge6Uq/q8sCn1F WmkOOR+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vNb0K-0000000C9nZ-2dmY; Mon, 24 Nov 2025 18:09:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vNb0I-0000000C9n3-2spS for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2025 18:09:35 +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 76C961477; Mon, 24 Nov 2025 10:09:26 -0800 (PST) Received: from [10.57.88.238] (unknown [10.57.88.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A9C073F86F; Mon, 24 Nov 2025 10:09:32 -0800 (PST) Message-ID: Date: Mon, 24 Nov 2025 18:09:31 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] arm64/pageattr: Propagate return value from __change_memory_common Content-Language: en-GB To: Will Deacon Cc: Dev Jain , catalin.marinas@arm.com, rppt@kernel.org, shijie@os.amperecomputing.com, yang@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20251112062716.64801-1-dev.jain@arm.com> <20251112062716.64801-2-dev.jain@arm.com> <6bc0fac0-3c00-4ecf-948e-5648584ec939@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251124_100934_769451_BF61EA36 X-CRM114-Status: GOOD ( 20.59 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 24/11/2025 15:11, Will Deacon wrote: > On Thu, Nov 13, 2025 at 11:55:48AM +0000, Ryan Roberts wrote: >> On 12/11/2025 06:27, Dev Jain wrote: >>> The rodata=on security measure requires that any code path which does >>> vmalloc -> set_memory_ro/set_memory_rox must protect the linear map alias >>> too. Therefore, if such a call fails, we must abort set_memory_* and caller >>> must take appropriate action; currently we are suppressing the error, and >>> there is a real chance of such an error arising post commit a166563e7ec3 >>> ("arm64: mm: support large block mapping when rodata=full"). Therefore, >>> propagate any error to the caller. >>> >>> Fixes: a166563e7ec3 ("arm64: mm: support large block mapping when rodata=full") >>> Signed-off-by: Dev Jain >> >> Reviewed-by: Ryan Roberts >> >> It would be good to get this into v6.18 I guess? > > I'm not sure I see the urgency. When the commit message says: > > "there is a real chance of such an error arising post commit a166563e7ec3" > > afaict that's either due to -ENOMEM Yes this is the main risk; failing to allocate an intermediate page table during split_kernel_leaf_mapping(). I have no idea how likely that is in production. The only data point I have is that for the theoretical memory hotplug -ENOMEM that Chaitanya and Linu fixed recently, we tried to provoke it by hotplugging a lot of memory on a system under high memory pressure; no matter what we did, we couldn't get that 4K pgtable allocation to fail. So on that basis, I think we are unlikely to see it. > or some hideous issue with the > page-tables (e.g. the -EINVALs in pageattr_pXd_entry() seem completely > unnecessary to me). I thought the -EINVALs were trying to catch the case where someone tries to set permissions on a sub-portion of a vmalloc_huge() area on a system that doesn't support BBML2_NOABORT. But looking again, we already refuse vmalloc_huge in change_memory_common. > > Do you think failure is actually likely and recoverable? As above, I think failure is unlikely, but not impossible. I guess the result would be memory that remains RW when it should have been set RO or RX. But I think it will all work itself out at vfree. I think. We can defer this to next cycle if you prefer. Thanks, Ryan > > Will