summaryrefslogtreecommitdiff
path: root/lib/tsan/tests
AgeCommit message (Collapse)Author
2017-12-04Move __tsan::Vector to __sanitizerKamil Rytarowski
Summary: The low-fat STL-like vector container will be reused in MSan. It is needed to implement an atexit(3) interceptor on NetBSD/amd64 in MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc Reviewed By: dvyukov Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40726 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Add NetBSD improvements in sanitizersKamil Rytarowski
Summary: Changes: * Add initial msan stub support. * Handle NetBSD specific pthread_setname_np(3). * NetBSD supports __attribute__((tls_model("initial-exec"))), define it in SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE. * Add ReExec() specific bits for NetBSD. * Simplify code and add syscall64 and syscall_ptr for !NetBSD. * Correct bunch of syscall wrappers for NetBSD. * Disable test/tsan/map32bit on NetBSD as not applicable. * Port test/tsan/strerror_r to a POSIX-compliant OSes. * Disable __libc_stack_end on NetBSD. * Disable ReadNullSepFileToArray() on NetBSD. * Define struct_ElfW_Phdr_sz, detected missing symbol by msan. * Change type of __sanitizer_FILE from void to char. This helps to reuse this type as an array. Long term it will be properly implemented along with SANITIZER_HAS_STRUCT_FILE setting to 1. * Add initial NetBSD support in lib/tsan/go/buildgo.sh. * Correct referencing stdout and stderr in tsan_interceptors.cc on NetBSD. * Document NetBSD x86_64 specific virtual memory layout in tsan_platform.h. * Port tests/rtl/tsan_test_util_posix.cc to NetBSD. * Enable NetBSD tests in test/msan/lit.cfg. * Enable NetBSD tests in test/tsan/lit.cfg. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc, dvyukov Reviewed By: dvyukov Subscribers: #sanitizers, llvm-commits, kubamracek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39124 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316591 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Disable TSan tests on Android.Evgeniy Stepanov
They never passed. This change excludes them from 'check-all'. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315512 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30Fix for TSan unit-tests:George Karpenkov
Previous refactoring has left unit-tests in a buggy state, where they were not launched at all. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov
into a function. Most CMake configuration under compiler-rt/lib/*/tests have almost-the-same-but-not-quite functions of the form add_X_[unit]tests for compiling and running the tests. Much of the logic is duplicated with minor variations across different sub-folders. This can harm productivity for multiple reasons: For newcomers, resulting CMake files are very large, hard to understand, and hide the intention of the code. Changes for enabling certain architectures end up being unnecessarily large, as they get duplicated across multiple folders. Adding new sub-projects requires more effort than it should, as a developer has to again copy-n-paste the configuration, and it's not even clear from which sub-project it should be copy-n-pasted. With this change the logic of compile-and-generate-a-set-of-tests is extracted into a function, which hopefully makes writing and reading CMake much easier. Differential Revision: https://reviews.llvm.org/D36116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[tsan] Check for pvalloc overlowKostya Kortchinsky
Summary: `CheckForPvallocOverflow` was introduced with D35818 to detect when pvalloc would wrap when rounding up to the next multiple of the page size. Add this check to TSan's pvalloc implementation. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D36245 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizers test CMake] further refactor testing CMake for tsanGeorge Karpenkov
TSan tests on Darwin first link all libraries into a static archive file. With this change, the linking is done once per all architecture, and previously the linking step was repeated per each architecture per each add_tsan_test call. Furthermore, the code is cleared up. Differential Revision: https://reviews.llvm.org/D35913 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309406 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizer tests CMake] Factor out CMake logic for compiling sanitizer testsGeorge Karpenkov
Currently there's a large amount of CMake logic duplication for compiling sanitizer tests. If we add more sanitizers, the duplication will get even worse. This change factors out common compilation commands into a macro available to all sanitizers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24[Sanitizers] TSan allocator set errno on failure.Alex Shlyapnikov
Summary: Set proper errno code on allocation failures and change realloc, pvalloc, aligned_alloc, memalign and posix_memalign implementation to satisfy their man-specified requirements. Modify allocator API implementation to bring it closer to other sanitizers allocators. Reviewers: dvyukov Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D35690 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14tsan: optimize sync clock memory consumptionDmitry Vyukov
This change implements 2 optimizations of sync clocks that reduce memory consumption: Use previously unused first level block space to store clock elements. Currently a clock for 100 threads consumes 3 512-byte blocks: 2 64-bit second level blocks to store clock elements +1 32-bit first level block to store indices to second level blocks Only 8 bytes of the first level block are actually used. With this change such clock consumes only 2 blocks. Share similar clocks differing only by a single clock entry for the current thread. When a thread does several release operations on fresh sync objects without intervening acquire operations in between (e.g. initialization of several fields in ctor), the resulting clocks differ only by a single entry for the current thread. This change reuses a single clock for such release operations. The current thread time (which is different for different clocks) is stored in dirty entries. We are experiencing issues with a large program that eats all 64M clock blocks (32GB of non-flushable memory) and crashes with dense allocator overflow. Max number of threads in the program is ~170 which is currently quite unfortunate (consume 4 blocks per clock). Currently it crashes after consuming 60+ GB of memory. The first optimization brings clock block consumption down to ~40M and allows the program to work. The second optimization further reduces block consumption to "modest" 16M blocks (~8GB of RAM) and reduces overall RAM consumption to ~30GB. Measurements on another real world C++ RPC benchmark show RSS reduction from 3.491G to 3.186G and a modest speedup of ~5%. Go parallel client/server HTTP benchmark: https://github.com/golang/benchmarks/blob/master/http/http.go shows RSS reduction from 320MB to 240MB and a few percent speedup. Reviewed in https://reviews.llvm.org/D35323 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12tsan: prepare clock for future changesDmitry Vyukov
Pass ClockCache to ThreadClock::set and introduce ThreadCache::ResetCached. For now both are unused, but will reduce future diffs. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12tsan: add another test for clock growthDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10[tsan] Add a mapping for Darwin/AArch64Kuba Mracek
This patch defines the TSan memory map and offsets for Darwin on AArch64. Differential Revision: https://reviews.llvm.org/D35147 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307544 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[tsan] Add missing include directory for test unittestsFrancis Ricci
Summary: Required to fix standalone builds in some configurations Reviewers: kubamracek, zaks.anna Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D34631 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01[powerpc] deactivate flakey tests on powerpc64leBill Seurer
These test cases occassionally fail when run on powerpc64le: ignore_lib1.cc ignore_lib5.cc TestCases/Posix/current_allocated_bytes.cc rtl/TsanRtlTest/Posix.ThreadLocalAccesses TestCases/Posix/coverage-fork-direct.cc The failures cause false problem reports to be sent to developers whose code had nothing to do with the failures. Reactivate them when the real problems are fixed. This could also be related to the same problems as with the tests ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, ManyThreadsTest, and several others that do not run reliably on powerpc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky
This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12[sancov] moving sancov rt to sancov/ directoryMike Aizatsky
Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10Make cmake link flag naming consistentFrancis Ricci
Summary: The build system was inconsistent in its naming conventions for link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS, for consistency with cmake's LINK_FLAGS property. This patch should make it easier to search the source code for uses of link flags, as well as providing the benefit of improved style and consistency. Reviewers: compnerd, beanz Subscribers: kubabrecka, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28506 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09Enable weak hooks on darwinFrancis Ricci
Summary: By default, darwin requires a definition for weak interface functions at link time. Adding the '-U' link flag with each weak function allows these weak interface functions to be used without definitions, which mirrors behavior on linux and windows. Reviewers: compnerd, eugenis Subscribers: kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D28203 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27[tsan] Fix string to bool conversion warnings in tsan testsVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15[tsan] Call pthread interceptors directly in TSan RTL unit testsKuba Brecka
On Darwin, we're running the TSan unit tests without interceptors. To make sure TSan observes all the pthread events (thread creating, thread join, condvar signal, etc.) in tsan_posix.cc, we should call the pthread interceptors directly, as we already do in tsan_test_util_posix.cc. This fixes some flaky failures on Darwin bots. Differential Revision: https://reviews.llvm.org/D26639 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287026 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-26[sanitizers] Set Darwin specific linker and compiler flags for all testsAnna Zaks
Looks like we are missing these flags only in tsan and sanitizer-common. This results in linker warnings in some settings as it can cause the Unit tests to be built with a different SDK version than that was used to build the runtime. For example, we are not setting the minimal deployment target on the tests but are setting the minimal deployment target for the sanitizer library, which leads to the following warning on some bots: ld: warning: object file (sanitizer_posix_test.cc.i386.o) was built for newer OSX version (10.12) than being linked (10.11). Differential Revision: https://reviews.llvm.org/D25860 https://reviews.llvm.org/D25352 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285255 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02Follow-up for r277458: Update the tsan_mman_test.cc unit test.Kuba Brecka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27tsan: don't create sync objects on acquireDmitry Vyukov
Creating sync objects on acquire is pointless: acquire of a just created sync object if a no-op. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: change tsan/Go interface for obtaining the current ProcessorDmitry Vyukov
Current interface assumes that Go calls ProcWire/ProcUnwire to establish the association between thread and proc. With the wisdom of hindsight, this interface does not work very well. I had to sprinkle Go scheduler with wire/unwire calls, and any mistake leads to hard to debug crashes. This is not something one wants to maintian. Fortunately, there is a simpler solution. We can ask Go runtime as to what is the current Processor, and that question is very easy to answer on Go side. Switch to such interface. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: split thread into logical and physical stateDmitry Vyukov
This is reincarnation of http://reviews.llvm.org/D17648 with the bug fix pointed out by Adhemerval (zatrazz). Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible) and physical state (various caches, most notably malloc cache). Move physical state in a new Process entity. Besides just being the right thing from abstraction point of view, this solves several problems: Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels. This unnecessary increases memory consumption. Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context. As the result we could not do anything more than just clearing shadow. For example, we leaked sync objects and heap block descriptors. This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache). This in turn will allow to get rid of dependency on libc entirely. Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will reduce resource consumption. The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread, which is equivalent to the current scheme. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17[sanitizer] On OS X, verify that interceptors work and abort if not, take 2Kuba Brecka
On OS X 10.11+, we have "automatic interceptors", so we don't need to use DYLD_INSERT_LIBRARIES when launching instrumented programs. However, non-instrumented programs that load TSan late (e.g. via dlopen) are currently broken, as TSan will still try to initialize, but the program will crash/hang at random places (because the interceptors don't work). This patch adds an explicit check that interceptors are working, and if not, it aborts and prints out an error message suggesting to explicitly use DYLD_INSERT_LIBRARIES. TSan unit tests run with a statically linked runtime, where interceptors don't work. To avoid aborting the process in this case, the patch replaces `DisableReexec()` with a weak `ReexecDisabled()` function which is defined to return true in unit tests. Differential Revision: http://reviews.llvm.org/D18212 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26tsan: revert r262037Dmitry Vyukov
Broke aarch64 and darwin bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262046 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26tsan: split thread into logical and physical stateDmitry Vyukov
Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible) and physical state (various caches, most notably malloc cache). Move physical state in a new Process entity. Besides just being the right thing from abstraction point of view, this solves several problems: 1. Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels. This unnecessary increases memory consumption. 2. Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context. As the result we could not do anything more than just clearing shadow. For example, we leaked sync objects and heap block descriptors. 3. This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache). This in turn will allow to get rid of dependency on libc entirely. 4. Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will reduce resource consumption. The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread, which is equivalent to the current scheme. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262037 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg
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) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compilingSumanth Gundapaneni
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257686 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24[tsan] Fix CallocOverflow unit test on OS XKuba Brecka
On OS X, interceptors don't work in unit tests, so calloc() calls the system allocator. We need to use user_calloc() instead. Differential Revision: http://reviews.llvm.org/D14918 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21[tsan] Fix detached threads in unit tests on OS XKuba Brecka
We need to call the intercepted version of pthread_detach. Secondly, PTHREAD_CREATE_JOINABLE and PTHREAD_CREATE_DETACHED are not 0 and 1 on OS X, so we need to properly pass these constants and not just a bool. Differential Revision: http://reviews.llvm.org/D14837 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21[tsan] Make tsan_test_util_posix.cc call pthread interceptors on OS XKuba Brecka
The tsan_test_util_posix.cc implementation of mutexes call pthread APIs directly, which on OS X don't end up calling the intercepted versions and we miss the synchronization. This patch changes the unit tests to directly call the intercepted versions. This fixes several test failures on OS X. Differential Revision: http://reviews.llvm.org/D14835 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19[tsan] Replace new/delete with a local variable in ThreadSpecificDtors unit testKuba Brecka
On OS X, this unit test (ThreadSpecificDtors) fails, because the new and delete operators actually call the overridden operators, which end up using TLVs and crash. Since C++'s new and delete is not important in this test, let's just replace them with a local variable. This fixes the test on OS X. Differential Revision: http://reviews.llvm.org/D14826 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13[tsan] Fix a typo in tsan_test_util.hKuba Brecka
There is a typo in tsan_test_util.h, it shouldn't be `APPLE`, but `__APPLE__`. Differential Revision: http://reviews.llvm.org/D14647 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12[tsan] Filter OS X architectures for unit testingKuba Brecka
The TSan unit test build currently fails if we're also building the iOS parts of compiler-rt, because `TSAN_SUPPORTED_ARCH` contains ARM64. For unit tests, we need to filter this only to host architecture(s). Differential Revision: http://reviews.llvm.org/D14604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252873 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11[tsan] Rename tsan_test_util_linux.cc to tsan_test_util_posix.ccKuba Brecka
Differential Revision: http://reviews.llvm.org/D14575 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252741 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11[tsan] Add TSan unit test support for OS XKuba Brecka
This patch enables building and running TSan unit tests on OS X. Differential Revision: http://reviews.llvm.org/D14546 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21[Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245734 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05[tsan] Enable tsan for aarch64Adhemerval Zanella
This patch enabled TSAN for aarch64 with 39-bit VMA layout. As defined by tsan_platform.h the layout used is: 0000 4000 00 - 0200 0000 00: main binary 2000 0000 00 - 4000 0000 00: shadow memory 4000 0000 00 - 5000 0000 00: metainfo 5000 0000 00 - 6000 0000 00: - 6000 0000 00 - 6200 0000 00: traces 6200 0000 00 - 7d00 0000 00: - 7d00 0000 00 - 7e00 0000 00: heap 7e00 0000 00 - 7fff ffff ff: modules and main thread stack Which gives it about 8GB for main binary, 4GB for heap and 8GB for modules and main thread stack. Most of tests are passing, with the exception of: * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for no support to make mmap page non-executable. * longjmp tests due missing specialized assembly routines. These tests are xfail for now. The only tsan issue still showing is: rtl/TsanRtlTest/Posix.ThreadLocalAccesses Which still required further investigation. The test is disable for aarch64 for now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20[TSan][MIPS] Adding support for MIPS64Mohit K. Bhakkad
Patch by Sagar Thakur Reviewers: dvyukov, samsonov, petarj, kcc, dsanders. Subscribers: mohit.bhakkad, Anand.Takale, llvm-commits. Differential Revision: http://reviews.llvm.org/D6291 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30[TSan] Fix -Werror=sign-compare warning. NFC.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19tsan: remove TSAN_SHADOW_COUNTDmitry Vyukov
TSAN_SHADOW_COUNT is defined to 4 in all environments. Other values of TSAN_SHADOW_COUNT were never tested and were broken by recent changes to shadow mapping. Remove it as there is no reason to fix nor maintain it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06[Sanitizer] Improve unit tests in COMPILER_RT_DEBUG=ON mode.Alexey Samsonov
Propagate -DSANITIZER_DEBUG definition to unit tests. Make sure unit tests depend on compiler-rt headers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-03Remove TSAN_DEBUG in favor of SANITIZER_DEBUG.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225111 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03[TSan] Use StackTrace from sanitizer_common where applicableAlexey Samsonov
Summary: This change removes `__tsan::StackTrace` class. There are now three alternatives: # Lightweight `__sanitizer::StackTrace`, which doesn't own a buffer of PCs. It is used in functions that need stack traces in read-only mode, and helps to prevent unnecessary allocations/copies (e.g. for StackTraces fetched from StackDepot). # `__sanitizer::BufferedStackTrace`, which stores buffer of PCs in a constant array. It is used in TraceHeader (non-Go version) # `__tsan::VarSizeStackTrace`, which owns buffer of PCs, dynamically allocated via TSan internal allocator. Test Plan: compiler-rt test suite Reviewers: dvyukov, kcc Reviewed By: kcc Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D6004 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221194 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03[TSan] Fix signed-compare warning in the unit testAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221190 91177308-0d34-0410-b5e6-96231b3b80d8