]> exis.tech > repos - linux.git/commit
ARM: 9474/1: io: avoid KASAN instrumentation of raw halfword I/O
authorKarl Mehltretter <kmehltretter@gmail.com>
Sun, 24 May 2026 05:52:36 +0000 (06:52 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 11 Jun 2026 13:52:00 +0000 (14:52 +0100)
commitd59ed803715a71fb9582e139d648ece8d66dc743
tree2459a5d66d333bcbe24441af8ca49f7c28f87784
parent254f49634ee16a731174d2ae34bc50bd5f45e731
ARM: 9474/1: io: avoid KASAN instrumentation of raw halfword I/O

For CPUs before ARMv6, __raw_readw() and __raw_writew() are implemented
as C volatile halfword accesses so the compiler can generate an access
sequence that is safe for those machines. With KASAN enabled, those C
accesses are instrumented as normal memory accesses.

That is not valid for MMIO. On ARM926/VersatilePB with KASAN enabled,
PL011 probing traps in __asan_store2() while registering the UART, because
the instrumented writew() tries to check KASAN shadow for an MMIO address.

Keep the existing volatile halfword access, but move the ARMv5 definitions
into __no_kasan_or_inline functions so raw MMIO halfword accesses are not
instrumented by KASAN. The ARMv6-and-newer inline assembly path is
unchanged.

Fixes: 421015713b30 ("ARM: 9017/2: Enable KASan for ARM")
Cc: stable@vger.kernel.org # v5.11+
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/include/asm/io.h