* [PATCH 0/3] KCSAN cleanups and noinstr
@ 2020-06-02 17:31 Peter Zijlstra
2020-06-02 17:31 ` [PATCH 1/3] x86, kcsan: Remove __no_kcsan_or_inline usage Peter Zijlstra
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Peter Zijlstra @ 2020-06-02 17:31 UTC (permalink / raw)
To: tglx; +Cc: x86, elver, paulmck, kasan-dev, linux-kernel, peterz
Hi all,
Here's two KCSAN cleanups and the required noinstr change for x86.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] x86, kcsan: Remove __no_kcsan_or_inline usage
2020-06-02 17:31 [PATCH 0/3] KCSAN cleanups and noinstr Peter Zijlstra
@ 2020-06-02 17:31 ` Peter Zijlstra
2020-06-02 17:31 ` [PATCH 2/3] kcsan: Remove __no_kcsan_or_inline Peter Zijlstra
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2020-06-02 17:31 UTC (permalink / raw)
To: tglx; +Cc: x86, elver, paulmck, kasan-dev, linux-kernel, peterz
Now that KCSAN relies on -tsan-distinguish-volatile we no longer need
the annotation for constant_test_bit(). Remove it.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/bitops.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -201,12 +201,8 @@ arch_test_and_change_bit(long nr, volati
return GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btc), *addr, c, "Ir", nr);
}
-static __no_kcsan_or_inline bool constant_test_bit(long nr, const volatile unsigned long *addr)
+static __always_inline bool constant_test_bit(long nr, const volatile unsigned long *addr)
{
- /*
- * Because this is a plain access, we need to disable KCSAN here to
- * avoid double instrumentation via instrumented bitops.
- */
return ((1UL << (nr & (BITS_PER_LONG-1))) &
(addr[nr >> _BITOPS_LONG_SHIFT])) != 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] kcsan: Remove __no_kcsan_or_inline
2020-06-02 17:31 [PATCH 0/3] KCSAN cleanups and noinstr Peter Zijlstra
2020-06-02 17:31 ` [PATCH 1/3] x86, kcsan: Remove __no_kcsan_or_inline usage Peter Zijlstra
@ 2020-06-02 17:31 ` Peter Zijlstra
2020-06-02 17:31 ` [PATCH 3/3] x86, kcsan: Add __no_kcsan to noinstr Peter Zijlstra
2020-06-02 18:46 ` [PATCH 0/3] KCSAN cleanups and noinstr Marco Elver
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2020-06-02 17:31 UTC (permalink / raw)
To: tglx; +Cc: x86, elver, paulmck, kasan-dev, linux-kernel, peterz
There are no more user of this function attribute, also, with us now
actively supporting '__no_kcsan inline' it doesn't make sense to have
in any case.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
Documentation/dev-tools/kcsan.rst | 6 ------
include/linux/compiler_types.h | 5 +----
2 files changed, 1 insertion(+), 10 deletions(-)
--- a/Documentation/dev-tools/kcsan.rst
+++ b/Documentation/dev-tools/kcsan.rst
@@ -114,12 +114,6 @@ functions, compilation units, or entire
To dynamically limit for which functions to generate reports, see the
`DebugFS interface`_ blacklist/whitelist feature.
- For ``__always_inline`` functions, replace ``__always_inline`` with
- ``__no_kcsan_or_inline`` (which implies ``__always_inline``)::
-
- static __no_kcsan_or_inline void foo(void) {
- ...
-
* To disable data race detection for a particular compilation unit, add to the
``Makefile``::
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -193,10 +193,7 @@ struct ftrace_likely_data {
#define __no_kcsan __no_sanitize_thread
#ifdef __SANITIZE_THREAD__
-# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused
-# define __no_sanitize_or_inline __no_kcsan_or_inline
-#else
-# define __no_kcsan_or_inline __always_inline
+# define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused
#endif
#ifndef __no_sanitize_or_inline
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] x86, kcsan: Add __no_kcsan to noinstr
2020-06-02 17:31 [PATCH 0/3] KCSAN cleanups and noinstr Peter Zijlstra
2020-06-02 17:31 ` [PATCH 1/3] x86, kcsan: Remove __no_kcsan_or_inline usage Peter Zijlstra
2020-06-02 17:31 ` [PATCH 2/3] kcsan: Remove __no_kcsan_or_inline Peter Zijlstra
@ 2020-06-02 17:31 ` Peter Zijlstra
2020-06-02 18:46 ` [PATCH 0/3] KCSAN cleanups and noinstr Marco Elver
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2020-06-02 17:31 UTC (permalink / raw)
To: tglx; +Cc: x86, elver, paulmck, kasan-dev, linux-kernel, peterz
The 'noinstr' function attribute means no-instrumentation, this should
very much include *SAN. Because lots of that is broken at present,
only include KCSAN for now, as that is limited to clang11, which has
sane function attribute behaviour.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/compiler_types.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -118,10 +118,6 @@ struct ftrace_likely_data {
#define notrace __attribute__((__no_instrument_function__))
#endif
-/* Section for code which can't be instrumented at all */
-#define noinstr \
- noinline notrace __attribute((__section__(".noinstr.text")))
-
/*
* it doesn't make sense on ARM (currently the only user of __naked)
* to trace naked functions because then mcount is called without
@@ -200,6 +196,10 @@ struct ftrace_likely_data {
#define __no_sanitize_or_inline __always_inline
#endif
+/* Section for code which can't be instrumented at all */
+#define noinstr \
+ noinline notrace __attribute((__section__(".noinstr.text"))) __no_kcsan
+
#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] KCSAN cleanups and noinstr
2020-06-02 17:31 [PATCH 0/3] KCSAN cleanups and noinstr Peter Zijlstra
` (2 preceding siblings ...)
2020-06-02 17:31 ` [PATCH 3/3] x86, kcsan: Add __no_kcsan to noinstr Peter Zijlstra
@ 2020-06-02 18:46 ` Marco Elver
3 siblings, 0 replies; 5+ messages in thread
From: Marco Elver @ 2020-06-02 18:46 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Thomas Gleixner, the arch/x86 maintainers, Paul E. McKenney,
kasan-dev, LKML
On Tue, 2 Jun 2020 at 19:34, Peter Zijlstra <peterz@infradead.org> wrote:
>
> Hi all,
>
> Here's two KCSAN cleanups and the required noinstr change for x86.
Thank you!
Reviewed-by: Marco Elver <elver@google.com>
As promised, here are the patches that would take care of KASAN and
UBSAN, rebased on the patches here:
https://lkml.kernel.org/r/20200602184409.22142-1-elver@google.com
Thanks,
-- Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-02 18:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02 17:31 [PATCH 0/3] KCSAN cleanups and noinstr Peter Zijlstra
2020-06-02 17:31 ` [PATCH 1/3] x86, kcsan: Remove __no_kcsan_or_inline usage Peter Zijlstra
2020-06-02 17:31 ` [PATCH 2/3] kcsan: Remove __no_kcsan_or_inline Peter Zijlstra
2020-06-02 17:31 ` [PATCH 3/3] x86, kcsan: Add __no_kcsan to noinstr Peter Zijlstra
2020-06-02 18:46 ` [PATCH 0/3] KCSAN cleanups and noinstr Marco Elver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox