summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* Make asan_symbolize.py not crash on Windows.Nico Weber2015-01-281-18/+25
| | | | | | | | asan_symbolize.py isn't needed on Windows, but it's nice if asan has a unified UI on all platforms. So rather than have asan_symolize.py die on startup due to it importing modules that don't exist on Windows, let it just echo the input. llvm-svn: 227326
* [ASan] Fix use-after-scope in COMMON_INTERCEPTOR_ENTER implementation.Alexey Samsonov2015-01-271-1/+1
| | | | | | | | Make sure "void *ctx" doesn't point to an object which already went out of scope. This might also fix -Wuninitialized warnings GCC 4.7 produces while building ASan runtime. llvm-svn: 227258
* [compiler-rt] Ensure AsanInitFromRtl is called from a static initializer on ↵Kuba Brecka2015-01-231-4/+4
| | | | | | | | | | | | | | | | | | | | OS X by using ASAN_DYNAMIC=1 The idea is to ensure that the ASan runtime gets initialized early (i.e. before other initializers/constructors) even when DYLD_INSERT_LIBRARIES is not used. In that case, the interceptors are not installed (on OS X, DYLD_INSERT_LIBRARIES is required for interceptors to work), and therefore ASan gets currently initialized quite late -- from the main executable's module initializer. The following issues are a consequence of this: https://code.google.com/p/address-sanitizer/issues/detail?id=363 https://code.google.com/p/address-sanitizer/issues/detail?id=357 Both of them are fixed with this patch. Reviewed at http://reviews.llvm.org/D7117 llvm-svn: 226929
* Fix the extra whitespace from r226878.Kuba Brecka2015-01-231-1/+1
| | | | llvm-svn: 226884
* Fix/workaround for OS X truncated stacktraces taken by external toolsKuba Brecka2015-01-222-7/+2
| | | | | | | | | | This patch is a proposed solution for https://code.google.com/p/address-sanitizer/issues/detail?id=375: When the stacktraces are captured and printed by ASan itself, they are fine, but when the program has already printed the report (or is just printing it), capturing a stacktrace via other means is broken. "Other means" include OS X CrashReporter, debuggers or calling backtrace() within the program. For example calling backtrace() from a sanitizer_set_death_callback function prints a very truncated stacktrace. Reviewed at http://reviews.llvm.org/D7103 llvm-svn: 226878
* [msan] Better use-after-free reports.Evgeniy Stepanov2015-01-221-2/+2
| | | | | | | | | | | | | By attaching an extra integer tag to heap origins, we are able to distinguish between uninits - created by heap allocation, - created by heap deallocation (i.e. use-after-free), - created by __msan_allocated_memory call, - etc. See https://code.google.com/p/memory-sanitizer/issues/detail?id=35. llvm-svn: 226821
* [ASan/Win] Move the shadow to 0x30000000Timur Iskhodzhanov2015-01-221-6/+8
| | | | llvm-svn: 226809
* [ASan] Print out the shadow memory range on shadow mapping failuresTimur Iskhodzhanov2015-01-221-0/+2
| | | | llvm-svn: 226807
* [Sanitizers] Intercept opendir()Viktor Kutuzov2015-01-211-0/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D6968 llvm-svn: 226648
* [asan] use MADV_NOHUGEPAGE for shadow to reduce the actual memory usageKostya Serebryany2015-01-213-3/+7
| | | | llvm-svn: 226636
* [asan] Allow changing verbosity in activation flags.Evgeniy Stepanov2015-01-207-19/+19
| | | | | | | This change removes some debug output in asan_flags.cc that was reading the verbosity level before all the flags were parsed. llvm-svn: 226566
* [asan] Warn if unsupported flags are used at activation.Evgeniy Stepanov2015-01-202-4/+52
| | | | llvm-svn: 226563
* [sanitizer] Make unrecognized flags not fatal.Evgeniy Stepanov2015-01-191-3/+3
| | | | | | Print a warning at verbosity=1 and higher instead of dying immediately. llvm-svn: 226458
* [asan] Change detection of allow_user_segv_handler on Android.Evgeniy Stepanov2015-01-161-1/+1
| | | | llvm-svn: 226273
* [sanitizer] Flag parser rewrite.Evgeniy Stepanov2015-01-154-18/+22
| | | | | | | The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. llvm-svn: 226169
* [ASan] Move the shadow on Windows 32-bit from 0x20000000 to 0x40000000Timur Iskhodzhanov2015-01-121-5/+13
| | | | llvm-svn: 225641
* Fix two extra semicolon warningsEhsan Akhgari2015-01-121-1/+2
| | | | | | | | | | Reviewers: timurrrr Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6890 llvm-svn: 225635
* Remove AsanInterceptsSignal in favor of (equivalent) IsDeadlySignal.Alexey Samsonov2015-01-094-16/+3
| | | | llvm-svn: 225556
* [asan] add flag quarantine_size_mb, deprecate quarantine_sizeKostya Serebryany2015-01-074-5/+20
| | | | llvm-svn: 225337
* [Sanitizer] Change the runtime flag representation.Alexey Samsonov2015-01-074-215/+166
| | | | | | | | | | | 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. llvm-svn: 225327
* [asan] add a flag soft_rss_limit_mbKostya Serebryany2015-01-063-2/+14
| | | | llvm-svn: 225323
* Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after ↵Alexey Samsonov2015-01-021-9/+12
| | | | | | | | | | | | | | | | 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. llvm-svn: 225088
* Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization."Chandler Carruth2015-01-021-11/+9
| | | | | | | | | | 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. llvm-svn: 225079
* [asan] Fix possibly uninitialized coverage flag.Evgeniy Stepanov2014-12-261-0/+2
| | | | llvm-svn: 224857
* [asan] Allow enabling coverage at activation.Evgeniy Stepanov2014-12-263-18/+26
| | | | | | | | 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. llvm-svn: 224853
* Revert r224838, r224839.Evgeniy Stepanov2014-12-263-26/+18
| | | | | | Flaky failures on the build bots. llvm-svn: 224850
* [asan] Allow enabling coverage at activation.Evgeniy Stepanov2014-12-253-18/+26
| | | | llvm-svn: 224838
* [asan] Support ASAN_ACTIVATION_OPTIONS.Evgeniy Stepanov2014-12-241-0/+6
| | | | | | | | 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. llvm-svn: 224824
* [ASan/Win] Bandaid fix for PR22025 -- deadlocks when creating suspended threadsTimur Iskhodzhanov2014-12-241-15/+13
| | | | llvm-svn: 224823
* [Sanitizer] Make CommonFlags immutable after initialization.Alexey Samsonov2014-12-221-9/+11
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 224736
* AddressSanitizer: Abort after failed exec() and get rid of the allow_reexec ↵Kuba Brecka2014-12-224-17/+8
| | | | | | | | | | | | | | | | ASan flag As mentioned in https://code.google.com/p/address-sanitizer/issues/detail?id=365, when the re-exec that adds the required DYLD_INSERT_LIBRARIES variable fails, ASan currently continues to run, but things are broken (some memory can be overwritten, interceptors don't work, ...). This patch aborts if the execv() fails and prints an error message that DYLD_INSERT_LIBRARIES is required. It also removes the "alllow_reexec" flag, since using it causes the same issues. Reviewed at http://reviews.llvm.org/D6752 llvm-svn: 224712
* AddressSanitizer: Properly handle dispatch_source_set_cancel_handler with aKuba Brecka2014-12-221-0/+4
| | | | | | | | | | | | | | | | | | | | | NULL handler Per https://developer.apple.com/library/mac/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html, the dispatch_source_set_cancel_handler() API *can* be called with a NULL handler. In that case, the libdispatch removes an already existing cancellation handler, if there was one. ASan's interceptor always creates a new block that always tries to call the original handler. In case the original block is NULL, a segmentation fault happens. Let's fix that by not wrapping a NULL-block at all. It looks like all the other libdispatch APIs (which we intercept) do *not* allow NULL. So it's really only the dispatch_source_set_cancel_handler one that needs this fix. Reviewed at http://reviews.llvm.org/D6747 llvm-svn: 224711
* [ASan] Fix the logic that decides whether we need to spawn a new ↵Alexander Potapenko2014-12-221-3/+3
| | | | | | llvm-symbolizer in asan_symbolize.py llvm-svn: 224710
* [Sanitizers] Intercept snprintf_l() on FreeBSDViktor Kutuzov2014-12-221-0/+30
| | | | | | Differential Revision: http://reviews.llvm.org/D6418 llvm-svn: 224700
* [Sanitizer] Refactor CommonFlags interface. NFC.Alexey Samsonov2014-12-192-6/+6
| | | | | | | | | | 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. llvm-svn: 224617
* [ASan] Change activation strategy.Alexey Samsonov2014-12-196-35/+54
| | | | | | | | | | | 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). llvm-svn: 224614
* [ASan] Introduce AllocatorOptions to configure allocator behavior.Alexey Samsonov2014-12-194-43/+81
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 224605
* [ASan] Restrict the set of flags overriden at activation.Alexey Samsonov2014-12-191-26/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 224601
* [ASan] Move flag validation from ParseFlagsFromString() to InitializeFlags().Alexey Samsonov2014-12-191-5/+5
| | | | llvm-svn: 224600
* [ASan] Always build shared ASan runtime on Linux.Alexey Samsonov2014-12-172-38/+40
| | | | | | | | | | | | | | | | | This commit changes the strategy for building shared ASan runtime and the way we test it: - COMPILER_RT_BUILD_SHARED_ASAN CMake option is removed. We now always build shared ASan runtime (it is the default on Android, Windows and Mac, and not the default on Linux and FreeBSD). - Platforms, which use static runtime by default now have "check-asan-dynamic" testsuite. This testsuite contains instrumented unit tests, and ASan lit tests, and runs them with shared ASan runtime. This testsuite is *not* a part of "check-asan" and *not* a part of "check-all", as adding 1000 more test cases, which duplicate existing ones is costly. However, you're welcome to add this command to your buildbot. llvm-svn: 224470
* [ASan] Move flag parsing logic to asan_flags.cc. NFC.Alexey Samsonov2014-12-176-277/+309
| | | | llvm-svn: 224450
* [ASan] Re-structure the allocator code. NFC.Alexey Samsonov2014-12-172-422/+472
| | | | | | | | | | | | | Introduce "Allocator" object, which contains all the bits and pieces ASan allocation machinery actually use: allocator from sanitizer_common, quarantine, fallback allocator and quarantine caches, fallback mutex. This step is a preparation to adding more state to this object. We want to reduce dependency of Allocator on commandline flags and be able to "safely" modify its behavior (such as the size of the redzone) at runtime. llvm-svn: 224406
* Rename asan_allocator2.cc to asan_allocator.ccAlexey Samsonov2014-12-174-4/+4
| | | | llvm-svn: 224396
* [ASan] Introduce SetCanPoisonMemory() function.Alexey Samsonov2014-12-176-13/+31
| | | | | | | | | | 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. llvm-svn: 224395
* [asan] new flag: hard_rss_limit_mbKostya Serebryany2014-12-162-0/+8
| | | | llvm-svn: 224353
* [ASan] Allow to atomically modify malloc_context_size at runtime.Alexey Samsonov2014-12-164-10/+29
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 224305
* [asan] introduce __sanitizer_set_death_callback, deprecate ↵Kostya Serebryany2014-12-151-4/+1
| | | | | | __asan_set_death_callback llvm-svn: 224286
* [Sanitizer] Introduce Allocator::may_return_null bool flag.Alexey Samsonov2014-12-124-22/+21
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 224148
* [ASan] Group all flag parsing code together. NFC.Alexey Samsonov2014-12-121-12/+14
| | | | llvm-svn: 224087
* [ASan] Change fake stack and local variables handling.Alexey Samsonov2014-12-112-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the way we get fake stack from ASan runtime (to find use-after-return errors) and the way we represent local variables: - __asan_stack_malloc function now returns pointer to newly allocated fake stack frame, or NULL if frame cannot be allocated. It doesn't take pointer to real stack as an input argument, it is calculated inside the runtime. - __asan_stack_free function doesn't take pointer to real stack as an input argument. Now this function is never called if fake stack frame wasn't allocated. - __asan_init version is bumped to reflect changes in the ABI. - new flag "-asan-stack-dynamic-alloca" allows to store all the function local variables in a dynamic alloca, instead of the static one. It reduces the stack space usage in use-after-return mode (dynamic alloca will not be called if the local variables are stored in a fake stack), and improves the debug info quality for local variables (they will not be described relatively to %rbp/%rsp, which are assumed to be clobbered by function calls). This flag is turned off by default for now, but I plan to turn it on after more testing. llvm-svn: 224063
OpenPOWER on IntegriCloud