Skip to content

Commit 12bb395

Browse files
Linus WalleijSasha Levin
authored andcommitted
ARM: 9430/1: entry: Do a dummy read from VMAP shadow
commit 44e9a3b upstream. When switching task, in addition to a dummy read from the new VMAP stack, also do a dummy read from the VMAP stack's corresponding KASAN shadow memory to sync things up in the new MM context. Cc: [email protected] Fixes: a1c510d ("ARM: implement support for vmap'ed stacks") Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/ Reported-by: Clement LE GOFFIC <[email protected]> Suggested-by: Ard Biesheuvel <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8ff533a commit 12bb395

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/arm/kernel/entry-armv.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <asm/tls.h>
2626
#include <asm/system_info.h>
2727
#include <asm/uaccess-asm.h>
28+
#include <asm/kasan_def.h>
2829

2930
#include "entry-header.S"
3031
#include <asm/probes.h>
@@ -787,6 +788,13 @@ ENTRY(__switch_to)
787788
@ entries covering the vmalloc region.
788789
@
789790
ldr r2, [ip]
791+
#ifdef CONFIG_KASAN_VMALLOC
792+
@ Also dummy read from the KASAN shadow memory for the new stack if we
793+
@ are using KASAN
794+
mov_l r2, KASAN_SHADOW_OFFSET
795+
add r2, r2, ip, lsr #KASAN_SHADOW_SCALE_SHIFT
796+
ldr r2, [r2]
797+
#endif
790798
#endif
791799

792800
@ When CONFIG_THREAD_INFO_IN_TASK=n, the update of SP itself is what

0 commit comments

Comments
 (0)