summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
* [compiler-rt] [asan] Use same shadow offset for aarch64Adhemerval Zanella2015-11-092-6/+0
| | | | | | | | This patch makes ASAN for aarch64 use the same shadow offset for all currently supported VMAs (39 and 42 bits). The shadow offset is the same for 39-bit (36). llvm-svn: 252497
* [ASan] Add two new functions to DLL thunk.Alexey Samsonov2015-11-061-0/+3
| | | | llvm-svn: 252359
* Revert "Reapply: [asan] On OS X, log reports to syslog and os_trace"Juergen Ributzka2015-11-042-25/+18
| | | | | | | Looks like this commit is deadlocking the ASAN tests on the green dragon bot (http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA/). llvm-svn: 252076
* Asan: utility function to determine first wrongly poisoned byte inMike Aizatsky2015-11-041-9/+16
| | | | | | | | container. Differential Revision: http://reviews.llvm.org/D14341 llvm-svn: 252071
* [tsan] Use malloc zone interceptors on OS X, part 1 (refactoring)Kuba Brecka2015-11-041-336/+39
| | | | | | | | TSan needs to use a custom malloc zone on OS X, which is already implemented in ASan. This patch is a refactoring patch (NFC) that extracts this from ASan into sanitizer_common, where we can reuse it in TSan. Reviewed at http://reviews.llvm.org/D14330 llvm-svn: 252052
* Revert "Apply modernize-use-default to compiler-rt."Alexey Samsonov2015-10-301-1/+1
| | | | | | | | | | | | This reverts commit r250823. Replacing at least some of empty constructors with "= default" variants is a semantical change which we don't want. E.g. __tsan::ClockBlock contains a union of large arrays, and it's critical for correctness and performance that we don't memset() these arrays in the constructor. llvm-svn: 251717
* Sanitizer: define WIN32_LEAN_AND_MEANSaleem Abdulrasool2015-10-292-0/+2
| | | | | | | | Define WIN32_LEAN_AND_MEAN before including Windows.h. This is already being done in some places. This does it more broadly. This permits building ASAN on Linux for Winndows, as well as reduces the amount of included declarations. llvm-svn: 251649
* Reapply: [asan] On OS X, log reports to syslog and os_traceAnna Zaks2015-10-282-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When ASan currently detects a bug, by default it will only print out the text of the report to stderr. This patch changes this behavior and writes the full text of the report to syslog before we terminate the process. It also calls os_trace (Activity Tracing available on OS X and iOS) with a message saying that the report is available in syslog. This is useful, because this message will be shown in the crash log. For this to work, the patch makes sure we store the full report into error_message_buffer unconditionally, and it also strips out ANSI escape sequences from the report (they are used when producing colored reports). I've initially tried to log to syslog during printing, which is done on Android right now. The advantage is that if we crash during error reporting or the produced error does not go through ScopedInErrorReport, we would still get a (partial) message in the syslog. However, that solution is very problematic on OS X. One issue is that the logging routine uses GCD, which may spawn a new thread on its behalf. In many cases, the reporting logic locks threadRegistry, which leads to deadlocks. Reviewed at http://reviews.llvm.org/D13452 (In addition, add sanitizer_common_libcdep.cc to buildgo.sh to avoid build failures on Linux.) llvm-svn: 251577
* [asan] Fix asan_device_setup script on KitKat.Evgeniy Stepanov2015-10-281-0/+2
| | | | | | | | | app_process32, when started via a shell script wrapper, needs a different security context to satisty SELinux. Patch by Abhishek Arya. llvm-svn: 251572
* Revert "[asan] On OS X, log reports to syslog and os_trace"Anna Zaks2015-10-272-25/+18
| | | | | | | | This reverts commit 251447. (Which caused failures on a Linux bot.) llvm-svn: 251467
* [asan] On OS X, log reports to syslog and os_traceAnna Zaks2015-10-272-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | When ASan currently detects a bug, by default it will only print out the text of the report to stderr. This patch changes this behavior and writes the full text of the report to syslog before we terminate the process. It also calls os_trace (Activity Tracing available on OS X and iOS) with a message saying that the report is available in syslog. This is useful, because this message will be shown in the crash log. For this to work, the patch makes sure we store the full report into error_message_buffer unconditionally, and it also strips out ANSI escape sequences from the report (they are used when producing colored reports). I've initially tried to log to syslog during printing, which is done on Android right now. The advantage is that if we crash during error reporting or the produced error does not go through ScopedInErrorReport, we would still get a (partial) message in the syslog. However, that solution is very problematic on OS X. One issue is that the logging routine uses GCD, which may spawn a new thread on its behalf. In many cases, the reporting logic locks threadRegistry, which leads to deadlocks. Reviewed at http://reviews.llvm.org/D13452 llvm-svn: 251447
* [asan] Sort headers.Anna Zaks2015-10-271-4/+4
| | | | llvm-svn: 251446
* asan_symbolize.py: Call llvm-symbolizer with --functions=linkage instead of ↵Alexey Samsonov2015-10-261-1/+1
| | | | | | --functions=short. llvm-svn: 251356
* Apply modernize-use-default to compiler-rt.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: klimek, bkramer Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13892 llvm-svn: 250823
* [asan][mips] Fix ABI incompatibility crash in pthread_create() following ↵Daniel Sanders2015-10-051-0/+2
| | | | | | | | r248325. Like i386, Mips needs a versioned interceptor but must select GLIBC_2.2. llvm-svn: 249307
* [compiler-rt] Fix build (again) by wrapping lines to 80 chars (NFC)Vedant Kumar2015-10-011-1/+2
| | | | llvm-svn: 248979
* [compiler-rt] Apply modernize-use-nullptr fixes in sanitizersVedant Kumar2015-10-0111-72/+79
| | | | | | | | | | | | | | | | | | - Trim spaces. - Use nullptr in place of 0 for pointer variables. - Use '!p' in place of 'p == 0' for null pointer checks. - Add blank lines to separate function definitions. - Add 'extern "C"' or 'namespace foo' comments after the appropriate closing brackets This is a continuation of work from 409b7b82. The focus here is on the various sanitizers (not sanitizer_common, as before). Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13225 llvm-svn: 248966
* [asan] Fix asan_symbolize.py handling of non-existing pathsEvgeniy Stepanov2015-09-301-2/+2
| | | | llvm-svn: 248962
* [asan] Versioned interceptor for pthread_create.Evgeniy Stepanov2015-09-222-0/+14
| | | | | | | | | This fixes a crash in pthread_create on linux/i386 due to abi incompatibility between intercepted and non-intercepted functions. See the test case for more details. llvm-svn: 248325
* [sanitizer] Move CheckVMASize after flag initializationAdhemerval Zanella2015-09-151-1/+2
| | | | llvm-svn: 247684
* Support inline functions symbolization in Addr2Line symbolizer.Alexey Samsonov2015-09-141-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Maxim Ostapenko! Summary: Right now, Addr2Line symbolizer in asan_symbolize.py doesn't support inline functions symbolization. This might be a useful feature for using ASan on embedded systems. Test results: $ cat test.c static inline void FooBarBaz() { __sanitizer_print_stack_trace(); } int main() { FooBarBaz(); return 0; } $ clang test.c -fsanitize=address -g -O2 -o test.x && ./test.x &> /tmp/test.log $ ./projects/compiler-rt/lib/asan/scripts/asan_symbolize.py -l /tmp/test.log #0 0x42095e in __sanitizer_print_stack_trace _asan_rtl_ #1 0x4cec07 in FooBarBaz /home/max/build/llvm/asan/test.c:4 #2 0x4cec07 in main /home/max/build/llvm/asan/test.c:8 #3 0x7f89f0891ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 Reviewers: glider, samsonov Subscribers: jevinskie, llvm-commits, ygribov Differential Revision: http://reviews.llvm.org/D12153 llvm-svn: 247642
* [compiler-rt] [sanitizers] Add VMA size check at runtimeAdhemerval Zanella2015-09-111-0/+1
| | | | | | | | | This patch adds a runtime check for asan, dfsan, msan, and tsan for architectures that support multiple VMA size (like aarch64). Currently the check only prints a warning indicating which is the VMA built and expected against the one detected at runtime. llvm-svn: 247413
* Revert r246961 "[asan] Intercept and wrap XPC callback blocks".Kuba Brecka2015-09-071-45/+9
| | | | | | There is a build failure for the simulator. llvm-svn: 246967
* [asan] Intercept and wrap XPC callback blocksKuba Brecka2015-09-071-9/+45
| | | | | | | | On recent OS X systems, blocks used as callbacks for XPC events (set up e.g. via xpc_connection_set_event_handler) are not later executed via the public libdispatch API (dispatch_async, etc). Because we don't intercept the path where the block is executed, we can fail to register the newly created dispatch thread. To fix that, let's intercept libxpc's APIs that take a block as a callback handler, and let's wrap these blocks in the same way as we do for libdispatch API. Differential Revision: http://reviews.llvm.org/D12490 llvm-svn: 246961
* [asan] Fix >80 chars line.Evgeniy Stepanov2015-09-041-1/+2
| | | | llvm-svn: 246875
* [asan] Disable asm instrumentation tests on android/x86.Evgeniy Stepanov2015-09-041-3/+6
| | | | | | https://github.com/google/sanitizers/issues/353 llvm-svn: 246866
* [asan] Fix signal interception on Android.Evgeniy Stepanov2015-09-021-6/+5
| | | | | | | | | | | | All supported version of Android provide both "signal" and "bsd_signal" libc exports. Binaries built for API level <21 call bsd_signal; newer binaries call signal. Simply intercept both. Fixes AddressSanitizer.SignalTest on Android/x86. llvm-svn: 246716
* [CMake] Unify build rules for sanitizer_common for Apple and non-Apple ↵Alexey Samsonov2015-08-272-0/+2
| | | | | | | | | platforms. Additionally, link safestack runtime on OS X with nolibc version of sanitizer_common runtime, as we do on Linux. llvm-svn: 246227
* [Sanitizers] Make abort_on_error common flag.Alexey Samsonov2015-08-272-6/+0
| | | | | | | | | | | | | | Summary: Teach all sanitizers to call abort() instead of _exit() after printing an error report, if requested. This behavior is the default on Mac OS. Reviewers: kcc, kubabrecka Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12332 llvm-svn: 246205
* [CMake] Add ARCHS option to add_sanitizer_rt_symbols.Chris Bieneman2015-08-271-2/+4
| | | | | | | | | | | | | | | | | Summary: This is another step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt. Changes to CMakeLists files are all minimal except ubsan which tests the new ARCHS loop. Further cleanup patches will follow. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12410 llvm-svn: 246199
* [CMake] Converting add_sanitizer_rt_symbols to use cmake_parse_arguments.Chris Bieneman2015-08-261-1/+2
| | | | | | | | | | | | Summary: This is the first step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12386 llvm-svn: 246102
* [CMake] Add OBJECT_LIBS option to add_compiler_rt_runtime, and refactored ↵Chris Bieneman2015-08-262-48/+43
| | | | | | | | | | | | | | asan call site to use it. Summary: This is one more step to allow us to eliminate platform-specific code from the library CMakeLists files. Subsequent patches will refactor all call sites to use this and other new features. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12339 llvm-svn: 246047
* [CMake] fixing a typo that is breaking bots.Chris Bieneman2015-08-251-1/+1
| | | | llvm-svn: 245971
* [CMake] merge add_compiler_rt_runtime and add_compiler_rt_darwin_runtime ↵Chris Bieneman2015-08-251-28/+34
| | | | | | | | | | | | | | | | into a single function Summary: This refactoring moves much of the Apple-specific behavior into a function in AddCompilerRT. The next cleanup patch will remove more of the if(APPLE) checks in the outlying CMakeLists. This patch adds a bunch of new functionality to add_compiler_rt_runtime so that the target names don't need to be reconstructed outside the call. It also updates some of the call sites to exercise the new functionality, but does not update all uses fully. Subsequent patches will further update call sites and move to using the new features. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: beanz, rengolin, llvm-commits Differential Revision: http://reviews.llvm.org/D12292 llvm-svn: 245970
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-241-2/+0
| | | | | | | | | | | Previously we had to call __sanitizer_cov_dump() from tool-specific callbacks - instead, let sanitizer_common library handle this in a single place. This is a re-application of r245770, with slightly different approach taken. llvm-svn: 245890
* [Sanitizers] Allow to install several internal Die callbacks.Alexey Samsonov2015-08-241-1/+1
| | | | | | | | | | | | | | | | | This is required to properly re-apply r245770: 1) We should be able to dump coverage in __sanitizer::Die() if coverage collection is turned on. 2) We don't want to explicitly do this in every single sanitizer that supports it. 3) We don't want to link in coverage (and therefore symbolization) bits into small sanitizers that don't support it (safestack). The solution is to make InitializeCoverage() register its own Die() callback that would call __sanitizer_cov_dump(). This callback should be executed in addition to another tool-specific die callbacks (if there are any). llvm-svn: 245889
* Revert r245770 and r245777.Alexey Samsonov2015-08-221-0/+2
| | | | | | | These changes break both autoconf Mac OS X buildbot (linker errors due to wrong Makefiles) and CMake buildbot (safestack test failures). llvm-svn: 245784
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-221-2/+0
| | | | | | | Previously we had to call __sanitizer_cov_dump() from tool-specific callbacks - instead, let sanitizer_common library handle this in a single place. llvm-svn: 245770
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-217-25/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all sanitizers. Summary: Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan into one entity. Additionally, make sure sanitizer_common now uses the value of common_flags()->exitcode when dying on error, so that this flag will automatically work for other sanitizers (UBSan and DFSan) as well. User-visible changes: * "exit_code" MSan runtime flag is now deprecated. If explicitly specified, this flag will take precedence over "exitcode". The users are encouraged to migrate to the new version. * __asan_set_error_exit_code() and __msan_set_exit_code() functions are removed. With few exceptions, we don't support changing runtime flags during program execution - we can't make them thread-safe. The users should use __sanitizer_set_death_callback() that would call _exit() with proper exit code instead. * Plugin tools (LSan and UBSan) now inherit the exit code of the parent tool. In particular, this means that ASan would now crash the program with exit code "1" instead of "23" if it detects leaks. Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12120 llvm-svn: 245734
* [asan] Enable ASan for AArch64/42-bit VMAAdhemerval Zanella2015-08-202-0/+16
| | | | | | | | | | | This patch adds support for asan on aarch64-linux with 42-bit VMA (current default config for 64K pagesize kernels). The support is enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time for both clang/llvm and compiler-rt. The default VMA is 39 bits. For 42-bit VMA aarch64 uses SANITIZIER_CAN_USER_ALLOCATOR64. llvm-svn: 245596
* [CMake] Fixing r245581 based on feedback from Filcab.Chris Bieneman2015-08-201-3/+0
| | | | llvm-svn: 245582
* [CMake] Fix building unit tests on DarwinChris Bieneman2015-08-201-1/+8
| | | | | | | | | | | | | | | | Summary: There are a number of issues with unit tests on Darwin. These patches address the following: * Unit tests should be passed -arch (-m32/-m64 isn't sufficient) * Unit tests should be passed ${DARWIN_osx_CFLAGS} because they're being built for OS X * Test architectures should be filtered based on base system capabilities (i.e. don't try running x86_64h tests on pre-haswell hardware). Reviewers: bogner, filcab, kubabrecka Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12174 llvm-svn: 245580
* [windows] Implement GetProcAddress internally to avoid initializing the CRTReid Kleckner2015-08-181-7/+7
| | | | | | | | | | | | | | | | | ASan uses GetProcAddress to get the address of malloc so it can patch it. Newer versions of Windows make GetProcAddress initialize the DLL before returning a function pointer into it. That's perfectly reasonable, but ASan needs to finish patching malloc before CRT initialization. So now we roll our own GetProcAddress. Fixes PR24237 Based on a patch by David Major Originally written by David Major as part of: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h llvm-svn: 245377
* [CMake] Refactoring add_compiler_rt functions for darwin runtimes.Chris Bieneman2015-08-181-1/+2
| | | | | | | | | | | | Summary: This patch consolidates add_compiler_rt_osx_static_runtime and add_compiler_rt_darwin_dynamic_runtime into a single new function add_compiler_rt_darwin_runtime. Reviewers: filcab, samsonov, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12106 llvm-svn: 245317
* Fix installation of the unhandled exception filter with r244767Reid Kleckner2015-08-131-1/+1
| | | | | | | Apparently /Zc:inline causes static globals in custom sections to be discarded if they are unreferenced. llvm-svn: 244908
* Try to fix the MSVC build now that we use /Zc:inline.Rafael Espindola2015-08-121-0/+2
| | | | | | Thanks to Majnemer for the help. llvm-svn: 244786
* -Wdeprecated: Use noexcept rather than throw() where supportedDavid Blaikie2015-08-101-4/+4
| | | | | | | | | | Summary: I've copy/pasted the LLVM_NOEXCEPT definition macro goo from LLVM's Compiler.h. Is there somewhere I should put this in Compiler RT? Is there a useful header to define/share things like this? Reviewers: samsonov Differential Revision: http://reviews.llvm.org/D11780 llvm-svn: 244453
* [asan] Try different values of the shadow gap start.Evgeniy Stepanov2015-08-072-1/+16
| | | | | | | | The number of unaccessible pages at the beginning of the address space can differ between processes on the same machine. Try different values at runtime to protect as much memory as possible. llvm-svn: 244364
* [asan] Reduce shadow gap start on 32-bit Android.Evgeniy Stepanov2015-08-071-1/+1
| | | | | | | This fixes an internal assertion failure when running out of the address space in the large allocator. llvm-svn: 244359
* [ASAN] Disable ManyThreadsTest in AArch64Renato Golin2015-08-071-0/+3
| | | | | | | | This test was in an infinite loop in AArch64. We're investigating it on PR24389, but I'm disabling it for now, so that we continue testing everything else. llvm-svn: 244316
OpenPOWER on IntegriCloud