summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_flags.h
AgeCommit message (Collapse)Author
2017-11-10[sanitizer] Remove unnecessary attribute hidden.Evgeniy Stepanov
This should fix windows build of compiler-rt broken in r317943. The attribute is unnecessary because since GetMaxVirtualAddress was split in two, we no longer use common_flags() in the ifunc resolver context. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[asan] Use dynamic shadow on 32-bit Android.Evgeniy Stepanov
Summary: The following kernel change has moved ET_DYN base to 0x4000000 on arm32: https://marc.info/?l=linux-kernel&m=149825162606848&w=2 Switch to dynamic shadow base to avoid such conflicts in the future. Reserve shadow memory in an ifunc resolver, but don't use it in the instrumentation until PR35221 is fixed. This will eventually let use save one load per function. Reviewers: kcc Subscribers: aemerson, srhines, kubamracek, kristof.beyls, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D39393 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka
Summary: allow_user_segv_handler had confusing name did not allow to control behavior for signals separately. Reviewers: eugenis, alekseyshl, kcc Subscribers: llvm-commits, dberris, kubamracek Differential Revision: https://reviews.llvm.org/D33371 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19[compiler-rt] Switch handle_<signal> flags from bool to enum.Vitaly Buka
Summary: We are going to make it tri-state and remove allow_user_segv_handler. Reviewers: eugenis, alekseys, kcc Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D33159 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18[sancov] common flags initialization.Mike Aizatsky
Summary: Introducing InitializeCommonFlags accross all sanitizers to simplify common flags management. Setting coverage=1 when html_cov_report is requested. Differential Revision: http://reviews.llvm.org/D18273 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16Introduce stats and stats_client libraries.Peter Collingbourne
This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16176 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21[sanitizer] Implement include_if_exists with process name substitution.Evgeniy Stepanov
include_if_exists=/path/to/sanitizer/options reads flags from the file if it is present. "%b" in the include file path (for both variants of the flag) is replaced with the basename of the main executable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242853 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20[asan] Warn if unsupported flags are used at activation.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226563 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15[sanitizer] Flag parser rewrite.Evgeniy Stepanov
The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226169 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06[Sanitizer] Use COMMON_FLAG macro to describe common runtime flags.Alexey Samsonov
Summary: Introduce a single place where we specify flag type, name, default value, and description. This removes a large amount of boilerplate and ensures we won't leave flags uninitialized. Test Plan: regression test suite Reviewers: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6851 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after ↵Alexey Samsonov
initialization."" Fix test failures by introducing CommonFlags::CopyFrom() to make sure compiler doesn't insert memcpy() calls into runtime code. Original commit message: Protect CommonFlags singleton by adding const qualifier to common_flags() accessor. The only ways to modify the flags are SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and OverrideCommonFlags() functions, which are only supposed to be called during initialization. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization."Chandler Carruth
We've got some internal users that either aren't compatible with this or have found a bug with it. Either way, this is an isolated cleanup and so I'm reverting it to un-block folks while we investigate. Alexey and I will be working on fixing everything up so this can be re-committed soon. Sorry for the noise and any inconvenience. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225079 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30[asan] add flag coverage_pcs. When false, the coverage is not dumped as PCs. ↵Kostya Serebryany
Useful e.g. if the user only needs coverage is bitset git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23[asan] change the coverage collection scheme so that we can easily emit ↵Kostya Serebryany
coverage for the entire process as a single bit set, and if coverage_bitset=1 actually emit that bitset git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224789 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22[Sanitizer] Make CommonFlags immutable after initialization.Alexey Samsonov
Summary: Protect CommonFlags singleton by adding const qualifier to common_flags() accessor. The only ways to modify the flags are SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and OverrideCommonFlags() functions, which are only supposed to be called during initialization. Test Plan: regression test suite Reviewers: kcc, eugenis, glider Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6741 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224736 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19[Sanitizer] Refactor CommonFlags interface. NFC.Alexey Samsonov
Add CommonFlags::SetDefaults() and CommonFlags::ParseFromString(), so that this object can be easily tested. Enforce that ParseCommonFlagsFromString() and SetCommonFlagsDefaults() work only with singleton CommonFlags, shared across all sanitizer runtimes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224617 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16[asan] new flag: hard_rss_limit_mbKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224353 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-06[Sanitizer] Introduce "stack_trace_format" runtime flag.Alexey Samsonov
This flag can be used to specify the format of stack frames - user can now provide a string with placeholders, which should be printed for each stack frame with placeholders replaced with actual data. For example "%p" will be replaced by PC, "%s" will be replaced by the source file name etc. "DEFAULT" value enforces default stack trace format currently used in all the sanitizers except TSan. This change also implements __sanitizer_print_stack_trace interface function in TSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-24Add runtime flag 'symbolize_inline_frames' to disable symbolization of ↵Alexey Samsonov
inlined frames done in llvm-symbolizer git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220582 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14[asan] Add fast_unwind_on_check flag.Evgeniy Stepanov
Allows to specify the unwinder to use for CHECK failures. Previous behaviour was to use the "fatal" unwinder. As compiler-rt is built without frame pointers, only the slow unwinder really makes sense here, and it is the default. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219677 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12Revert r217616. Problems and complexity it introduces negate its benefitAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217652 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11[UBSan] Parse common flags from UBSAN_OPTIONS runtime variable even ifAlexey Samsonov
UBSan is combined with ASan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217616 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12[Sanitizer] Make disable_coredump a common flag and use it in TSanAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215479 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-30[Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.Alexey Samsonov
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29[sanitizer] Add coverage_dir flag.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209815 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-27[asancov] Write coverage directly to a memory-mapped file.Evgeniy Stepanov
This way does not require a __sanitizer_cov_dump() call. That's important on Android, where apps can be killed at arbitrary time. We write raw PCs to disk instead of module offsets; we also write memory layout to a separate file. This increases dump size by the factor of 2 on 64-bit systems. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209653 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14[asan] Respect personality in kernel area detector, patch by Yuri GribovKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-12[asan] Move the "coverage" flag to common flags.Sergey Matveev
The implementation lives in sanitizer_common and will need to access that flag. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208566 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-14[asan] added internal flag mmap_limit_mbKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206178 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-04[asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to ↵Kostya Serebryany
disable this handler completely; remove a workaround for a bug fixed in glibc git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205617 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21[libsanitizer] Add descriptions for the common flags.Alexander Potapenko
Use new(allocator_for_flags) instead of allocator_for_flags.Allocate() Fix the description output format a bit. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204484 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20[libsanitizer] Introduce flag descriptions.Alexander Potapenko
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags. As the flags are parsed their descriptions are stored in a global linked list. The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions. Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17tsan: yet another attempt to fix pthread_cond interceptorsDmitry Vyukov
Make behavior introduced in r202820 conditional (under legacy_pthread_cond flag). The new issue that we've hit with the satellite pthread_cond_t struct is that pthread_condattr_getpshared does not work (satellite data is not shared between processes). The idea is that most processes do not use pthread 2.2.5. The rare ones that use (2.2.5 is dated by 2002) must specify legacy_pthread_cond=1 on their own risk. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204032 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26[sanitizer] Add a flag to enable/disable report colorization.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202249 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-14[sanitizer] add iterators to bit vectors; make bit vector operations use ↵Kostya Serebryany
little stack; add common flag 'detect_deadlocks' git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-14[sanitizer] Use mmap to zero-fill large shadow regions.Evgeniy Stepanov
This is covered by existing ASan test. This does not change anything for TSan by default (but provides a flag to change the threshold size). Based on a patch by florent.bruneau here:   https://code.google.com/p/address-sanitizer/issues/detail?id=256 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201400 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12[Sanitizer] Teach external symbolizer to work with addr2line if ↵Alexey Samsonov
llvm-symbolizer is unavailable. Allow this mode in TSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201218 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31tsan: fix Go buildDmitry Vyukov
Go linker does not like function-static objects. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28[ASan] Move the signal handling-related flags to sanitizer_common.Alexander Potapenko
This change is a part of refactoring intended to have common signal handling behavior in all tools. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-21Sanitize printf functions.Alexey Samsonov
Intercept and sanitize arguments passed to printf functions in ASan and TSan (don't do this in MSan for now). The checks are controlled by runtime flag (off by default for now). Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199729 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-17[Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).Alexey Samsonov
If 'symbolize' flag is not set, we still want to transform virtual address to module+offset pair in the call to Symbolizer::SymbolizeCode(). See https://code.google.com/p/address-sanitizer/issues/detail?id=251 for more details. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197491 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-27tsan: fix flags parsingDmitry Vyukov
- running_on_valgrind was not parsed in some contexts - refactor code a bit - add comprehensive tests for flags parsing git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195831 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26[Sanitizer] Improve external symbolizer behavior.Alexey Samsonov
1) Don't start external symbolizer subprocess until we actually try to symbolize anything. 2) Allow to turn off external symbolizer by providing empty ?SAN_SYMBOLIZER_PATH environment variable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195771 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14[Sanitizer] Add print_summary runtime flag to disable error summaries (UBSan ↵Alexey Samsonov
doesn't need them) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@194685 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-12[Sanitizer] Specify a default value for each common runtime flagAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@194479 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15tsan: move verbosity flag to CommonFlagsDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15tsan: use sanitizer::CommonFlags in tsanDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192692 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-06[sanitizer] make the allocator crash instead of returning 0 on huge size ↵Kostya Serebryany
(controlled by the allocator_may_return_null flag) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-01[lsan] Add leak_check_at_exit flag.Sergey Matveev
We needed a way to tell LSan to invoke leak checking only if __do_leak_check() is called explicitly. This can now be achieved by setting leak_check_at_exit=false. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187578 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22[lsan] Make __lsan_do_leak_check() honor the detect_leaks flag.Sergey Matveev
Also move detect_leaks to common flags. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@186821 91177308-0d34-0410-b5e6-96231b3b80d8