[PATCH 2/2] ARM: kasan: Fix compatibility with ARM_MODULE_PLTS

From: Alexander A Sverdlin
Date: Fri May 06 2022 - 02:01:34 EST


From: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>

Select KASAN_VMALLOC if KASAN && ARM_MODULE_PLT. Otherwise module load into
vmalloc area crashes the kernel:

Unable to handle kernel paging request at virtual address bce42b5c
CPU: 1 PID: 454 Comm: systemd-udevd
PC is at mmioset+0x7e/0xa0
LR is at kasan_unpoison_shadow+0x1b/0x24
Stack:
(mmioset) from (kasan_unpoison_shadow+0x1b/0x24)
(kasan_unpoison_shadow) from (__asan_register_globals+0x27/0x4c)
(__asan_register_globals) from (do_init_module+0x13d/0x5b8)
(do_init_module) from (load_module+0x6733/0x80f8)
(load_module) from (sys_finit_module+0x119/0x140)
(sys_finit_module) from (ret_fast_syscall+0x1/0x5a)

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
---
arch/arm/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f440cf5..d9d60a3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1519,6 +1519,7 @@ config HW_PERF_EVENTS
config ARM_MODULE_PLTS
bool "Use PLTs to allow module memory to spill over into vmalloc area"
depends on MODULES
+ select KASAN_VMALLOC if KASAN
default y
help
Allocate PLTs when loading modules so that jumps and calls whose
--
2.10.2