summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* [ASan] Make sure unittest works if sized-delete is enabled by default.Alexey Samsonov2016-03-151-4/+10
| | | | llvm-svn: 263575
* [tests] Portability fixup for r261713.Alexey Samsonov2016-02-241-2/+12
| | | | llvm-svn: 261715
* [tests] Resolve old TODOs in ASan unit tests.Alexey Samsonov2016-02-242-15/+32
| | | | llvm-svn: 261713
* Don't assume that there is only one strchr overload in the global namespace;Richard Smith2016-02-101-18/+11
| | | | | | | | that's not true in general. Instead, use a preference order to pick the standard C++ signature 'char*(char*, int)' where possible and fall back to the C signature 'char*(const char*, int)' only when it's unavailable. llvm-svn: 260425
* Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni2016-01-141-1/+6
| | | | | | | | | | | | | | | | 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
* Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg2016-01-131-6/+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/+6
| | | | | | | | | | | | | | | 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
* [ASan] Fix the links to bugs and wikipages.Alexander Potapenko2015-12-042-6/+6
| | | | llvm-svn: 254735
* [tsan] Use re-exec method to enable interceptors on older versions of OS XKuba Brecka2015-12-031-1/+1
| | | | | | | | 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
* Reapply: [asan] On OS X, log reports to syslog and os_traceAnna Zaks2015-11-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 253688
* Revert "Reapply: [asan] On OS X, log reports to syslog and os_trace"Juergen Ributzka2015-11-041-2/+1
| | | | | | | 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
* Reapply: [asan] On OS X, log reports to syslog and os_traceAnna Zaks2015-10-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "[asan] On OS X, log reports to syslog and os_trace"Anna Zaks2015-10-271-2/+1
| | | | | | | | 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-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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] 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
* [CMake] Unify build rules for sanitizer_common for Apple and non-Apple ↵Alexey Samsonov2015-08-271-0/+1
| | | | | | | | | platforms. Additionally, link safestack runtime on OS X with nolibc version of sanitizer_common runtime, as we do on Linux. llvm-svn: 246227
* [CMake] Add OBJECT_LIBS option to add_compiler_rt_runtime, and refactored ↵Chris Bieneman2015-08-261-1/+1
| | | | | | | | | | | | | | 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
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-211-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [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
* [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
* [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to ↵Kostya Serebryany2015-08-061-4/+4
| | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM) llvm-svn: 244234
* Revert "[sanitizer] Add the flag handle_sigfpe that is default true to ↵Renato Golin2015-08-061-16/+4
| | | | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski" This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline. llvm-svn: 244210
* [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE ↵Kostya Serebryany2015-08-051-4/+16
| | | | | | crashes same as SIGSEV crashes, patch by Karl Skomski llvm-svn: 244136
* [asan] Set abort_on_error=1 by default on OS XKuba Brecka2015-07-281-0/+7
| | | | | | | | This sets the default ASan flags to abort_on_error=1 on OS X. For unit tests and lit tests we set ASAN_OPTIONS back to abort_on_error=0 before running the tests (to avoid crashing). I added two tests that intentionally don't respect the default ASAN_OPTIONS to test the behavior of an empty ASAN_OPTIONS (on OS X we should crash, on Linux we should exit()). Differential Revision: http://reviews.llvm.org/D7203 llvm-svn: 243418
* [asan] Only link liblog on Android when it exists.Evgeniy Stepanov2015-07-241-1/+1
| | | | | | With r242975, liblog is only used on certain older platforms. llvm-svn: 243139
* [asan] Speed up ASan unit tests by turning off symbolicationKuba Brecka2015-07-201-0/+6
| | | | | | | | ASan unit tests don't depend on the symbolizer and they never test its output, but currently they still run it for every crash. This patch simply disables the symbolizer for unit tests, which provides some speed up. On my system (OS X) that's about 1.4x faster, but this could be potentially much more e.g. when using atos on OS X. Differential Revision: http://reviews.llvm.org/D11353 llvm-svn: 242677
* CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Use CMake's cmake_parse_arguments() instead. It's called in a slightly different way, but supports all our use cases. It's in CMake 2.8.8, which is our minimum supported version. CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc): http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments Since I was already changing these calls, I changed ARCH and LIB into ARCHS and LIBS to make it more clear that they're lists of arguments. Reviewers: eugenis, samsonov, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10529 llvm-svn: 240120
* [asan] Fix build of AsanNoinstTest on Android.Evgeniy Stepanov2015-06-081-0/+2
| | | | | | Some of the asan-ubsan build changes were not replicated in the android branch in CMakeLists. llvm-svn: 239320
* Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.Evgeniy Stepanov2015-05-291-0/+1
| | | | | | | | | | | | | | | | | | This is done by creating a named shared memory region, unlinking it and setting up a private (i.e. copy-on-write) mapping of that instead of a regular anonymous mapping. I've experimented with regular (sparse) files, but they can not be scaled to the size of MSan shadow mapping, at least on Linux/X86_64 and ext3 fs. Controlled by a common flag, decorate_proc_maps, disabled by default. This patch has a few shortcomings: * not all mappings are annotated, especially in TSan. * our handling of memset() of shadow via mmap() puts small anonymous mappings inside larger named mappings, which looks ugly and can, in theory, hit the mapping number limit. llvm-svn: 238621
* Disable exceptions for clang-compiled unittest code on WindowsReid Kleckner2015-05-011-0/+5
| | | | llvm-svn: 236357
* [Compiler-rt][MIPS] Fix for asan test suite build on mips64/mips64elMohit K. Bhakkad2015-04-091-2/+4
| | | | | | | Patch by Sagar Thakur Reviewers: dsanders llvm-svn: 234468
* sanitizer: new "strict_string_checks" run-time flagDmitry Vyukov2015-04-061-31/+2
| | | | | | | | | | This patch is related to Issue 346: moar string interceptors: strstr, strcasestr, strcspn, strpbrk As was suggested in original review http://reviews.llvm.org/D6056 a new "strict_string_checks" run-time flag introduced. The flag support applied for existing common, asan, msan and tsan interceptors. New asan tests added. Change by Maria Guseva reviewed in http://reviews.llvm.org/D7123 llvm-svn: 234187
* [UBSan] Embed UBSan into ASan runtime (compiler-rt part).Alexey Samsonov2015-04-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Change the way we use ASan and UBSan together. Instead of keeping two separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on a platform, all UBSan sources are just compiled into dummy empty object files. UBSan initialization code (e.g. flag parsing) is directly called from ASan initialization, so we are able to enforce correct initialization order. This mirrors the approach we already use for ASan+LSan. This change doesn't modify the way we use standalone UBSan. Test Plan: regression test suite Reviewers: kubabrecka, zaks.anna, rsmith, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8646 llvm-svn: 233861
* Move use of __builtin_longjmp under the same conditions as the onlyJoerg Sonnenberger2015-03-051-9/+9
| | | | | | caller of the function. llvm-svn: 231402
* [Sanitizer] Fix/suppress compiler warnings in unit tests.Alexey Samsonov2015-03-041-5/+5
| | | | llvm-svn: 231293
* [asan] Since x32 has 32-bit pointers, it should use the same code sequence ↵Kostya Serebryany2015-03-031-2/+2
| | | | | | as ia32 for AddressSanitizer asm_flags test. Patch by H.J. Lu llvm-svn: 231052
* Fix ASan's Noinst unit testsKuba Brecka2015-02-101-1/+4
| | | | | | | | We currently skip all "Noinst" unit tests on OS X, which was probably caused when we removed the "allow_reexec" flag. The MaybeReexec function fails to re-execute when the runtime is linked statically, because there is no dylib to use. This patch adds an explicit DisableReexec function that is used from asan_noinst_test.cc and the runtime then doesn't try to re-execute. Reviewed at http://reviews.llvm.org/D7493 llvm-svn: 228740
* Enabling testing ASAN on AArch64Renato Golin2015-02-031-1/+2
| | | | | | | | Also, disabling BuiltinLongJmpTest, as it fails for ARM and PPC as well. Patch by Christophe Lyon. llvm-svn: 227966
* [compiler-rt] OS X: Update the CMake and Make builds to explicitely use ↵Kuba Brecka2015-01-291-0/+5
| | | | | | | | libc++, mmacosx-version-min and SDKs In both CMake and Makefiles, we are inconsistent about the use of libstdc++ vs. libc++, SDKs and minimum deployment targets for OS X. Let's fix the detection of SDKs, and let's explicitely set that we link against libc++ and mmacosx-version-min is 10.7. llvm-svn: 227509
* [sanitizer] Flag parser rewrite.Evgeniy Stepanov2015-01-151-1/+2
| | | | | | | 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
* AddressSanitizer: Abort after failed exec() and get rid of the allow_reexec ↵Kuba Brecka2014-12-221-9/+0
| | | | | | | | | | | | | | | | 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
* [Sanitizers] Intercept snprintf_l() on FreeBSDViktor Kutuzov2014-12-221-0/+30
| | | | | | Differential Revision: http://reviews.llvm.org/D6418 llvm-svn: 224700
* [ASan] Always build shared ASan runtime on Linux.Alexey Samsonov2014-12-171-11/+18
| | | | | | | | | | | | | | | | | 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
* Rename asan_allocator2.cc to asan_allocator.ccAlexey Samsonov2014-12-171-1/+1
| | | | llvm-svn: 224396
* [CMake] Detect if -Wfoo is supported instead of -Wno-foo, as GCC ↵Alexey Samsonov2014-11-131-1/+1
| | | | | | occasionally silently discards unknown -Wno-foo flags. llvm-svn: 221925
* delete => delete[] for arrays.Richard Trieu2014-11-121-1/+1
| | | | llvm-svn: 221769
* [ASan] Fix use of -asan-instrument-assembly in testsJay Foad2014-11-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The option -asan-instrument-assembly is declared in the X86 backend. If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=All then the option is tolerated but ignored. If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=PowerPC then the testsuite fails with: [ 93%] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64-inline.o clang (LLVM option parsing): Unknown command line argument '-asan-instrument-assembly'. Try: 'clang (LLVM option parsing) -help' Fix this inconsistency by only adding the option if that toolchain was built with the X86 backend included. Reviewers: kcc, samsonov, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6190 llvm-svn: 221687
* [Sanitizer] Make StackTrace a lightweight reference to array of PCs, andAlexey Samsonov2014-10-261-17/+17
| | | | | | | | | | | | | | | | | | | | | | introduce a BufferedStackTrace class, which owns this array. Summary: This change splits __sanitizer::StackTrace class into a lightweight __sanitizer::StackTrace, which doesn't own array of PCs, and BufferedStackTrace, which owns it. This would allow us to simplify the interface of StackDepot, and eventually merge __sanitizer::StackTrace with __tsan::StackTrace. Test Plan: regression test suite. Reviewers: kcc, dvyukov Reviewed By: dvyukov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5985 llvm-svn: 220635
OpenPOWER on IntegriCloud