diff mbox series

[v2,2/3] arm64: mm: Only map KPTI trampoline if it is going to be used

Message ID 20231127120049.2258650-7-ardb@google.com (mailing list archive)
State New, archived
Headers show
Series arm64 kpti fixes | expand

Commit Message

Ard Biesheuvel Nov. 27, 2023, noon UTC
From: Ard Biesheuvel <ardb@kernel.org>

Avoid creating the fixmap entries for the KPTI trampoline if KPTI is not
in use.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm64/mm/mmu.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 15f6347d23b6..6c8078916f5e 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -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);