Commit 51b09104 authored by pbos's avatar pbos Committed by Commit bot

Add print_stacktrace=1 to ubsan defaults.

Also using a no_sanitize list for SANITIZER_HOOK_ATTRIBUTE instead of
separate attributes per tool.

BUG=
R=glider@chromium.org

Review URL: https://codereview.chromium.org/1474733002

Cr-Commit-Position: refs/heads/master@{#361376}
parent 2260ac35
......@@ -13,7 +13,8 @@
#endif // ADDRESS_SANITIZER && OS_MACOSX
#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(THREAD_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
......@@ -27,9 +28,7 @@ void _sanitizer_options_link_helper() { }
// the linker.
#define SANITIZER_HOOK_ATTRIBUTE \
extern "C" \
__attribute__((no_sanitize_address)) \
__attribute__((no_sanitize_memory)) \
__attribute__((no_sanitize_thread)) \
__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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment