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 BA3253C5838 for ; Tue, 26 May 2026 11:17:13 +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=1779794235; cv=none; b=ceEbb9EFiPl5ZyNCtA75QKBFFrdH1f8d1VoyxTPTCG7JnrgDuKPn2NndOGaiRCaRo1MbY8vTiFFtOdSfn7GksJjFSRAs0vBzdBVEiMio2IyxLYd2yfAXqUoivY1Ekj+Xj6CX7lkvMyHn1K/dWU+oo/0r6Kh//g4byv7415/0nuk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779794235; c=relaxed/simple; bh=FtfnjjJofbi5jV3NeDm06k45kac8Me0VolOHCeDZ/oE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qn13YK1iy0UnzdjgZYqrBwWQrET13RNjPikvHVj2LB/C1odRA+iuBsE6++k5wMYLemiGh4OkbtBiWelh7nEIjkxu2WwVi05P5HLvzNRJTSZ1Zv1adRVNkOge9Sz+vIoC+VJwSx296FRWdd6JpDQz/u4btu97hELvbnGRoV6Q6d0= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=Fdl2Eoy8; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="Fdl2Eoy8" 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 24EFF16F2; Tue, 26 May 2026 04:17:08 -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 57D823F86F; Tue, 26 May 2026 04:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1779794233; bh=FtfnjjJofbi5jV3NeDm06k45kac8Me0VolOHCeDZ/oE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Fdl2Eoy8k1/opWjMUNyR4T9mLnSOb/00vt8zuuvYmw7/HnMpRTL4fos9jehKqWnvv qoAqlupxoj+/LgpxLplSATnbUc7A321zcNGBvJGhGKKfNVqp290bWX6WWJkobdITis 0nIN9IYODP64D9UCCWQCSD+ZDUrG1/4+Tf07Bn/M= From: Kevin Brodsky Date: Tue, 26 May 2026 12:15:52 +0100 Subject: [PATCH RFC v8 03/24] arm64: mm: Enable overlays for all EL1 indirect permissions Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260526-kpkeys-v8-3-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=1779794211; l=1693; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=FtfnjjJofbi5jV3NeDm06k45kac8Me0VolOHCeDZ/oE=; b=qiEAw0NX1rX59s1vp2G26mnEMdUSA0T+/ZagKERunC5YmnGlfyESa6qGhCObFq6crvPRt0tZL xvWgPX4W5gaDO3mV932PN36adecv/yfBeKMsGsmjpDUGJf5wE2TVoOG X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= In preparation of using POE inside the kernel, enable "Overlay applied" for kernel memory types in PIR_EL1. This ensures that the permissions set in POR_EL1 affect all kernel mappings. User memory types must be left untouched (overlays not applied) because any privileged access to user memory (e.g. futex atomic without FEAT_LSUI) would then be mistakenly checked against POR_EL1. Signed-off-by: Kevin Brodsky --- arch/arm64/include/asm/pgtable-prot.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h index 212ce1b02e15..d4d45ab86a5a 100644 --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -183,9 +183,9 @@ static inline bool __pure lpa2_is_enabled(void) PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_SHARED_EXEC), PIE_RW) | \ PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_READONLY), PIE_R) | \ PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_SHARED), PIE_RW) | \ - PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_ROX), PIE_RX) | \ - PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_EXEC), PIE_RWX) | \ - PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_RO), PIE_R) | \ - PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL), PIE_RW)) + PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_ROX), PIE_RX_O) | \ + PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_EXEC), PIE_RWX_O) | \ + PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL_RO), PIE_R_O) | \ + PIRx_ELx_PERM_PREP(pte_pi_index(_PAGE_KERNEL), PIE_RW_O)) #endif /* __ASM_PGTABLE_PROT_H */ -- 2.51.2