summaryrefslogtreecommitdiff
path: root/arch/riscv/mm/Makefile
diff options
context:
space:
mode:
authorNick Hu <nickhu@andestech.com>2020-01-06 21:38:32 +0300
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-01-23 00:09:58 +0300
commit8ad8b72721d0f07fa02dbe71f901743f9c71c8e6 (patch)
treef7e4dfb5c72ced986c1183e9d0c830de608ea2fc /arch/riscv/mm/Makefile
parent57ee58e39321ab4ac3f2949b90117786726cb216 (diff)
downloadlinux-8ad8b72721d0f07fa02dbe71f901743f9c71c8e6.tar.xz
riscv: Add KASAN support
This patch ports the feature Kernel Address SANitizer (KASAN). Note: The start address of shadow memory is at the beginning of kernel space, which is 2^64 - (2^39 / 2) in SV39. The size of the kernel space is 2^38 bytes so the size of shadow memory should be 2^38 / 8. Thus, the shadow memory would not overlap with the fixmap area. There are currently two limitations in this port, 1. RV64 only: KASAN need large address space for extra shadow memory region. 2. KASAN can't debug the modules since the modules are allocated in VMALLOC area. We mapped the shadow memory, which corresponding to VMALLOC area, to the kasan_early_shadow_page because we don't have enough physical space for all the shadow memory corresponding to VMALLOC area. Signed-off-by: Nick Hu <nickhu@andestech.com> Reported-by: Greentime Hu <green.hu@gmail.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/mm/Makefile')
-rw-r--r--arch/riscv/mm/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
index a1bd95c8047a..670de7c1fd25 100644
--- a/arch/riscv/mm/Makefile
+++ b/arch/riscv/mm/Makefile
@@ -15,3 +15,9 @@ ifeq ($(CONFIG_MMU),y)
obj-$(CONFIG_SMP) += tlbflush.o
endif
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
+obj-$(CONFIG_KASAN) += kasan_init.o
+
+ifdef CONFIG_KASAN
+KASAN_SANITIZE_kasan_init.o := n
+KASAN_SANITIZE_init.o := n
+endif