summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/lib
diff options
context:
space:
mode:
authorMax Filippov2017-12-03 22:28:52 +0100
committerMax Filippov2017-12-17 07:37:12 +0100
commitc633544a6154146a210cf158157a1ae7c55473b6 (patch)
treed670a9984373622d991c382126f341b6f32154cd /arch/xtensa/lib
parentxtensa: move fixmap and kmap just above the KSEG (diff)
downloadkernel-qcow2-linux-c633544a6154146a210cf158157a1ae7c55473b6.tar.gz
kernel-qcow2-linux-c633544a6154146a210cf158157a1ae7c55473b6.tar.xz
kernel-qcow2-linux-c633544a6154146a210cf158157a1ae7c55473b6.zip
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/lib')
-rw-r--r--arch/xtensa/lib/memcopy.S10
-rw-r--r--arch/xtensa/lib/memset.S5
2 files changed, 9 insertions, 6 deletions
diff --git a/arch/xtensa/lib/memcopy.S b/arch/xtensa/lib/memcopy.S
index 24d650864c3a..c0f6981719d6 100644
--- a/arch/xtensa/lib/memcopy.S
+++ b/arch/xtensa/lib/memcopy.S
@@ -109,7 +109,8 @@
addi a5, a5, 2
j .Ldstaligned # dst is now aligned, return to main algorithm
-ENTRY(memcpy)
+ENTRY(__memcpy)
+WEAK(memcpy)
entry sp, 16 # minimal stack frame
# a2/ dst, a3/ src, a4/ len
@@ -271,7 +272,7 @@ ENTRY(memcpy)
s8i a6, a5, 0
retw
-ENDPROC(memcpy)
+ENDPROC(__memcpy)
/*
* void bcopy(const void *src, void *dest, size_t n);
@@ -376,7 +377,8 @@ ENDPROC(bcopy)
j .Lbackdstaligned # dst is now aligned,
# return to main algorithm
-ENTRY(memmove)
+ENTRY(__memmove)
+WEAK(memmove)
entry sp, 16 # minimal stack frame
# a2/ dst, a3/ src, a4/ len
@@ -548,4 +550,4 @@ ENTRY(memmove)
s8i a6, a5, 0
retw
-ENDPROC(memmove)
+ENDPROC(__memmove)
diff --git a/arch/xtensa/lib/memset.S b/arch/xtensa/lib/memset.S
index a6cd04ba966f..276747dec300 100644
--- a/arch/xtensa/lib/memset.S
+++ b/arch/xtensa/lib/memset.S
@@ -31,7 +31,8 @@
*/
.text
-ENTRY(memset)
+ENTRY(__memset)
+WEAK(memset)
entry sp, 16 # minimal stack frame
# a2/ dst, a3/ c, a4/ length
@@ -140,7 +141,7 @@ EX(10f) s8i a3, a5, 0
.Lbytesetdone:
retw
-ENDPROC(memset)
+ENDPROC(__memset)
.section .fixup, "ax"
.align 4