From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89A98301039 for ; Mon, 24 Nov 2025 18:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764007776; cv=none; b=WdthwqlQOI4adXlgpoi7ZhV3pGpvlfgzPMZ7II84nSdzPCBj21eUPRgQfNrmZuAEzN9Qf31p9KLJR1Sx2vIrJ6BQo9zkSWHibcIJxtDJYi30GvU9qmIE8aKGRZ2q+Pm8iiySTDsGvbpV3QQp/d6kXvAqd9BoB/iy+heaRcYFo3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764007776; c=relaxed/simple; bh=GywQ578Q4CieJYq9BC4hXf2uvv05CoVHM3Z7C5joSKs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Wq9boWJi4m+WCdb9mLTHVNfSwqc5hVdnzUx+XHzuvYeHVX/lHY7XBtgmFHEpQoZ3qnXydoJiBfB80RpVAoX33JInWFBTMxgYURliCW8YVCA2cfMvvdGogvY+xmSJklfHoUEFpAM8ZKZxvMiOvNtTqpNSokCX04p0vXrv5Y21y2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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