arm64: mm: Only map KPTI trampoline if it is going to be used
authorArd Biesheuvel <ardb@kernel.org>
Mon, 27 Nov 2023 12:00:52 +0000 (13:00 +0100)
committerWill Deacon <will@kernel.org>
Mon, 11 Dec 2023 11:40:38 +0000 (11:40 +0000)
Avoid creating the fixmap entries for the KPTI trampoline if KPTI is not
in use.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20231127120049.2258650-7-ardb@google.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/mm/mmu.c

index 15f6347d23b69063b7628e45821a52ebaf9f72f7..6c8078916f5e66907cb230b6e560a9d943df17da 100644 (file)
@@ -674,6 +674,9 @@ static int __init map_entry_trampoline(void)
 {
        int i;
 
+       if (!arm64_kernel_unmapped_at_el0())
+               return 0;
+
        pgprot_t prot = kernel_exec_prot();
        phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start);