From: Brendan Jackman <jackmanb@google.com>
To: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Marco Elver <elver@google.com>, Ard Biesheuvel <ardb@kernel.org>
Cc: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
Brendan Jackman <jackmanb@google.com>
Subject: [PATCH 2/2] kcsan: mark !__SANITIZE_THREAD__ stub __always_inline
Date: Mon, 08 Dec 2025 01:34:59 +0000 [thread overview]
Message-ID: <20251208-gcov-inline-noinstr-v1-2-623c48ca5714@google.com> (raw)
In-Reply-To: <20251208-gcov-inline-noinstr-v1-0-623c48ca5714@google.com>
The x86 instrumented bitops in
include/asm-generic/bitops/instrumented-non-atomic.h are
KCSAN-instrumented via explicit calls to instrument_* functions from
include/linux/instrumented.h.
This bitops are used from noinstr code in __sev_es_nmi_complete(). This
code avoids noinstr violations by disabling __SANITIZE_THREAD__ 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.
(Note: the GCOV isntrumentation itself also appears to violate noinstr
in principle, but it appears to be harmless - basically just an inc
instruction).
Fix this by just applying __always_inline.
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
include/linux/kcsan-checks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/kcsan-checks.h b/include/linux/kcsan-checks.h
index 92f3843d9ebb8177432bb4eccc151ea66d3dcbb7..cabb2ae46bdc0963bd89533777cab586ab4d5a1b 100644
--- a/include/linux/kcsan-checks.h
+++ b/include/linux/kcsan-checks.h
@@ -226,7 +226,7 @@ static inline void kcsan_end_scoped_access(struct kcsan_scoped_access *sa) { }
#define __kcsan_disable_current kcsan_disable_current
#define __kcsan_enable_current kcsan_enable_current_nowarn
#else /* __SANITIZE_THREAD__ */
-static inline void kcsan_check_access(const volatile void *ptr, size_t size,
+static __always_inline void kcsan_check_access(const volatile void *ptr, size_t size,
int type) { }
static inline void __kcsan_enable_current(void) { }
static inline void __kcsan_disable_current(void) { }
--
2.50.1
next prev parent reply other threads:[~2025-12-08 1:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 1:34 [PATCH 0/2] Noinstr fixes for K[CA]SAN with GCOV Brendan Jackman
2025-12-08 1:34 ` [PATCH 1/2] kasan: mark !__SANITIZE_ADDRESS__ stubs __always_inline Brendan Jackman
2025-12-08 1:34 ` Brendan Jackman [this message]
2025-12-08 9:37 ` [PATCH 0/2] Noinstr fixes for K[CA]SAN with GCOV Marco Elver
2025-12-08 11:12 ` Marco Elver
2025-12-09 0:05 ` Brendan Jackman
2025-12-09 0:52 ` Marco Elver
2025-12-09 2:25 ` Brendan Jackman
2025-12-12 16:11 ` Marco Elver
2025-12-12 23:59 ` Ard Biesheuvel
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=20251208-gcov-inline-noinstr-v1-2-623c48ca5714@google.com \
--to=jackmanb@google.com \
--cc=andreyknvl@gmail.com \
--cc=ardb@kernel.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=vincenzo.frascino@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).