2015-10-21 09:32:45 +02:00
|
|
|
//===-- tsan_flags.inc ------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-08-14 10:47:11 +02:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-10-21 09:32:45 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// TSan runtime flags.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef TSAN_FLAG
|
|
|
|
# error "Define TSAN_FLAG prior to including this file!"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// TSAN_FLAG(Type, Name, DefaultValue, Description)
|
|
|
|
// See COMMON_FLAG in sanitizer_flags.inc for more details.
|
|
|
|
|
|
|
|
TSAN_FLAG(bool, enable_annotations, true,
|
|
|
|
"Enable dynamic annotations, otherwise they are no-ops.")
|
|
|
|
// Suppress a race report if we've already output another race report
|
|
|
|
// with the same stack.
|
|
|
|
TSAN_FLAG(bool, suppress_equal_stacks, true,
|
|
|
|
"Suppress a race report if we've already output another race report "
|
|
|
|
"with the same stack.")
|
|
|
|
TSAN_FLAG(bool, suppress_equal_addresses, true,
|
|
|
|
"Suppress a race report if we've already output another race report "
|
|
|
|
"on the same address.")
|
|
|
|
|
|
|
|
TSAN_FLAG(bool, report_bugs, true,
|
|
|
|
"Turns off bug reporting entirely (useful for benchmarking).")
|
|
|
|
TSAN_FLAG(bool, report_thread_leaks, true, "Report thread leaks at exit?")
|
|
|
|
TSAN_FLAG(bool, report_destroy_locked, true,
|
|
|
|
"Report destruction of a locked mutex?")
|
|
|
|
TSAN_FLAG(bool, report_mutex_bugs, true,
|
|
|
|
"Report incorrect usages of mutexes and mutex annotations?")
|
|
|
|
TSAN_FLAG(bool, report_signal_unsafe, true,
|
|
|
|
"Report violations of async signal-safety "
|
|
|
|
"(e.g. malloc() call from a signal handler).")
|
|
|
|
TSAN_FLAG(bool, report_atomic_races, true,
|
|
|
|
"Report races between atomic and plain memory accesses.")
|
|
|
|
TSAN_FLAG(
|
|
|
|
bool, force_seq_cst_atomics, false,
|
|
|
|
"If set, all atomics are effectively sequentially consistent (seq_cst), "
|
|
|
|
"regardless of what user actually specified.")
|
|
|
|
TSAN_FLAG(bool, print_benign, false, "Print matched \"benign\" races at exit.")
|
|
|
|
TSAN_FLAG(bool, halt_on_error, false, "Exit after first reported error.")
|
|
|
|
TSAN_FLAG(int, atexit_sleep_ms, 1000,
|
|
|
|
"Sleep in main thread before exiting for that many ms "
|
|
|
|
"(useful to catch \"at exit\" races).")
|
|
|
|
TSAN_FLAG(const char *, profile_memory, "",
|
|
|
|
"If set, periodically write memory profile to that file.")
|
|
|
|
TSAN_FLAG(int, flush_memory_ms, 0, "Flush shadow memory every X ms.")
|
|
|
|
TSAN_FLAG(int, flush_symbolizer_ms, 5000, "Flush symbolizer caches every X ms.")
|
|
|
|
TSAN_FLAG(
|
|
|
|
int, memory_limit_mb, 0,
|
|
|
|
"Resident memory limit in MB to aim at."
|
|
|
|
"If the process consumes more memory, then TSan will flush shadow memory.")
|
|
|
|
TSAN_FLAG(bool, stop_on_start, false,
|
|
|
|
"Stops on start until __tsan_resume() is called (for debugging).")
|
|
|
|
TSAN_FLAG(bool, running_on_valgrind, false,
|
|
|
|
"Controls whether RunningOnValgrind() returns true or false.")
|
2016-11-08 23:04:09 +01:00
|
|
|
// There are a lot of goroutines in Go, so we use smaller history.
|
2015-10-21 09:32:45 +02:00
|
|
|
TSAN_FLAG(
|
2016-11-08 23:04:09 +01:00
|
|
|
int, history_size, SANITIZER_GO ? 1 : 3,
|
2015-10-21 09:32:45 +02:00
|
|
|
"Per-thread history size, controls how many previous memory accesses "
|
|
|
|
"are remembered per thread. Possible values are [0..7]. "
|
|
|
|
"history_size=0 amounts to 32K memory accesses. Each next value doubles "
|
|
|
|
"the amount of memory accesses, up to history_size=7 that amounts to "
|
|
|
|
"4M memory accesses. The default value is 2 (128K memory accesses).")
|
|
|
|
TSAN_FLAG(int, io_sync, 1,
|
|
|
|
"Controls level of synchronization implied by IO operations. "
|
|
|
|
"0 - no synchronization "
|
|
|
|
"1 - reasonable level of synchronization (write->read)"
|
|
|
|
"2 - global synchronization of all IO operations.")
|
|
|
|
TSAN_FLAG(bool, die_after_fork, true,
|
|
|
|
"Die after multi-threaded fork if the child creates new threads.")
|
|
|
|
TSAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
|
2020-10-16 10:03:04 +02:00
|
|
|
TSAN_FLAG(bool, ignore_interceptors_accesses, SANITIZER_MAC ? true : false,
|
|
|
|
"Ignore reads and writes from all interceptors.")
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
TSAN_FLAG(bool, ignore_noninstrumented_modules, SANITIZER_MAC ? true : false,
|
|
|
|
"Interceptors should only detect races when called from instrumented "
|
|
|
|
"modules.")
|
2016-11-08 23:04:09 +01:00
|
|
|
TSAN_FLAG(bool, shared_ptr_interceptor, true,
|
|
|
|
"Track atomic reference counting in libc++ shared_ptr and weak_ptr.")
|