summaryrefslogtreecommitdiff
path: root/lib/asan/asan_activation.cc
AgeCommit message (Collapse)Author
2016-03-21[sanitizier] initializing common flags.Mike Aizatsky
Summary: Without SetDefaults() CommonFlags contain garbage. Differential Revision: http://reviews.llvm.org/D18326 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263985 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
2015-12-04[asan] Remove the use of system properties on Android.Evgeniy Stepanov
System properties are not accessible through NDK (we've been using hacks to get to them) and they are unavailable during ASan initialization in .preinit_array. Use environment variables and files instead (ex. ASAN_OPTIONS=include_if_exists=/path). No test changes. This feature was not tested because the properties are system-wide and would conflict with the parallel test runner. Yet another reason to get rid of it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254783 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-28[asan] Read process name from /proc/self/cmdline on Linux.Evgeniy Stepanov
Rename getBinaryBasename() to getProcessName() and, on Linux, read it from /proc/self/cmdline instead of /proc/self/exe. The former can be modified by the process. The main motivation is Android, where application processes re-write cmdline to a package name. This lets us setup per-application ASAN_OPTIONS through include=/some/path/%b. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243473 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] Allow changing verbosity in activation flags.Evgeniy Stepanov
This change removes some debug output in asan_flags.cc that was reading the verbosity level before all the flags were parsed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226566 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-07[Sanitizer] Change the runtime flag representation.Alexey Samsonov
This mirrors r225239 to all the rest sanitizers: ASan, DFSan, LSan, MSan, TSan, UBSan. Now the runtime flag type, name, default value and description is located in the single place in the .inc file. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-26[asan] Fix possibly uninitialized coverage flag.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224857 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-26[asan] Allow enabling coverage at activation.Evgeniy Stepanov
This is a re-commit of r224838 + r224839, previously reverted in r224850. Test failures were likely (still can not reproduce) caused by two lit tests using the same name for an intermediate build target. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224853 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-26Revert r224838, r224839.Evgeniy Stepanov
Flaky failures on the build bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224850 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-25[asan] Allow enabling coverage at activation.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224838 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-24[asan] Support ASAN_ACTIVATION_OPTIONS.Evgeniy Stepanov
This is mostly useful for testing, as the only other way of specifying activation options (Android system property) is system-wide and affects concurrently running tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224824 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-19[ASan] Change activation strategy.Alexey Samsonov
Now ASan deactivation doesn't modify common or ASan-specific runtime flags. Flags stay constant after initialization, and "deactivation" instead stashes initialized runtime state, and deactivates the runtime. Activation then just restores the original state (possibly, overriden by some activation flags provided in system property on Android). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224614 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19[ASan] Introduce AllocatorOptions to configure allocator behavior.Alexey Samsonov
Summary: Reduce the dependency of allocator code on runtime flags. Instead, pass a bunch of options that configure allocator behavior at initialization or re-initialization. That would allow us to cleaner modify allocator behavior during a program execution when ASan is activated or de-activated. Test Plan: regression test suite Reviewers: kcc Subscribers: llvm-commits, eugenis Differential Revision: http://reviews.llvm.org/D6711 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224605 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19[ASan] Restrict the set of flags overriden at activation.Alexey Samsonov
Summary: Change the way ASan flag parsing is performed at activation: instead of overwriting all ASan and common flags from the activation string, ASan will now only override a handful of whitelisted flags. This is a first step towards making runtime flags immutable after initialization. I plan to re-factor the activation stragegy to the following one: - Parse commandline flags. Override the defaults from compile definition, env var, etc. Flags are immutable at this point. - Initiailize the runtime from commandline flags. - If ASan needs to be started deactivated, stash the runtime state in "asan_deactivated_flags" and deactivate the runtime. - When ASan is activated, override "asan_deactivated_flags" with activation flags, and use it to re-activate the runtime. Test Plan: regression test suite Reviewers: eugenis, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6709 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224601 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17[ASan] Move flag parsing logic to asan_flags.cc. NFC.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224450 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17[ASan] Introduce SetCanPoisonMemory() function.Alexey Samsonov
SetCanPoisonMemory()/CanPoisonMemory() functions are now used instead of "poison_heap" flag to determine if ASan is allowed to poison the shadow memory. This allows to hot-patch this value in runtime (e.g. during ASan activation) without introducing a data race. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224395 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16[ASan] Allow to atomically modify malloc_context_size at runtime.Alexey Samsonov
Summary: Introduce __asan::malloc_context_size atomic that is used to determine required malloc/free stack trace size. It is initialized with common_flags()->malloc_context_size flag, but can later be overwritten at runtime (e.g. when ASan is activated / deactivated). Test Plan: regression test suite Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6645 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224305 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12[Sanitizer] Introduce Allocator::may_return_null bool flag.Alexey Samsonov
Summary: Turn "allocator_may_return_null" common flag into an Allocator::may_return_null bool flag. We want to make sure that common flags are immutable after initialization. There are cases when we want to change this flag in the allocator at runtime: e.g. in unit tests and during ASan activation on Android. Test Plan: regression test suite, real-life applications Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6623 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224148 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25[asan] Improvements for asan deactivated mode: disable asan activation for ↵Yury Gribov
runtime library on Linux, disable malloc checks. Reviewed in http://reviews.llvm.org/D6265 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222732 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-03[asan] Reinitialize allocator quarantine on activation.Evgeniy Stepanov
This is covered by AddressSanitizer.UAF_* tests in asan_test with start_deactivated=1. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200696 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31[asan] Read extra flags from a system property on activation on Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200550 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-16[asan] Fix a build warning on windows.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199390 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-16[asan] Fix a bunch of style issues.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199380 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-16[asan] Implement delayed activation of AddressSanitizerEvgeniy Stepanov
This change adds ASAN_OPTIONS=start_deactivated=1 flag. When present, ASan will start in "deactivated" mode, with no heap poisoning, no quarantine, no stack trace gathering, and minimal redzones. All this features come back when __asan_init is called for the constructor of an instrumented library. The primary use case for this feature is Android. Code itself is not Android-specific, and this patch includes a Linux test for it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199377 91177308-0d34-0410-b5e6-96231b3b80d8