summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizers] extracted process management functionsMike Aizatsky2016-01-268-30/+148
| | | | | | Differential Revision: http://reviews.llvm.org/D16546 llvm-svn: 258849
* Revert "[sanitizers] extracted process management functions"Mike Aizatsky2016-01-258-150/+30
| | | | | | This reverts commit e5b34d5a2bf4c882bc647dd26a8cea2adc76f63c. llvm-svn: 258713
* fixed clang-tidy configMike Aizatsky2016-01-251-1/+1
| | | | llvm-svn: 258711
* [sanitizers] extracted process management functionsMike Aizatsky2016-01-258-30/+150
| | | | | | Differential Revision: http://reviews.llvm.org/D16542 llvm-svn: 258710
* [asan] Don't use sysconf(_SC_PAGESIZE) on Android.Evgeniy Stepanov2016-01-251-1/+3
| | | | | | | | | | This is broken in the current (post-MNC) master branch. Use EXEC_PAGESIZE instead, the same as on x86 Linux. This change fixes startup crashes in the existing tests on AOSP master. llvm-svn: 258706
* .clang-tidy for sanitizer package to override root llvm styleMike Aizatsky2016-01-211-0/+12
| | | | | | | | | | Summary: sanitizer-common follows Google code style, override clang-tidy config. Differential Revision: http://reviews.llvm.org/D16373 llvm-svn: 258449
* using const instead of constexpr: MSVC troublesMike Aizatsky2016-01-191-2/+2
| | | | llvm-svn: 258253
* [sancov] NFC: simplifying DumpOffsets.Mike Aizatsky2016-01-191-29/+38
| | | | | | | | | Summary: Extracting GetRangeOffset function before report-on-dump functionality. Differential Revision: http://reviews.llvm.org/D16332 llvm-svn: 258211
* Fix -Wexpansion-to-defined warnings in compiler-rt.Nico Weber2016-01-191-2/+10
| | | | llvm-svn: 258200
* [asan] Optionally print reproducer cmdline in ASan reports.Maxim Ostapenko2016-01-186-1/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D16070 llvm-svn: 258037
* Attempt to fix sanitizer-windows bot.Peter Collingbourne2016-01-161-0/+2
| | | | llvm-svn: 257978
* Introduce stats and stats_client libraries.Peter Collingbourne2016-01-165-14/+66
| | | | | | | | | 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 llvm-svn: 257972
* [tsan] Use internal_sigfillset to replace REAL(sigfillset).Yabin Cui2016-01-152-1/+2
| | | | | | | | | | | | | | Summary: Android doesn't intercept sigfillset, so REAL(sigfillset) is null. And we can use internal_sigfillset() for all cases. Reviewers: kcc, eugenis, kubabrecka, dvyukov Subscribers: llvm-commits, tberghammer, danalbert Differential Revision: http://reviews.llvm.org/D15296 llvm-svn: 257862
* Unbreak Windows build.Peter Collingbourne2016-01-152-1/+3
| | | | llvm-svn: 257860
* sanitizer_common: C++ify the IntrusiveList iterator interface.Peter Collingbourne2016-01-156-34/+34
| | | | llvm-svn: 257858
* Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni2016-01-141-1/+1
| | | | | | | | | | | | | | | | With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision: http://reviews.llvm.org/D16165 llvm-svn: 257783
* [tsan] Introduce a "ignore_interceptors_accesses" optionKuba Brecka2016-01-141-0/+10
| | | | | | | | On OS X, TSan already passes all unit and lit tests, but for real-world applications (even very simple ones), we currently produce a lot of false positive reports about data races. This makes TSan useless at this point, because the noise dominates real bugs. This introduces a runtime flag, "ignore_interceptors_accesses", off by default, which makes TSan ignore all memory accesses that happen from interceptors. This will significantly lower the coverage and miss a lot of bugs, but it eliminates most of the current false positives on OS X. Differential Revision: http://reviews.llvm.org/D15189 llvm-svn: 257760
* Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg2016-01-131-1/+1
| | | | | | | | | | | | | | | compiling" This broke the build. For example, from http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1191/steps/cmake%20stage%201/logs/stdio: -- Compiler-RT supported architectures: aarch64 CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:170 (string): string sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): projects/compiler-rt/lib/CMakeLists.txt:4 (include) llvm-svn: 257694
* With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compilingSumanth Gundapaneni2016-01-131-1/+1
| | | | | | | | | | | | | | | environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision:http://reviews.llvm.org/D15082 llvm-svn: 257686
* [libFuzzer] extend the weak memcmp/strcmp/strncmp interceptors to receive ↵Kostya Serebryany2016-01-121-13/+21
| | | | | | the result of the computations. With that, don't do any mutations if memcmp/etc returned 0 llvm-svn: 257423
* Follow-up fix for r256988 to unbreak the Linux buildbot.Kuba Brecka2016-01-071-0/+1
| | | | llvm-svn: 257042
* [sanitizers] Log all output to CrashReport on OS XAnna Zaks2016-01-066-14/+25
| | | | | | | | | | | Log all of sanitizers' output (not just ASan bug reports) to CrashReport, which simplifies diagnosing failed checks as well as other errors. This also allows to strip the color sequences early from the printed buffer, which is more efficient than what we had perviously. Differential Revision: http://reviews.llvm.org/D15396 llvm-svn: 256988
* [sancov] coverage pc bufferMike Aizatsky2016-01-052-0/+22
| | | | | | Differential Revision: http://reviews.llvm.org/D15871 llvm-svn: 256804
* [asan] fix fopen interceptor to not crash if path is NULLKostya Serebryany2015-12-211-1/+1
| | | | llvm-svn: 256182
* [UBSan] Implement runtime suppressions (PR25066).Alexey Samsonov2015-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add the ability to suppress UBSan reports for files/functions/modules at runtime. The user can now pass UBSAN_OPTIONS=suppressions=supp.txt with the contents of the form: signed-integer-overflow:file-with-known-overflow.cpp alignment:function_doing_unaligned_access vptr:shared_object_with_vptr_failures.so Suppression categories match the arguments passed to -fsanitize= flag (although, see below). There is no overhead if suppressions are not provided. Otherwise there is extra overhead for symbolization. Limitations: 1) sometimes suppressions need debug info / symbol table to function properly (although sometimes frontend generates enough info to do the match). 2) it's only possible to suppress recoverable UB kinds - if you've built the code with -fno-sanitize-recover=undefined, suppressions will not work. 3) categories are fine-grained check kinds, not groups like "undefined" or "integer", so you can't write "undefined:file_with_ub.cc". Reviewers: rsmith, kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15363 llvm-svn: 256018
* [asan] add option: handle_sigillKostya Serebryany2015-12-153-0/+5
| | | | llvm-svn: 255588
* [msan] Intercept ctermid, ctermid_r.Evgeniy Stepanov2015-12-142-0/+34
| | | | llvm-svn: 255566
* [TSan] Try harder to avoid compiler-generated memcpy calls.Alexey Samsonov2015-12-101-8/+9
| | | | | | | | check_memcpy test added in r254959 fails on some configurations due to memcpy() calls inserted by Clang. Try harder to avoid them by using internal_memcpy() where applicable. llvm-svn: 255287
* [asan] Suppress duplicated errors in ASan recovery mode.Yury Gribov2015-12-101-0/+3
| | | | | | | | Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D15080 llvm-svn: 255228
* [TSan] Try harder to avoid compiler-generated memset calls.Alexey Samsonov2015-12-092-1/+2
| | | | | | | | | | check_memcpy test added in r254959 fails on some configurations due to memset() calls inserted by Clang. Try harder to avoid them: * Explicitly use internal_memset() instead of empty braced-initializer. * Replace "new T()" with "new T", as the former generates zero-initialization for structs in C++11. llvm-svn: 255136
* [PPC64, TSAN] LLVM basic enablement of thread sanitizer for PPC64 (BE and LE)Bill Schmidt2015-12-083-5/+89
| | | | | | | | | | | | | | | | | | This patch is by Simone Atzeni with portions by Adhemerval Zanella. This contains the LLVM patches to enable the thread sanitizer for PPC64, both big- and little-endian. Two different virtual memory sizes are supported: Old kernels use a 44-bit address space, while newer kernels require a 46-bit address space. There are two companion patches that will be added shortly. There is a Clang patch to actually turn on the use of the thread sanitizer for PPC64. There is also a patch that I wrote to provide interceptor support for setjmp/longjmp on PPC64. Patch discussion at reviews.llvm.org/D12841. llvm-svn: 255057
* [tsan] Fix memcmp interceptor to correctly use ↵Kuba Brecka2015-12-081-2/+2
| | | | | | | | | | COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED The memcmp interceptor checks COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED only after it calls COMMON_INTERCEPTOR_ENTER, which causes an early process launch crash when running TSan in iOS simulator. Let's fix this by checking COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED as the very first thing in the interceptor. Differential Revision: http://reviews.llvm.org/D15287 llvm-svn: 255019
* [asan] Remove the use of system properties on Android.Evgeniy Stepanov2015-12-042-11/+0
| | | | | | | | | | | | | 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. llvm-svn: 254783
* [libsanitizer] Fix bugs and wiki links to point to GitHub.Alexander Potapenko2015-12-047-146/+146
| | | | llvm-svn: 254738
* [ASan] Retire mac_ignore_invalid_free, remove some dead code.Alexander Potapenko2015-12-041-16/+6
| | | | | | | | | | mac_ignore_invalid_free was helpful when ASan runtime used to intercept CFAllocator and sometimes corrupted its memory. This behavior had been long gone, and the flag was unused. This patch also deletes ReportMacCfReallocUnknown(), which was used by the CFAllocator realloc() wrapper. llvm-svn: 254722
* [sanitizer] Replace a local array with InternalScopedString in MaybeReexec()Kuba Brecka2015-12-031-4/+4
| | | | | | | | | | | | `MaybeReexec` contains a 1024-byte long local array, which produces a warning about frame size: .../lib/sanitizer_common/sanitizer_mac.cc:548:6: warning: stack frame size of 1132 bytes in function '__sanitizer::MaybeReexec' [-Wframe-larger-than=] Let's replace it with InternalScopedString. Differential Revision: http://reviews.llvm.org/D15181 llvm-svn: 254619
* [tsan] Use re-exec method to enable interceptors on older versions of OS XKuba Brecka2015-12-034-0/+195
| | | | | | | | In AddressSanitizer, we have the MaybeReexec method to detect when we're running without DYLD_INSERT_LIBRARIES (in which case interceptors don't work) and re-execute with the environment variable set. On OS X 10.11+, this is no longer necessary, but to have ThreadSanitizer supported on older versions of OS X, let's use the same method as well. This patch moves the implementation from `asan/` into `sanitizer_common/`. Differential Revision: http://reviews.llvm.org/D15123 llvm-svn: 254600
* [sanitizer coverage] when adding a bb trace instrumentation, do it instead, ↵Kostya Serebryany2015-12-021-5/+7
| | | | | | not in addition to, regular coverage. Do the regular coverage in the run-time instead llvm-svn: 254483
* [Sanitizer] Increase kPcThreshold in slow unwinder after r254395.Alexey Samsonov2015-12-011-1/+1
| | | | llvm-svn: 254460
* [compiler-rt] Remove SANITIZER_AARCH64_VMA usageAdhemerval Zanella2015-11-302-29/+1
| | | | | | | | | | | | This patch complete removed SANITIZER_AARCH64_VMA definition and usage. AArch64 ports now supports runtime VMA detection and instrumentation for 39 and 42-bit VMA. It also Rewrite print_address to take a variadic argument list (the addresses to print) and adjust the tests which uses it to the new signature. llvm-svn: 254319
* [sanitizer] Detect an invalid answer in AtosSymbolizerKuba Brecka2015-11-301-0/+6
| | | | | | | | On OS X, in AtosSymbolizer, if the answer from atos doesn't contain module name, let's bail and return false. There are some cases where this is beneficial, because we'll try DlAddrSymbolizer next (it's next in the symbolizer chain), which might be able to symbolize something that atos couldn't. Differential Revision: http://reviews.llvm.org/D15071 llvm-svn: 254301
* [tsan] Fix weakly imported functions on OS XKuba Brecka2015-11-301-1/+4
| | | | | | | | | | On OS X, for weak function (that user can override by providing their own implementation in the main binary), we need extern `"C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE NOINLINE`. Fixes a broken test case on OS X, java_symbolization.cc, which uses a weak function __tsan_symbolize_external. Differential Revision: http://reviews.llvm.org/D14907 llvm-svn: 254298
* [asan] Old Linux kernels (< 3.0) don't define ARM_VFPREGS_SIZE that leads toYury Gribov2015-11-301-0/+8
| | | | | | | | | | build errors on ARM. Define it internally to avoid such errors. Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D14921 llvm-svn: 254292
* [tsan] Port tsan_rtl_amd64.S to OS X to add support for setjmp/longjmpKuba Brecka2015-11-281-1/+13
| | | | | | | | | | | | | | This patch ports the assembly file tsan_rtl_amd64.S to OS X, where we need several changes: * Some assembler directives are not available on OS X (.hidden, .type, .size) * Symbol names need to start with an underscore (added a ASM_TSAN_SYMBOL macro for that). * To make the interceptors work, we ween to name the function "_wrap_setjmp" (added ASM_TSAN_SYMBOL_INTERCEPTOR for that). * Calling the original setjmp is done with a simple "jmp _setjmp". * __sigsetjmp doesn't exist on OS X. Differential Revision: http://reviews.llvm.org/D14947 llvm-svn: 254228
* sanitizer_common: remove noisy warning about symbolizer not found.Ivan Krasin2015-11-251-4/+0
| | | | | | | | | | | | | | Summary: In r251553, I added a warning that proved to be super noisy, especially in case of MSan. Removing it for now, and I will probably add some additional diagnostics for symbolizer, when I better understand how to make it properly. Reviewers: eugenis Differential Revision: http://reviews.llvm.org/D14998 llvm-svn: 254102
* [sanitizer] Fix a crash with DlAddrSymbolizer and unnamed symbolsKuba Brecka2015-11-251-1/+1
| | | | | | Apparently, dladdr() can succeed but return a NULL pointer, in which case strdup will crash. Let's not call strdup on NULL pointers. llvm-svn: 254068
* [compiler-rt] Do not pull in min and max macros from windows.hAnna Zaks2015-11-201-0/+2
| | | | | | This should fix Windows buildbot breakage triggered by r253690. llvm-svn: 253701
* [asan] On OS X, write error reports into Crash Report.Anna Zaks2015-11-202-0/+16
| | | | | | | | The Crash Report is going to add app specific info if it is stored in the magical buffer. Differential Revision: http://reviews.llvm.org/D14791 llvm-svn: 253691
* [compiler-rt] Add internal implementations for strlcat and strlcpyAnna Zaks2015-11-203-0/+80
| | | | | | | | | | The compiler-rt should make use of strlcpy() rather than strncpy(). Using internal_strncpy() may be fine with appropriate bounds checking or enforcement of nul-termination elsewhere, but it's just good practice these days to avoid using strncpy() in new code. A patch by Jeremy Sequoia! Differential Revision: http://reviews.llvm.org/D14714 llvm-svn: 253690
* [asan] Fix the deadlocks introduced by "On OS X, log reports to syslog and ↵Anna Zaks2015-11-206-19/+27
| | | | | | | | | | | | os_trace" commit [asan] On OS X, log reports to syslog and os_trace, has been reverted in r252076 due to deadlocks on earlier versions of OS X. Alexey has also noticed deadlocks in some corner cases on Linux. This patch, if applied on top of the logging patch (http://reviews.llvm.org/D13452), addresses the known deadlock issues. (This also proactively removes the color escape sequences from the error report buffer since we have to copy the buffer anyway.) Differential Revision: http://reviews.llvm.org/D14470 llvm-svn: 253689
OpenPOWER on IntegriCloud