10#if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX)
11#include <crt_externs.h>
15#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \
16 defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER)
22void _sanitizer_options_link_helper() { }
28#define SANITIZER_HOOK_ATTRIBUTE \
30 __attribute__((no_sanitize_address)) \
31 __attribute__((no_sanitize_memory)) \
32 __attribute__((no_sanitize_thread)) \
33 __attribute__((visibility("default"))) \
37#if defined(ADDRESS_SANITIZER)
66#if defined(GOOGLE_CHROME_BUILD)
70const char kAsanDefaultOptions[] =
71 "legacy_pthread_cond=1 malloc_context_size=5 "
72 "symbolize=false check_printf=1 use_sigaltstack=1 detect_leaks=0 "
73 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1";
76const char *kAsanDefaultOptions =
77 "symbolize=false check_printf=1 use_sigaltstack=1 "
78 "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 "
79 "detect_stack_use_after_return=1 ";
82#elif defined(OS_MACOSX)
83const char *kAsanDefaultOptions =
84 "check_printf=1 use_sigaltstack=1 "
85 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 "
86 "detect_stack_use_after_return=1 detect_odr_violation=0 ";
87static const char kNaClDefaultOptions[] =
"handle_segv=0";
88static const char kNaClFlag[] =
"--type=nacl-loader";
91#if defined(OS_LINUX) || defined(OS_MACOSX)
92SANITIZER_HOOK_ATTRIBUTE
const char *__asan_default_options() {
94 char*** argvp = _NSGetArgv();
95 int* argcp = _NSGetArgc();
96 if (!argvp || !argcp)
return kAsanDefaultOptions;
99 for (
int i = 0;
i < argc; ++
i) {
100 if (strcmp(
argv[
i], kNaClFlag) == 0) {
101 return kNaClDefaultOptions;
105 return kAsanDefaultOptions;
108extern "C" char kASanDefaultSuppressions[];
110SANITIZER_HOOK_ATTRIBUTE
const char *__asan_default_suppressions() {
111 return kASanDefaultSuppressions;
116#if defined(THREAD_SANITIZER) && defined(OS_LINUX)
129const char kTsanDefaultOptions[] =
130 "detect_deadlocks=1 second_deadlock_stack=1 report_signal_unsafe=0 "
131 "report_thread_leaks=0 print_suppressions=1 history_size=7 "
132 "strip_path_prefix=Release/../../ ";
134SANITIZER_HOOK_ATTRIBUTE
const char *__tsan_default_options() {
135 return kTsanDefaultOptions;
138extern "C" char kTSanDefaultSuppressions[];
140SANITIZER_HOOK_ATTRIBUTE
const char *__tsan_default_suppressions() {
141 return kTSanDefaultSuppressions;
146#if defined(LEAK_SANITIZER)
151const char kLsanDefaultOptions[] =
152 "print_suppressions=1 strip_path_prefix=Release/../../ ";
155 return kLsanDefaultOptions;
158extern "C" char kLSanDefaultSuppressions[];
160SANITIZER_HOOK_ATTRIBUTE
const char *__lsan_default_suppressions() {
161 return kLSanDefaultSuppressions;
const char * __lsan_default_options()