linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubsan, kcsan: don't combine sanitizer with kcov
@ 2020-05-05 14:23 Arnd Bergmann
  2020-05-05 14:36 ` Marco Elver
  2020-05-22 16:08 ` [tip: locking/kcsan] ubsan, kcsan: Don't " tip-bot2 for Arnd Bergmann
  0 siblings, 2 replies; 11+ messages in thread
From: Arnd Bergmann @ 2020-05-05 14:23 UTC (permalink / raw)
  To: Andrey Ryabinin, Kees Cook, Andrey Konovalov, Marco Elver
  Cc: Arnd Bergmann, Dmitry Vyukov, Paul E. McKenney, Ingo Molnar,
	Andrew Morton, Greg Kroah-Hartman, Stephen Rothwell,
	Thomas Gleixner, kasan-dev, linux-kernel, clang-built-linux

Clang does not allow -fsanitize-coverage=trace-{pc,cmp} together
with -fsanitize=bounds or with ubsan:

clang: error: argument unused during compilation: '-fsanitize-coverage=trace-pc' [-Werror,-Wunused-command-line-argument]
clang: error: argument unused during compilation: '-fsanitize-coverage=trace-cmp' [-Werror,-Wunused-command-line-argument]

To avoid that case, add a Kconfig dependency. The dependency could
go either way, disabling CONFIG_KCOV or CONFIG_UBSAN_BOUNDS when the
other is set. I picked the second option here as this seems to have
a smaller impact on the resulting kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/Kconfig.kcsan | 2 +-
 lib/Kconfig.ubsan | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
index ea28245c6c1d..8f856c8828d5 100644
--- a/lib/Kconfig.kcsan
+++ b/lib/Kconfig.kcsan
@@ -5,7 +5,7 @@ config HAVE_ARCH_KCSAN
 
 menuconfig KCSAN
 	bool "KCSAN: dynamic data race detector"
-	depends on HAVE_ARCH_KCSAN && DEBUG_KERNEL && !KASAN
+	depends on HAVE_ARCH_KCSAN && DEBUG_KERNEL && !KASAN && !KCOV
 	select STACKTRACE
 	help
 	  The Kernel Concurrency Sanitizer (KCSAN) is a dynamic
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index 929211039bac..f98ef029553e 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -29,6 +29,7 @@ config UBSAN_TRAP
 config UBSAN_BOUNDS
 	bool "Perform array index bounds checking"
 	default UBSAN
+	depends on !(CC_IS_CLANG && KCOV)
 	help
 	  This option enables detection of directly indexed out of bounds
 	  array accesses, where the array size is known at compile time.
-- 
2.26.0


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

end of thread, other threads:[~2020-05-22 16:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 14:23 [PATCH] ubsan, kcsan: don't combine sanitizer with kcov Arnd Bergmann
2020-05-05 14:36 ` Marco Elver
2020-05-05 14:50   ` Dmitry Vyukov
2020-05-05 14:59     ` Arnd Bergmann
2020-05-05 15:19       ` Marco Elver
2020-05-05 15:28         ` Arnd Bergmann
2020-05-05 17:07           ` Marco Elver
2020-05-07 16:25             ` [PATCH] [v2] ubsan, kcsan: don't combine sanitizer with kcov on clang Arnd Bergmann
2020-05-07 16:50               ` Marco Elver
2020-05-13 20:02               ` Paul E. McKenney
2020-05-22 16:08 ` [tip: locking/kcsan] ubsan, kcsan: Don't " tip-bot2 for Arnd Bergmann

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).