diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2024-03-01 11:40:49 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2024-03-01 15:25:45 +0000 |
commit | 27f2b9fcddc76d542ac339febf2af55b67f610ca (patch) | |
tree | 83953c1630499dc1ebb3071877a5d9d151db37ea /arch/arm64/mm/mmu.c | |
parent | 3137db4c66bf70360ee7027af5c50662b3152046 (diff) | |
download | linux-27f2b9fcddc76d542ac339febf2af55b67f610ca.tar.gz linux-27f2b9fcddc76d542ac339febf2af55b67f610ca.tar.bz2 linux-27f2b9fcddc76d542ac339febf2af55b67f610ca.zip |
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>
Diffstat (limited to 'arch/arm64/mm/mmu.c')
-rw-r--r-- | arch/arm64/mm/mmu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index b131ed31a6c8..bf5b1c426ad0 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -777,7 +777,7 @@ static void __init create_idmap(void) IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false, __phys_to_virt(ptep) - ptep); - if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0)) { + if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0) && !arm64_use_ng_mappings) { extern u32 __idmap_kpti_flag; u64 pa = __pa_symbol(&__idmap_kpti_flag); |