Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: build/sanitizers/sanitizer_options.cc

Issue 1474733002: Add print_stacktrace=1 to ubsan defaults. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: close no_sanitize parenthesis Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/sanitizers/sanitizer_options.cc
diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc
index 342ab94b2cfce17cef156cb4e4d891555eeb21e9..b06ec7e15254823b62473edeff09256bf9df7ba1 100644
--- a/build/sanitizers/sanitizer_options.cc
+++ b/build/sanitizers/sanitizer_options.cc
@@ -12,8 +12,9 @@
#include <string.h>
#endif // ADDRESS_SANITIZER && OS_MACOSX
-#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \
- defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \
+ defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \
+ defined(UNDEFINED_SANITIZER)
// Functions returning default options are declared weak in the tools' runtime
// libraries. To make the linker pick the strong replacements for those
// functions from this module, we explicitly force its inclusion by passing
@@ -25,12 +26,10 @@ void _sanitizer_options_link_helper() { }
// aren't referenced from the Chrome executable. We must ensure that those
// callbacks are not sanitizer-instrumented, and that they aren't stripped by
// the linker.
-#define SANITIZER_HOOK_ATTRIBUTE \
- extern "C" \
- __attribute__((no_sanitize_address)) \
- __attribute__((no_sanitize_memory)) \
- __attribute__((no_sanitize_thread)) \
- __attribute__((visibility("default"))) \
+#define SANITIZER_HOOK_ATTRIBUTE \
+ extern "C" \
+ __attribute__((no_sanitize("address", "memory", "thread", "undefined"))) \
+ __attribute__((visibility("default"))) \
__attribute__((used))
#endif
@@ -177,3 +176,14 @@ SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_suppressions() {
}
#endif // LEAK_SANITIZER
+
+#if defined(UNDEFINED_SANITIZER)
+// Default options for UndefinedBehaviorSanitizer:
+// print_stacktrace=1 - print the stacktrace when UBSan reports an error.
+const char kUbsanDefaultOptions[] = "print_stacktrace=1";
+
+SANITIZER_HOOK_ATTRIBUTE const char* __ubsan_default_options() {
+ return kUbsanDefaultOptions;
+}
+
+#endif // UNDEFINED_SANITIZER
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698