Skip to contentSkip to conversation

ARM: mmu: fix access to illegal address when using earlycon & memblock=debug

PATCH RESEND New Victor Hassan 1 participant 1 message Mar 29, 2022 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ARM: mmu: fix access to illegal address when using earlycon & memblock=debug

earlycon uses fixmap to create a memory map,
So we need to close earlycon before closing fixmap, otherwise printk will access illegal addresses. After creating a new memory map, we open earlycon again.

---
 arch/arm/mm/mmu.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mm/mmu.c +7 -0
index 5e2be37a198e..9b8baa222034 100644
@@ -14,6 +14,7 @@
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
 #include <linux/sizes.h>
+#include <linux/console.h>
 
 #include <asm/cp15.h>
 #include <asm/cputype.h>
@@ -1697,6 +1698,9 @@ static void __init early_fixmap_shutdown(void)
 	pmd_clear(fixmap_pmd(va));
 	local_flush_tlb_kernel_page(va);
 
+#ifdef CONFIG_FIX_EARLYCON_MEM
+	console_stop(console_drivers);
+#endif
 	for (i = 0; i < __end_of_permanent_fixed_addresses; i++) {
 		pte_t *pte;
 		struct map_desc map;
@@ -1715,6 +1719,9 @@ static void __init early_fixmap_shutdown(void)
 
 		create_mapping(&map);
 	}
+#ifdef CONFIG_FIX_EARLYCON_MEM
+	console_start(console_drivers);
+#endif
 }
 
 /*
Signature · 1 line
2.29.0