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 2BBFBCD3439 for ; Tue, 5 May 2026 16:09:01 +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=itQRma8rRut2qL8k37mDoAtSyj CiVlTSFO8EOfnCyfrgHiI9pPI+zZv0Y1vxkv24To8j29l9XDzBd/7gd60vX8Pxb9rVysixU1yfMax SkR18cGvvM0YgK6TGltF5CCdFhgO8xX3nbeENFEcYOXMVloZeHMom8mmpMb4szf5+9knFm1ax/IMe +xj50PY5UeeUntjRHHegfGcoMENT9loBsFqS1iZMisFSnxz1dcTVTF3udDydXrLrlAX9CD3iNT4nr VJbIRHsZAzug6uBOvaqLEDZFcVwqdpX18aY/mg7pFVbZDqV7opoZbqaw8EQtZCm5PEY4Zryv5c0+f 95NQHuKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wKIKP-0000000GoXE-0xG1; Tue, 05 May 2026 16:08:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wKIKM-0000000GoSy-2jdJ for linux-arm-kernel@bombadil.infradead.org; Tue, 05 May 2026 16:08:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=J18iXujFK8xYYFlyu0HbKoG2KQuU7cNGKxURAHEC0GA=; b=GJMhp2z+OrKvVDnXyhm0D/FlA8 r1lmRDlz6CwCQn0RzgCQ5J1ESQkqnVEhWBmz+Rxs+hq+o6a9HjpZbx/aTcjvyY61KrNERNUl0u/Zg /D1uM6nyex3jtyfWLm0eVmpwFZ+FJ+Ahbz9x6GAe0DxQbMi11XDAJlagRUsQ0P49ZgEnFrQCjweL7 9qTwkmlHAzUKj4b5pwk7VpqIMOP+UtfkYLexFcYeZop9iJsOHdksaU9Iwdwn8jgcDgqifX/VP0YDM we0K3IiS6jcMn2pl9/LancgebXDP1QvezmKXdysvByUGm2LNhprvT6pAB40Iw7SLQyERE2TazjHV8 rtlqEDMQ==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wKIKG-0000000DzKe-44my for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2026 16:08:53 +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 E98B114BF; Tue, 5 May 2026 09:08:41 -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 2E6213F763; Tue, 5 May 2026 09:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1777997327; bh=XtqotHlvxdKu6c1pkEmCr60+1y0cB/ILuH7HTvPuXjw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=luXYCNazICc3tK6Lo75rwne6t5UDBAIT/GSy+kZtqZUQSSE+SVirz/40QTelJkaZH JkYWQ7dTpIHd4QSAHQkyPD4tmU4aSFtVOzU4Qw9hg5SZ3yxDqLMi12/J4NzwvaWuli Q50N8srUXZ+PY0p0gwMmTpE+ZFjErQD3dNlgJVHg= From: Kevin Brodsky Date: Tue, 05 May 2026 17:06:12 +0100 Subject: [PATCH RFC v7 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: <20260505-kpkeys-v7-23-20c0bdd97197@arm.com> References: <20260505-kpkeys-v7-0-20c0bdd97197@arm.com> In-Reply-To: <20260505-kpkeys-v7-0-20c0bdd97197@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 , Will Deacon , Yang Shi , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org, Lorenzo Stoakes , Thomas Gleixner , Vlastimil Babka X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777997220; l=1336; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=XtqotHlvxdKu6c1pkEmCr60+1y0cB/ILuH7HTvPuXjw=; b=K2Hh5ueB1qxUS4zdYcT6VsETD5dVbzMYDFrOcezoE2+rc8YHsqgE1mD0JpP0LvBzLWt4INwPH FdSpumdToMxA5c8hwuqM1w/44U4enD9R0cEYEWjqIAXB1BF6Z84tYVy X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260505_170849_295195_07415B32 X-CRM114-Status: GOOD ( 11.24 ) 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