Skip to content

Commit 27f2b9f

Browse files
ardbiesheuvelctmarinas
authored andcommitted
arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed
arm64_use_ng_mappings will be set to 'true' by the early boot code if it decides to use non-global (nG) attributes for all kernel mappings, typically when enabling KASLR on a system that does not implement E0PD. In this case, the G-to-nG update routines are never called, and so there is no reason to create the writable mapping of the associated status flag in the ID map. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20240301104046.1234309-6-ardb+git@google.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 3137db4 commit 27f2b9f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ static void __init create_idmap(void)
777777
IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,
778778
__phys_to_virt(ptep) - ptep);
779779

780-
if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0)) {
780+
if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0) && !arm64_use_ng_mappings) {
781781
extern u32 __idmap_kpti_flag;
782782
u64 pa = __pa_symbol(&__idmap_kpti_flag);
783783

0 commit comments

Comments
 (0)