* + kasan-mark-__sanitize_address__-stubs-__always_inline.patch added to mm-new branch
@ 2025-12-15 18:00 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-12-15 18:00 UTC (permalink / raw)
To: mm-commits, vincenzo.frascino, ryabinin.a.a, keescook, glider,
elver, dvyukov, ardb, andreyknvl, jackmanb, akpm
The patch titled
Subject: kasan: mark !__SANITIZE_ADDRESS__ stubs __always_inline
has been added to the -mm mm-new branch. Its filename is
kasan-mark-__sanitize_address__-stubs-__always_inline.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kasan-mark-__sanitize_address__-stubs-__always_inline.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Brendan Jackman <jackmanb@google.com>
Subject: kasan: mark !__SANITIZE_ADDRESS__ stubs __always_inline
Date: Mon, 15 Dec 2025 10:12:39 +0000
Patch series "Noinstr fixes for K[CA]SAN with GCOV", v2.
- clang --version
Debian clang version 19.1.7 (3+build5)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
- Kernel config:
https://gist.githubusercontent.com/bjackman/bbfdf4ec2e1dfd0e18657174f053=
7e2c/raw/a88dcc6567d14c69445e7928a7d5dfc23ca9f619/gistfile0.txt
Note I also get this error:
vmlinux.o: warning: objtool: set_ftrace_ops_ro+0x3b: relocation to !ENDBR: =
machine_kexec_prepare+0x810
That one's a total mystery to me. I guess it's better to "fix" the SEV
one independently rather than waiting until I know how to fix them both.
Note I also mentioned other similar errors in [0]. Those errors don't
exist in Linus' master and I didn't note down where I saw them. Either
they have since been fixed, or I observed them in Google's internal
codebase where they were instroduced downstream.
As discussed in [2], the GCOV+*SAN issue is attacked from two angles:
both adding __always_inline to the instrumentation helpers AND disabling
GCOV for noinstr.c. Only one or the other of these things is needed to
make the build error go away, but they both make sense in their own
right and both may serve to prevent other similar errors from cropping
up in future.
This patch (of 3):
The x86 instrumented bitops in
include/asm-generic/bitops/instrumented-non-atomic.h are
KASAN-instrumented via explicit calls to instrument_* functions from
include/linux/instrumented.h.
These bitops are used from noinstr code in __sev_es_nmi_complete(). This
code avoids noinstr violations by disabling __SANITIZE_ADDRESS__ etc for
the compilation unit.
However, when GCOV is enabled, there can still be violations caused by the
stub versions of these functions, since coverage instrumentation is
injected that causes them to be out-of-lined.
Fix this by just applying __always_inline.
Link: https://lkml.kernel.org/r/20251215-gcov-inline-noinstr-v2-1-6f100b94fa99@google.com
Link: https://lore.kernel.org/all/DERNCQGNRITE.139O331ACPKZ9@google.com/ [1]
Link: https://lore.kernel.org/all/20251117-b4-sev-gcov-objtool-v1-1-54f7790d54df@google.com/ [2]
Link: https://lore.kernel.org/r/20251208-gcov-inline-noinstr-v1-0-623c48ca5714@google.com [3]
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Acked-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kasan-checks.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/include/linux/kasan-checks.h~kasan-mark-__sanitize_address__-stubs-__always_inline
+++ a/include/linux/kasan-checks.h
@@ -37,11 +37,11 @@ static inline bool __kasan_check_write(c
#define kasan_check_read __kasan_check_read
#define kasan_check_write __kasan_check_write
#else
-static inline bool kasan_check_read(const volatile void *p, unsigned int size)
+static __always_inline bool kasan_check_read(const volatile void *p, unsigned int size)
{
return true;
}
-static inline bool kasan_check_write(const volatile void *p, unsigned int size)
+static __always_inline bool kasan_check_write(const volatile void *p, unsigned int size)
{
return true;
}
_
Patches currently in -mm which might be from jackmanb@google.com are
mm-vmalloc-clarify-why-vmap_range_noflush-might-sleep.patch
kasan-mark-__sanitize_address__-stubs-__always_inline.patch
kcsan-mark-__sanitize_thread__-stub-__always_inline.patch
x86-sev-disable-gcov-on-noinstr-object.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-15 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 18:00 + kasan-mark-__sanitize_address__-stubs-__always_inline.patch added to mm-new branch Andrew Morton
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.