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 026DCCD5BDF for ; Tue, 26 May 2026 11:19:19 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J18iXujFK8xYYFlyu0HbKoG2KQuU7cNGKxURAHEC0GA=; b=ouqCNfkQHofM//qC+5apKtCyWe /38s6NMr4C2IZeezEe9kxLM6bmxHBCSIuFkKKQhc9pO6XHIUXk6bQe6d5IOeW9EQm0bzZl1gjEEzj aPlaf56+WpvGEAFi1T49OOs1b0o+sQPYh+2WlxCwSJI9q7EXT/q15J3w+GGIXp+z1hv5mAP6Nyz3f 3CFtONuJO0MHBQCuJvhEd5z22LI9qVrwqFmHmgR8SIBZWqUaU0X0tq5qhAPDzazbweAfbKMNXhheL +9Vza56LkLlNBqvoLHCj0pBcMMoAzFtQ0u1+8cytoaHu+QsZ+jnmMe7cGc1+ylmqR6xFIGZtwQEwa VFm5799w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wRpoW-00000001llm-3Cnp; Tue, 26 May 2026 11:19:12 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wRpoH-00000001lc2-3RFn for linux-arm-kernel@lists.infradead.org; Tue, 26 May 2026 11:19:01 +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 2296F169C; Tue, 26 May 2026 04:18:52 -0700 (PDT) Received: from localhost.localdomain (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5817B3F7D8; Tue, 26 May 2026 04:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1779794337; bh=XtqotHlvxdKu6c1pkEmCr60+1y0cB/ILuH7HTvPuXjw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PxqbdS+pd+qvRVofosuD4tlqbJ7HsIW/t2HCH4ya398Dgi87CJg99yt1Aq+nYBx3x tJeSVt6Z+lgZ5rznTTAG01eKmn3j08thN12Dm6pfExf+Cw28K1ncj7kiMuyRh2rlRz Vi/pS7waFfujziQjgHIDFLnl/Gys+XIOsvpJEjyk= From: Kevin Brodsky Date: Tue, 26 May 2026 12:16:12 +0100 Subject: [PATCH RFC v8 23/24] arm64: kpkeys: Enable kpkeys_hardened_pgtables support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260526-kpkeys-v8-23-eaaacdacc67c@arm.com> References: <20260526-kpkeys-v8-0-eaaacdacc67c@arm.com> In-Reply-To: <20260526-kpkeys-v8-0-eaaacdacc67c@arm.com> To: linux-hardening@vger.kernel.org Cc: Kevin Brodsky , Andrew Morton , Andy Lutomirski , Catalin Marinas , Dave Hansen , "David Hildenbrand (Arm)" , Ira Weiny , Jann Horn , Jeff Xu , Joey Gouly , Kees Cook , Linus Walleij , Marc Zyngier , Mark Brown , Matthew Wilcox , Maxwell Bland , "Mike Rapoport (IBM)" , Peter Zijlstra , Pierre Langlois , Quentin Perret , Rick Edgecombe , Ryan Roberts , Vlastimil Babka , Will Deacon , Yang Shi , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org, Lorenzo Stoakes , Thomas Gleixner X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779794212; l=1336; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=XtqotHlvxdKu6c1pkEmCr60+1y0cB/ILuH7HTvPuXjw=; b=q0ZKlig0pvkMsU5Rzr4TwUPY7q5CPoZ2WFpVnQeproPcajfAQtMhWY4OrW4f5EEK4yAYTdeAF aJZlzPdmgGTBxVIfR8IvUJ7u8XA5UlNnr2EiRJ+77v+PI5otrILrtOO X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260526_041858_058385_FB51E853 X-CRM114-Status: GOOD ( 10.93 ) 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 The kpkeys_hardened_pgtables feature needs to be initialised as soon as the buddy allocator becomes available. The canonical place to handle this is mem_init(). With that done, all the bits are in place and we can advertise support for kpkeys_hardened_pgtables by selecting ARCH_HAS_KPKEYS_HARDENED_PGTABLES if ARM64_POE is enabled. Signed-off-by: Kevin Brodsky --- arch/arm64/Kconfig | 1 + arch/arm64/mm/init.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index ab06324a50ae..43d3ab744535 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2146,6 +2146,7 @@ config ARM64_POE select ARCH_USES_HIGH_VMA_FLAGS select ARCH_HAS_PKEYS select ARCH_HAS_KPKEYS + select ARCH_HAS_KPKEYS_HARDENED_PGTABLES help The Permission Overlay Extension is used to implement Memory Protection Keys. Memory Protection Keys provides a mechanism for diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 97987f850a33..7985045875cf 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -386,6 +386,7 @@ bool page_alloc_available __ro_after_init; void __init mem_init(void) { page_alloc_available = true; + kpkeys_hardened_pgtables_init(); swiotlb_update_mem_attributes(); } -- 2.51.2