]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ARM: 9475/1: entry: use byte load for KASAN VMAP stack shadow
authorKarl Mehltretter <kmehltretter@gmail.com>
Sun, 24 May 2026 05:52:35 +0000 (06:52 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 11 Jun 2026 13:52:01 +0000 (14:52 +0100)
Commit 44e9a3bb76e5 ("ARM: 9430/1: entry: Do a dummy read from
VMAP shadow") added a dummy read from the KASAN VMAP stack shadow in
__switch_to(). The read uses ldr, but the KASAN shadow address is
byte-granular and is not guaranteed to be word aligned.

ARMv5 faults unaligned word loads. With CONFIG_KASAN_VMALLOC and
CONFIG_VMAP_STACK enabled, ARM926/VersatilePB crashes in __switch_to()
with an alignment exception before reaching init.

Use ldrb for the dummy shadow access. The code only needs to fault in the
shadow mapping if the stack shadow is missing, so a byte load is sufficient
and matches the granularity of KASAN shadow memory.

Fixes: 44e9a3bb76e5 ("ARM: 9430/1: entry: Do a dummy read from VMAP shadow")
Cc: stable@vger.kernel.org # v6.13+
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/entry-armv.S

index ef6a657c8d130663e68acd07226815ce8a3fff7d..a3d050ce9b793b0bb9f5958f3a35a3bab87bb480 100644 (file)
@@ -567,7 +567,7 @@ ENTRY(__switch_to)
        @ are using KASAN
        mov_l   r2, KASAN_SHADOW_OFFSET
        add     r2, r2, ip, lsr #KASAN_SHADOW_SCALE_SHIFT
-       ldr     r2, [r2]
+       ldrb    r2, [r2]
 #endif
 #endif