OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file contains the default options for various compiler-based dynamic | 5 // This file contains the default options for various compiler-based dynamic |
6 // tools. | 6 // tools. |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) | 10 #if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) |
(...skipping 18 matching lines...) Expand all Loading... |
29 extern "C" \ | 29 extern "C" \ |
30 __attribute__((no_sanitize_address)) \ | 30 __attribute__((no_sanitize_address)) \ |
31 __attribute__((no_sanitize_memory)) \ | 31 __attribute__((no_sanitize_memory)) \ |
32 __attribute__((no_sanitize_thread)) \ | 32 __attribute__((no_sanitize_thread)) \ |
33 __attribute__((visibility("default"))) \ | 33 __attribute__((visibility("default"))) \ |
34 __attribute__((used)) | 34 __attribute__((used)) |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(ADDRESS_SANITIZER) | 37 #if defined(ADDRESS_SANITIZER) |
38 // Default options for AddressSanitizer in various configurations: | 38 // Default options for AddressSanitizer in various configurations: |
39 // strict_memcmp=1 - disable the strict memcmp() checking | |
40 // (http://crbug.com/178677 and http://crbug.com/178404). | |
41 // malloc_context_size=5 - limit the size of stack traces collected by ASan | 39 // malloc_context_size=5 - limit the size of stack traces collected by ASan |
42 // for each malloc/free by 5 frames. These stack traces tend to accumulate | 40 // for each malloc/free by 5 frames. These stack traces tend to accumulate |
43 // very fast in applications using JIT (v8 in Chrome's case), see | 41 // very fast in applications using JIT (v8 in Chrome's case), see |
44 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 | 42 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 |
45 // symbolize=false - disable the in-process symbolization, which isn't 100% | 43 // symbolize=false - disable the in-process symbolization, which isn't 100% |
46 // compatible with the existing sandboxes and doesn't make much sense for | 44 // compatible with the existing sandboxes and doesn't make much sense for |
47 // stripped official binaries. | 45 // stripped official binaries. |
48 // legacy_pthread_cond=1 - run in the libpthread 2.2.5 compatibility mode to | 46 // legacy_pthread_cond=1 - run in the libpthread 2.2.5 compatibility mode to |
49 // work around libGL.so using the obsolete API, see | 47 // work around libGL.so using the obsolete API, see |
50 // http://crbug.com/341805. This may break if pthread_cond_t objects are | 48 // http://crbug.com/341805. This may break if pthread_cond_t objects are |
(...skipping 16 matching lines...) Expand all Loading... |
67 // detect_stack_use_after_return=1 - use fake stack to delay the reuse of | 65 // detect_stack_use_after_return=1 - use fake stack to delay the reuse of |
68 // stack allocations and detect stack-use-after-return errors. | 66 // stack allocations and detect stack-use-after-return errors. |
69 // detect_container_overflow=0 - do not detect overflows in containers | 67 // detect_container_overflow=0 - do not detect overflows in containers |
70 // until crbug.com/459632 is fixed. | 68 // until crbug.com/459632 is fixed. |
71 #if defined(OS_LINUX) | 69 #if defined(OS_LINUX) |
72 #if defined(GOOGLE_CHROME_BUILD) | 70 #if defined(GOOGLE_CHROME_BUILD) |
73 // Default AddressSanitizer options for the official build. These do not affect | 71 // Default AddressSanitizer options for the official build. These do not affect |
74 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official | 72 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official |
75 // Chromium builds. | 73 // Chromium builds. |
76 const char kAsanDefaultOptions[] = | 74 const char kAsanDefaultOptions[] = |
77 "legacy_pthread_cond=1 malloc_context_size=5 strict_memcmp=0 " | 75 "legacy_pthread_cond=1 malloc_context_size=5 " |
78 "symbolize=false check_printf=1 use_sigaltstack=1 detect_leaks=0 " | 76 "symbolize=false check_printf=1 use_sigaltstack=1 detect_leaks=0 " |
79 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " | 77 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " |
80 "detect_container_overflow=0 "; | 78 "detect_container_overflow=0 "; |
81 #else | 79 #else |
82 // Default AddressSanitizer options for buildbots and non-official builds. | 80 // Default AddressSanitizer options for buildbots and non-official builds. |
83 const char *kAsanDefaultOptions = | 81 const char *kAsanDefaultOptions = |
84 "strict_memcmp=0 symbolize=false check_printf=1 use_sigaltstack=1 " | 82 "symbolize=false check_printf=1 use_sigaltstack=1 " |
85 "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " | 83 "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " |
86 "detect_stack_use_after_return=1 detect_container_overflow=0 "; | 84 "detect_stack_use_after_return=1 detect_container_overflow=0 "; |
87 #endif // GOOGLE_CHROME_BUILD | 85 #endif // GOOGLE_CHROME_BUILD |
88 | 86 |
89 #elif defined(OS_MACOSX) | 87 #elif defined(OS_MACOSX) |
90 const char *kAsanDefaultOptions = | 88 const char *kAsanDefaultOptions = |
91 "strict_memcmp=0 replace_intrin=0 check_printf=1 use_sigaltstack=1 " | 89 "replace_intrin=0 check_printf=1 use_sigaltstack=1 " |
92 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " | 90 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " |
93 "detect_stack_use_after_return=1 detect_odr_violation=0 " | 91 "detect_stack_use_after_return=1 detect_odr_violation=0 " |
94 "detect_container_overflow=0 "; | 92 "detect_container_overflow=0 "; |
95 static const char kNaClDefaultOptions[] = "handle_segv=0"; | 93 static const char kNaClDefaultOptions[] = "handle_segv=0"; |
96 static const char kNaClFlag[] = "--type=nacl-loader"; | 94 static const char kNaClFlag[] = "--type=nacl-loader"; |
97 #endif // OS_LINUX | 95 #endif // OS_LINUX |
98 | 96 |
99 #if defined(OS_LINUX) || defined(OS_MACOSX) | 97 #if defined(OS_LINUX) || defined(OS_MACOSX) |
100 SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_options() { | 98 SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_options() { |
101 #if defined(OS_MACOSX) | 99 #if defined(OS_MACOSX) |
102 char*** argvp = _NSGetArgv(); | 100 char*** argvp = _NSGetArgv(); |
103 int* argcp = _NSGetArgc(); | 101 int* argcp = _NSGetArgc(); |
104 if (!argvp || !argcp) return kAsanDefaultOptions; | 102 if (!argvp || !argcp) return kAsanDefaultOptions; |
105 char** argv = *argvp; | 103 char** argv = *argvp; |
106 int argc = *argcp; | 104 int argc = *argcp; |
107 for (int i = 0; i < argc; ++i) { | 105 for (int i = 0; i < argc; ++i) { |
108 if (strcmp(argv[i], kNaClFlag) == 0) { | 106 if (strcmp(argv[i], kNaClFlag) == 0) { |
109 return kNaClDefaultOptions; | 107 return kNaClDefaultOptions; |
110 } | 108 } |
111 } | 109 } |
112 #endif | 110 #endif |
113 return kAsanDefaultOptions; | 111 return kAsanDefaultOptions; |
114 } | 112 } |
| 113 |
| 114 extern "C" char kASanDefaultSuppressions[]; |
| 115 |
| 116 SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_suppressions() { |
| 117 return kASanDefaultSuppressions; |
| 118 } |
115 #endif // OS_LINUX || OS_MACOSX | 119 #endif // OS_LINUX || OS_MACOSX |
116 #endif // ADDRESS_SANITIZER | 120 #endif // ADDRESS_SANITIZER |
117 | 121 |
118 #if defined(THREAD_SANITIZER) && defined(OS_LINUX) | 122 #if defined(THREAD_SANITIZER) && defined(OS_LINUX) |
119 // Default options for ThreadSanitizer in various configurations: | 123 // Default options for ThreadSanitizer in various configurations: |
120 // detect_deadlocks=1 - enable deadlock (lock inversion) detection. | 124 // detect_deadlocks=1 - enable deadlock (lock inversion) detection. |
121 // second_deadlock_stack=1 - more verbose deadlock reports. | 125 // second_deadlock_stack=1 - more verbose deadlock reports. |
122 // report_signal_unsafe=0 - do not report async-signal-unsafe functions | 126 // report_signal_unsafe=0 - do not report async-signal-unsafe functions |
123 // called from signal handlers. | 127 // called from signal handlers. |
124 // report_thread_leaks=0 - do not report unjoined threads at the end of | 128 // report_thread_leaks=0 - do not report unjoined threads at the end of |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return kLsanDefaultOptions; | 161 return kLsanDefaultOptions; |
158 } | 162 } |
159 | 163 |
160 extern "C" char kLSanDefaultSuppressions[]; | 164 extern "C" char kLSanDefaultSuppressions[]; |
161 | 165 |
162 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_suppressions() { | 166 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_suppressions() { |
163 return kLSanDefaultSuppressions; | 167 return kLSanDefaultSuppressions; |
164 } | 168 } |
165 | 169 |
166 #endif // LEAK_SANITIZER | 170 #endif // LEAK_SANITIZER |
OLD | NEW |