MCPcopy
hub / github.com/google/clusterfuzz / get_asan_options

Function get_asan_options

src/clusterfuzz/_internal/system/environment.py:145–220  ·  view source on GitHub ↗

Generates default ASAN options.

(redzone_size, malloc_context_size, quarantine_size_mb,
                     bot_platform, leaks, disable_ubsan)

Source from the content-addressed store, hash-verified

143
144
145def get_asan_options(redzone_size, malloc_context_size, quarantine_size_mb,
146 bot_platform, leaks, disable_ubsan):
147 """Generates default ASAN options."""
148 asan_options = {}
149
150 # Default options needed for all cases.
151 asan_options['alloc_dealloc_mismatch'] = 0
152 asan_options['print_scariness'] = 1
153 asan_options['strict_memcmp'] = 0
154
155 # Set provided redzone size.
156 if redzone_size:
157 asan_options['redzone'] = redzone_size
158
159 # This value is used in determining whether to report OOM crashes or not.
160 set_value('REDZONE', redzone_size)
161
162 # Set maximum number of stack frames to report.
163 if malloc_context_size:
164 asan_options['malloc_context_size'] = malloc_context_size
165
166 # Set quarantine size.
167 if quarantine_size_mb:
168 asan_options['quarantine_size_mb'] = quarantine_size_mb
169
170 # Test for leaks if this is an LSan-enabled job type.
171 if get_value('LSAN') and leaks and not get_value('USE_EXTRA_SANITIZERS'):
172 lsan_options = join_memory_tool_options(get_lsan_options())
173 set_value('LSAN_OPTIONS', lsan_options)
174 asan_options['detect_leaks'] = 1
175 else:
176 remove_key('LSAN_OPTIONS')
177 asan_options['detect_leaks'] = 0
178
179 # FIXME: Support container overflow on Android.
180 if is_android(bot_platform):
181 asan_options['detect_container_overflow'] = 0
182
183 # Enable stack use-after-return.
184 asan_options['detect_stack_use_after_return'] = 1
185
186 # Other less important default options for all cases.
187 asan_options.update({
188 'allocator_may_return_null': 1,
189 'allow_user_segv_handler': 0,
190 'check_malloc_usable_size': 0,
191 'detect_odr_violation': 0,
192 'fast_unwind_on_fatal': 1,
193 'print_suppressions': 0,
194 })
195
196 # Add common sanitizer options.
197 asan_options.update(COMMON_SANITIZER_OPTIONS)
198
199 # FIXME: For Windows, rely on online symbolization since llvm-symbolizer.exe
200 # in build archive does not work.
201 asan_options['symbolize'] = int(bot_platform == 'WINDOWS')
202

Callers 1

Calls 9

join_memory_tool_optionsFunction · 0.85
get_lsan_optionsFunction · 0.85
remove_keyFunction · 0.85
is_androidFunction · 0.85
get_ubsan_optionsFunction · 0.85
set_valueFunction · 0.70
get_valueFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected