LKML Archive on
help / color / mirror / Atom feed
* [PATCH v2] kasan: add no_sanitize attribute for clang builds
@ 2018-04-17 12:26 Andrey Konovalov
  0 siblings, 0 replies; only message in thread
From: Andrey Konovalov @ 2018-04-17 12:26 UTC (permalink / raw)
  To: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
	Andrew Morton, David Rientjes, Thomas Gleixner, Ingo Molnar,
	David Woodhouse, Andrey Konovalov, Will Deacon,
	Greg Kroah-Hartman, Paul Lawrence, Sandipan Das, Kees Cook,
	linux-kernel, kasan-dev, linux-mm
  Cc: Kostya Serebryany

KASAN uses the __no_sanitize_address macro to disable instrumentation
of particular functions. Right now it's defined only for GCC build,
which causes false positives when clang is used.

This patch adds a definition for clang.

Note, that clang's revision 329612 or higher is required.

Signed-off-by: Andrey Konovalov <>

Changes since v1:
- Removed redundant #ifdef CONFIG_KASAN check.

 include/linux/compiler-clang.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index ceb96ecab96e..7d98e263e048 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -25,6 +25,9 @@
+#undef __no_sanitize_address
+#define __no_sanitize_address __attribute__((no_sanitize("address")))
 /* Clang doesn't have a way to turn it off per-function, yet. */
 #ifdef __noretpoline
 #undef __noretpoline

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-17 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 12:26 [PATCH v2] kasan: add no_sanitize attribute for clang builds Andrey Konovalov

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