xtensa: add support for KASAN
authorMax Filippov <jcmvbkbc@gmail.com>
Sun, 3 Dec 2017 21:28:52 +0000 (13:28 -0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Sun, 17 Dec 2017 06:37:12 +0000 (22:37 -0800)
commitc633544a6154146a210cf158157a1ae7c55473b6
treed670a9984373622d991c382126f341b6f32154cd
parent1af1e8a39dc0fab5e50f10462c636da8c1e0cfbb
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>
15 files changed:
Documentation/features/debug/KASAN/arch-support.txt
Documentation/xtensa/mmu.txt
arch/xtensa/Kconfig
arch/xtensa/boot/lib/Makefile
arch/xtensa/include/asm/kasan.h [new file with mode: 0644]
arch/xtensa/include/asm/kmem_layout.h
arch/xtensa/include/asm/pgtable.h
arch/xtensa/include/asm/string.h
arch/xtensa/kernel/setup.c
arch/xtensa/kernel/xtensa_ksyms.c
arch/xtensa/lib/memcopy.S
arch/xtensa/lib/memset.S
arch/xtensa/mm/Makefile
arch/xtensa/mm/init.c
arch/xtensa/mm/kasan_init.c [new file with mode: 0644]