All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] word-at-a-time: let KASAN see load_unaligned_zeropad()
@ 2026-10-19  1:58 ` Qiliang Yuan
  0 siblings, 0 replies; 14+ messages in thread
From: Qiliang Yuan @ 2026-10-19  1:58 UTC (permalink / raw)
  To: Russell King, Catalin Marinas, Will Deacon, Mark Rutland,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Ritesh Harjani (IBM),
	Shrikanth Hegde, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Shuah Khan, Marco Elver, Andrey Ryabinin, Alexander Potapenko,
	Andrey Konovalov, Dmitry Vyukov, Vincenzo Frascino, Andrew Morton
  Cc: linux-arm-kernel, Kees Cook, linux-kernel, linux-hardening,
	linuxppc-dev, linux-riscv, linux-s390, linux-kselftest, kasan-dev,
	linux-mm, Qiliang Yuan, Peter Collingbourne

load_unaligned_zeropad() is inline assembly, so KASAN and KCSAN never
see the word loads that sized_strscpy(), the dcache name compare, path
name hashing and x86 csum_partial() do through it. While reviewing a
strscpy() KASAN fix, Peter Collingbourne suggested checking the first
byte inside load_unaligned_zeropad() itself, as read_word_at_a_time()
does [1].

Patch 1 adds that check on the six architectures that implement
load_unaligned_zeropad(). Patch 2 adds a KASAN KUnit case for it.

This is independent of the strscpy() fix, which makes sized_strscpy()
copy byte by byte under software KASAN so that every byte it reads is
checked. Either can be applied without the other.

[1] https://lore.kernel.org/r/CAPQLkRhXZwozmfhNd_PEx1ihwdH1_5qthP6PANYJ_m-v9vfQTw@mail.gmail.com

Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com>
---
Qiliang Yuan (2):
      word-at-a-time: check the first byte in load_unaligned_zeropad()
      kasan/test: cover load_unaligned_zeropad()

 arch/arm/include/asm/word-at-a-time.h              |  7 +++++++
 arch/arm64/include/asm/word-at-a-time.h            |  7 +++++++
 arch/powerpc/include/asm/word-at-a-time.h          |  6 ++++++
 arch/riscv/include/asm/word-at-a-time.h            |  6 ++++++
 arch/s390/include/asm/word-at-a-time.h             |  6 ++++++
 arch/x86/include/asm/word-at-a-time.h              |  6 ++++++
 mm/kasan/kasan_test_c.c                            | 24 ++++++++++++++++++++++
 .../powerpc/primitives/linux/kasan-checks.h        |  3 +++
 .../powerpc/primitives/linux/kcsan-checks.h        |  3 +++
 9 files changed, 68 insertions(+)
---
base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
change-id: 20261019-bug-word-at-a-time-zeropad-kasan-af2460466ee6

Best regards,
-- 
Qiliang Yuan <odys.yuan@gmail.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-10-20 17:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  1:58 [PATCH 0/2] word-at-a-time: let KASAN see load_unaligned_zeropad() Qiliang Yuan
2026-10-19  1:58 ` Qiliang Yuan
2026-10-19  1:58 ` [PATCH 1/2] word-at-a-time: check the first byte in load_unaligned_zeropad() Qiliang Yuan
2026-10-19  1:58   ` Qiliang Yuan
2026-10-19  2:06   ` sashiko-bot
2026-10-19 22:30   ` Marco Elver
2026-10-19 22:30     ` Marco Elver
2026-10-20 16:58   ` Andrey Ryabinin
2026-10-20 16:58     ` Andrey Ryabinin
2026-10-19  1:58 ` [PATCH 2/2] kasan/test: cover load_unaligned_zeropad() Qiliang Yuan
2026-10-19  1:58   ` Qiliang Yuan
2026-10-19  2:06   ` sashiko-bot
2026-10-20 17:05   ` Andrey Ryabinin
2026-10-20 17:05     ` Andrey Ryabinin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.