arm64: add PTE_UXN/PTE_WRITE to SWAPPER_*_FLAGS
authorJoey Gouly <joey.gouly@arm.com>
Tue, 6 Jun 2023 14:58:50 +0000 (15:58 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 6 Jun 2023 15:52:41 +0000 (16:52 +0100)
commitf0af339fc408a55c9f48f5d9ca47059ef1eb36b8
treef71ee516598e602503bfcfea30789697cfdbcbca
parent8ef67c67e637809a28f0efeb045aa454c7799a51
arm64: add PTE_UXN/PTE_WRITE to SWAPPER_*_FLAGS

With PIE enabled, the swapper PTEs would have a Permission Indirection Index
(PIIndex) of 0. A PIIndex of 0 is not currently used by any other PTEs.

To avoid using index 0 specifically for the swapper PTEs, mark them as
PTE_UXN and PTE_WRITE, so that they map to a PAGE_KERNEL_EXEC equivalent.

This also adds PTE_WRITE to KPTI_NG_PTE_FLAGS, which was tested by booting
with kpti=on.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20230606145859.697944-12-joey.gouly@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/kernel-pgtable.h
arch/arm64/kernel/head.S
arch/arm64/mm/proc.S