[PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The UL_ASAN_BLACKLIST allows AddressSanitizer to be set off for functions
that cannot be checked.

Reference: http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h
Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 include/c.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/c.h b/include/c.h
index 0f6e5b2..223f3a7 100644
--- a/include/c.h
+++ b/include/c.h
@@ -313,4 +313,21 @@ static inline int xusleep(useconds_t usec)
 #define stringify_value(s) stringify(s)
 #define stringify(s) #s
 
+/*
+ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time
+ * instrumentation shipped with Clang and GCC) to not instrument the
+ * annotated function.  Furthermore, it will prevent the compiler from
+ * inlining the function because inlining currently breaks the blacklisting
+ * mechanism of AddressSanitizer.
+ */
+#if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+#  define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address))
+# else
+#  define UL_ASAN_BLACKLIST	/* nothing */
+# endif
+#else
+# define UL_ASAN_BLACKLIST	/* nothing */
+#endif
+
 #endif /* UTIL_LINUX_C_H */
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux