aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/mm/init.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2017-12-03 16:28:52 -0500
committerMax Filippov <jcmvbkbc@gmail.com>2017-12-17 01:37:12 -0500
commitc633544a6154146a210cf158157a1ae7c55473b6 (patch)
treed670a9984373622d991c382126f341b6f32154cd /arch/xtensa/mm/init.c
parent1af1e8a39dc0fab5e50f10462c636da8c1e0cfbb (diff)
xtensa: add support for KASAN
Cover kernel addresses above 0x90000000 by the shadow map. Enable HAVE_ARCH_KASAN when MMU is enabled. Provide kasan_early_init that fills shadow map with writable copies of kasan_zero_page. Call kasan_early_init right after mmu initialization in the setup_arch. Provide kasan_init that allocates proper shadow map pages from the memblock and puts these pages into the shadow map for addresses from VMALLOC area to the end of KSEG. Call kasan_init right after memblock initialization. Don't use KASAN for the boot code, MMU and KASAN initialization and page fault handler. Make kernel stack size 4 times larger when KASAN is enabled to avoid stack overflows. GCC 7.3, 8 or newer is required to build the xtensa kernel with KASAN. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/mm/init.c')
-rw-r--r--arch/xtensa/mm/init.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 6fc1cb093fb3..0d980f05da82 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -100,6 +100,9 @@ void __init mem_init(void)
100 100
101 mem_init_print_info(NULL); 101 mem_init_print_info(NULL);
102 pr_info("virtual kernel memory layout:\n" 102 pr_info("virtual kernel memory layout:\n"
103#ifdef CONFIG_KASAN
104 " kasan : 0x%08lx - 0x%08lx (%5lu MB)\n"
105#endif
103#ifdef CONFIG_MMU 106#ifdef CONFIG_MMU
104 " vmalloc : 0x%08lx - 0x%08lx (%5lu MB)\n" 107 " vmalloc : 0x%08lx - 0x%08lx (%5lu MB)\n"
105#endif 108#endif
@@ -108,6 +111,10 @@ void __init mem_init(void)
108 " fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n" 111 " fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
109#endif 112#endif
110 " lowmem : 0x%08lx - 0x%08lx (%5lu MB)\n", 113 " lowmem : 0x%08lx - 0x%08lx (%5lu MB)\n",
114#ifdef CONFIG_KASAN
115 KASAN_SHADOW_START, KASAN_SHADOW_START + KASAN_SHADOW_SIZE,
116 KASAN_SHADOW_SIZE >> 20,
117#endif
111#ifdef CONFIG_MMU 118#ifdef CONFIG_MMU
112 VMALLOC_START, VMALLOC_END, 119 VMALLOC_START, VMALLOC_END,
113 (VMALLOC_END - VMALLOC_START) >> 20, 120 (VMALLOC_END - VMALLOC_START) >> 20,