From: Bill Wendling <morbo@google.com>
To: linux-kernel@vger.kernel.org
Cc: Bill Wendling <morbo@google.com>
Subject: [PATCH 0/7] kasan: Add KUnit config and fix missing instrumentation in load_unaligned_zeropad()
Date: Fri, 11 Sep 2026 07:03:38 +0000 [thread overview]
Message-ID: <20260911070346.801948-1-morbo@google.com> (raw)
This series makes the KASAN KUnit test suite easy to run via kunit.py
and fixes a real detection gap it uncovered along the way.
Patch 1 adds mm/kasan/.kunitconfig so the suite can be run with:
./tools/testing/kunit/kunit.py run --arch=x86_64 --kunitconfig mm/kasan
Getting CONFIG_KASAN_KUNIT_TEST to actually build required pulling in
CONFIG_SCHED_TRACER (CONFIG_FTRACE alone doesn't select the invisible
TRACEPOINTS symbol it depends on), plus a larger CONFIG_LOG_BUF_SHIFT
to stop KASAN's verbose reports from overflowing the printk buffer
under QEMU.
The migration from read_word_at_a_time() to load_unaligned_zeropad() lost
instrumentation, because the load_unaligned_zeropad() functions are
implemented as inline asm with an exception table entry on every
architecture, so the compiler never sees the memory access and can't
instrument it for KASAN/KCSAN. This meant sized_strscpy() silently
bypassed KASAN when reading its source buffer word-at-a-time, and the
same gap turned out to be open at every other call site in the tree.
Rather than patching each call site individually, patch 2 renames
x86's load_unaligned_zeropad() to arch_load_unaligned_zeropad() and
adds a single common, always-inlined wrapper that instruments the read
before calling through.
Patches 3-7 convert the remaining architectures (arm64, arm, riscv,
s390, powerpc) that implement load_unaligned_zeropad() to the same
pattern, so each can be reviewed independently by its arch maintainer.
Verified via objdump that the wrapper adds no calls or relocations
when KASAN and KCSAN are both disabled.
Bill Wendling (7):
kasan: Add .kunitconfig for KUnit tests
x86/word-at-a-time: Instrument load_unaligned_zeropad()
arm64/word-at-a-time: Instrument load_unaligned_zeropad()
arm/word-at-a-time: Instrument load_unaligned_zeropad()
riscv/word-at-a-time: Instrument load_unaligned_zeropad()
s390/word-at-a-time: Instrument load_unaligned_zeropad()
powerpc/word-at-a-time: Instrument load_unaligned_zeropad()
arch/arm/include/asm/word-at-a-time.h | 4 ++-
arch/arm64/include/asm/word-at-a-time.h | 4 ++-
arch/powerpc/include/asm/word-at-a-time.h | 4 ++-
arch/riscv/include/asm/word-at-a-time.h | 4 ++-
arch/s390/include/asm/word-at-a-time.h | 4 ++-
arch/x86/include/asm/word-at-a-time.h | 4 ++-
.../asm-generic/word-at-a-time-instrumented.h | 25 +++++++++++++++++++
mm/kasan/.kunitconfig | 15 +++++++++++
8 files changed, 58 insertions(+), 6 deletions(-)
create mode 100644 include/asm-generic/word-at-a-time-instrumented.h
create mode 100644 mm/kasan/.kunitconfig
--
2.47.3
next reply other threads:[~2026-09-11 7:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 7:03 Bill Wendling [this message]
2026-09-11 7:03 ` [PATCH 1/7] kasan: Add .kunitconfig for KUnit tests Bill Wendling
2026-09-11 7:03 ` [PATCH 2/7] x86/word-at-a-time: Instrument load_unaligned_zeropad() Bill Wendling
2026-09-11 7:03 ` [PATCH 3/7] arm64/word-at-a-time: " Bill Wendling
2026-09-11 7:03 ` [PATCH 4/7] arm/word-at-a-time: " Bill Wendling
2026-09-11 7:03 ` [PATCH 5/7] riscv/word-at-a-time: " Bill Wendling
2026-09-11 7:03 ` [PATCH 6/7] s390/word-at-a-time: " Bill Wendling
2026-09-11 7:03 ` [PATCH 7/7] powerpc/word-at-a-time: " Bill Wendling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260911070346.801948-1-morbo@google.com \
--to=morbo@google.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®