summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan
Commit message (Collapse)AuthorAgeFilesLines
...
* [tsan] Add interceptor for xpc_connection_cancel to avoid false positivesKuba Mracek2017-03-301-0/+37
| | | | | | | | TSan reports a false positive when using xpc_connection_cancel. We're missing a happens-before edge from xpc_connection_cancel to the event handler on the same connection. Differential Revision: https://reviews.llvm.org/D31475 llvm-svn: 299086
* Add --std=c++11 to tests that #include <atomic>Sam McCall2017-03-273-3/+3
| | | | llvm-svn: 298836
* [tsan] Only Acquire/Release GCD queues if they're not NULLKuba Mracek2017-03-261-0/+23
| | | | | | | | While it's usually a bug to call GCD APIs, such as dispatch_after, with NULL as a queue, this often "somehow" works and TSan should maintain binary compatibility with existing code. This patch makes sure we don't try to call Acquire and Release on NULL queues, and add one such testcase for dispatch_after. Differential Revision: https://reviews.llvm.org/D31355 llvm-svn: 298820
* tsan: add new mutex annotationsDmitry Vyukov2017-03-264-0/+195
| | | | | | | | | | | | | | There are several problems with the current annotations (AnnotateRWLockCreate and friends): - they don't fully support deadlock detection (we need a hook _before_ mutex lock) - they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock) - they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on) - they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes) - they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments. Reviewed in https://reviews.llvm.org/D31093 llvm-svn: 298809
* Update debug_external.cc testcase to use TSan-invisible barriers to reduce ↵Kuba Mracek2017-03-241-0/+5
| | | | | | flakiness. llvm-svn: 298707
* Update the Darwin/external.cc testcase to use rpath. This means we can move ↵Kuba Mracek2017-03-241-3/+12
| | | | | | the test output executables and still be able to run them. llvm-svn: 298682
* tsan: fix pie_no_aslr testDmitry Vyukov2017-03-211-0/+1
| | | | | | | It failed on clang-cmake-aarch64-39vma. Restrict it to x86_64 only. llvm-svn: 298383
* tsan: support __ATOMIC_HLE_ACQUIRE/RELEASE flagsDmitry Vyukov2017-03-211-0/+25
| | | | | | | | | | | HLE flags can be combined with memory order in atomic operations. Currently tsan runtime crashes on e.g. IsStoreOrder(mo) in atomic store if any of these additional flags are specified. Filter these flags out. See the comment as to why it is safe. llvm-svn: 298378
* tsan: add test for pie/no aslrDmitry Vyukov2017-03-211-0/+5
| | | | | | Just ensure that such combination works. llvm-svn: 298372
* Re-commit of r295318, which was reverted due to AArch64 flakiness. Moving ↵Kuba Mracek2017-02-221-0/+61
| | | | | | the test to Darwin only. llvm-svn: 295801
* Revert "[tsan] Provide external tags (object types) via debugging API"Diana Picus2017-02-201-61/+0
| | | | | | This reverts commit r295318 as the test is flaky on AArch64. llvm-svn: 295667
* [tsan] Provide external tags (object types) via debugging APIKuba Mracek2017-02-161-0/+61
| | | | | | | | In D28836, we added a way to tag heap objects and thus provide object types into report. This patch exposes this information into the debugging API. Differential Revision: https://reviews.llvm.org/D30023 llvm-svn: 295318
* Fixup for r293885: Update external.cc testcase to include the forgotten ↵Kuba Mracek2017-02-131-0/+1
| | | | | | stdlib.h. llvm-svn: 295002
* [powerpc] deactivate user_malloc.cc tsan test on powerpc64leBill Seurer2017-02-021-0/+1
| | | | | | | | This test fails consistently on Ubuntu 16.xx powerpc64 LE systems. The cause is being investigated and in the meantime disable it so the buildbots can run cleanly. llvm-svn: 293939
* [tsan] Provide API for libraries for race detection on custom objectsKuba Mracek2017-02-021-0/+153
| | | | | | | | This patch allows a non-instrumented library to call into TSan runtime, and tell us about "readonly" and "modifying" accesses to an arbitrary "object" and provide the caller and tag (type of object). This allows TSan to detect violations of API threading contracts where "read-only" methods can be called simulatenously from multiple threads, while modifying methods must be exclusive. Differential Revision: https://reviews.llvm.org/D28836 llvm-svn: 293885
* [tsan] Properly describe GCD worker threads in reportsKuba Mracek2017-02-021-0/+43
| | | | | | | | When dealing with GCD worker threads, TSan currently prints weird things like "created by thread T-1" and "[failed to restore the stack]" in reports. This patch avoids that and instead prints "Thread T3 (...) is a GCD worker thread". Differential Revision: https://reviews.llvm.org/D29103 llvm-svn: 293882
* [tsan] Fix os_id of main threadKuba Mracek2017-01-261-0/+46
| | | | | | | | Currently, os_id of the main thread contains the PID instead of a thread ID. Let's fix this. Differential Revision: https://reviews.llvm.org/D29106 llvm-svn: 293201
* [tsan] Enable ignore_noninstrumented_modules=1 on Darwin by defaultKuba Mracek2017-01-2450-52/+65
| | | | | | | | TSan recently got the "ignore_noninstrumented_modules" flag, which disables tracking of read and writes that come from noninstrumented modules (via interceptors). This is a way of suppressing false positives coming from system libraries and other noninstrumented code. This patch turns this on by default on Darwin, where it's supposed to replace the previous solution, "ignore_interceptors_accesses", which disables tracking in *all* interceptors. The new approach should re-enable TSan's ability to find races via interceptors on Darwin. Differential Revision: https://reviews.llvm.org/D29041 llvm-svn: 292981
* [lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]Kuba Mracek2017-01-202-0/+6
| | | | | | | | | | Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests. This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests. Differential Revision: https://reviews.llvm.org/D28420 llvm-svn: 292549
* Revert r292232.Kuba Mracek2017-01-172-6/+0
| | | | llvm-svn: 292236
* [lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part]Kuba Mracek2017-01-172-0/+6
| | | | | | | | | | Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests. This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests. Differential Revision: https://reviews.llvm.org/D28420 llvm-svn: 292232
* [tsan] Implement a 'ignore_noninstrumented_modules' flag to better suppress ↵Kuba Mracek2017-01-111-0/+53
| | | | | | | | | | | | | | false positive races On Darwin, we currently use 'ignore_interceptors_accesses', which is a heavy-weight solution that simply turns of race detection in all interceptors. This was done to suppress false positives coming from system libraries (non-instrumented code), but it also silences a lot of real races. This patch implements an alternative approach that should allow us to enable interceptors and report races coming from them, but only if they are called directly from instrumented code. The patch matches the caller PC in each interceptors. For non-instrumented code, we call ThreadIgnoreBegin. The assumption here is that the number of instrumented modules is low. Most likely there's only one (the instrumented main executable) and all the other modules are system libraries (non-instrumented). Differential Revision: https://reviews.llvm.org/D28264 llvm-svn: 291631
* [sanitizer] Use architecture/slice information when symbolizing fat Mach-O ↵Kuba Mracek2017-01-061-6/+6
| | | | | | | | | | files on Darwin This patch starts passing architecture information about a module to llvm-symbolizer and into text reports. This fixes the longstanding x86_64/x86_64h mismatch issue on Darwin. Differential Revision: https://reviews.llvm.org/D27390 llvm-svn: 291287
* Make this REQUIRES match the other REQUIRES lines that mention requiringChandler Carruth2016-12-201-1/+1
| | | | | | a darwin system. llvm-svn: 290152
* Fixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure ↵Kuba Mracek2016-12-191-0/+3
| | | | | | out how to make it work on Linux. llvm-svn: 290129
* More fixup for r290119: Make the ifdef work.Kuba Mracek2016-12-191-2/+2
| | | | llvm-svn: 290126
* Another fix-up for r290119: Include stdint.h so we have uint64_t on Linux.Kuba Mracek2016-12-191-0/+1
| | | | llvm-svn: 290124
* Fix-up for r290119 - don't check global size, it might not be available when ↵Kuba Mracek2016-12-191-1/+1
| | | | | | using atos llvm-svn: 290123
* [tsan] Implement __tsan_get_alloc_stack and __tsan_locate_address to query ↵Kuba Mracek2016-12-192-0/+123
| | | | | | | | | | pointer types and allocation stacks of heap pointers In ASan, we have __asan_locate_address and __asan_get_alloc_stack, which is used in LLDB/Xcode to show the allocation backtrace for a heap memory object. This patch implements the same for TSan. Differential Revision: https://reviews.llvm.org/D27656 llvm-svn: 290119
* Follow-up for r289831: Lower the unjoined thread count to 100 in the ↵Kuba Mracek2016-12-161-1/+1
| | | | | | | | libcxx-future.mm testcase. Turns out 1000 unjoined threads are a bit too rough in certain environments. llvm-svn: 289971
* [tsan] Add interceptor for libcxx __shared_count::__release_shared()Kuba Mracek2016-12-151-0/+30
| | | | | | | | We already have an interceptor for __shared_weak_count::__release_shared, this patch handles __shared_count::__release_shared in the same way. This should get rid of TSan false positives when using std::future. Differential Revision: https://reviews.llvm.org/D27797 llvm-svn: 289831
* tsan: allow Java VM iterate over allocated objectsDmitry Vyukov2016-12-141-0/+1
| | | | | | | | | | | | Objects may move during the garbage collection, and JVM needs to notify ThreadAnalyzer about that. The new function __tsan_java_find eliminates the need to maintain these objects both in ThreadAnalyzer and JVM. Author: Alexander Smundak (asmundak) Reviewed in https://reviews.llvm.org/D27720 llvm-svn: 289682
* [sanitizer] Add macOS minimum deployment target to all compiler invocations ↵Kuba Mracek2016-11-291-9/+1
| | | | | | | | | | in lit tests The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden). Differential Revision: https://reviews.llvm.org/D26929 llvm-svn: 288186
* [tsan] Fix the lit expansion of %deflake not to eat a spaceKuba Mracek2016-11-261-1/+1
| | | | | | | | The lit expansion of "%deflake " (notice the space after) expands in a way that the space is removed, this fixes that. Differential Revision: https://reviews.llvm.org/D27139 llvm-svn: 287989
* [tsan] Add support for GCD dispatch_suspend and dispatch_resumeKuba Mracek2016-11-241-0/+45
| | | | | | | | GCD queues can be suspended and resumed with dispatch_suspend and dispatch_resume. We need to add synchronization between the call to dispatch_resume and any subsequent executions of blocks in the queue that was resumed. We already have an Acquire(q) before the block executes, so this patch just adds the Release(q) in an interceptor of dispatch_resume. Differential Revision: https://reviews.llvm.org/D27112 llvm-svn: 287902
* [test] Use a helper macro to refer to MAP_ANON (NFC)Vedant Kumar2016-11-231-2/+8
| | | | | | | Some of our internal bots use old SDK's which don't define MAP_ANON. Use a helper macro to pass the right flag into mmap(). llvm-svn: 287833
* tsan: fix build after 287632Dmitry Vyukov2016-11-221-0/+4
| | | | | | | | | | 1. Mac does not have MAP_32BIT. Define it to 0 if it is not defined. 2. We are lacking nolibc stub for ListOfModules::init. Add it. llvm-svn: 287634
* tsan: switch libignore from /proc/self/maps to dl_iterate_phdrDmitry Vyukov2016-11-222-0/+67
| | | | | | | | | | /proc/self/maps can't be read atomically, this leads to episodic crashes in libignore as it thinks that a module is loaded twice. See the new test for an example. dl_iterate_phdr does not have this problem. Switch libignore to dl_iterate_phdr. llvm-svn: 287632
* [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit ↵Kuba Brecka2016-11-142-0/+186
| | | | | | | | | | during unwinding), compiler-rt part This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed. Differential Revision: https://reviews.llvm.org/D26177 llvm-svn: 286894
* Temporarily relax test expectations to fix failures on ppc64.Evgeniy Stepanov2016-11-141-2/+0
| | | | | | | | | | | | | | Summary: Relax test expectations to fix failures on ppc64. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D26629 llvm-svn: 286885
* [lsan] [aarch64] Fix printing of pointers in make check tests - updateStrahinja Petrovic2016-11-142-19/+5
| | | | | | | | | This patch replaces fprintf with print_address function in LSAN tests. This is necessary because of different printing of pointers in fprintf and sanitizer's print function. Differential Revision: https://reviews.llvm.org/D26084. llvm-svn: 286816
* [tsan] Test that false races from ObjC's dealloc, .cxx_destruct, and ↵Anna Zaks2016-11-121-0/+113
| | | | | | | | initialize are ignored Differential Revision: https://reviews.llvm.org/D26228 llvm-svn: 286693
* [tsan] Fix typo in test.Evgeniy Stepanov2016-11-111-1/+1
| | | | llvm-svn: 286674
* Tread TSan LLVM flags to driver: unit tests.Evgeniy Stepanov2016-11-113-13/+56
| | | | | | | | | | | | | | Summary: Unit tests for the new clang flags. Reviewers: eugenis, dvyukov Subscribers: kubabrecka, llvm-commits Patch by Alex Shlyapnikov. Differential Revision: https://reviews.llvm.org/D26462 llvm-svn: 286670
* tsan: more precise handling of atomic storesDmitry Vyukov2016-11-081-0/+49
| | | | | | | | | Atomic stores terminate release sequences on the atomic variable, and must use ReleaseStore primitive instead of Release. This was broken in r192355 during a refactoring. Restore correct behavior and add a test. llvm-svn: 286211
* [tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments ↵Kuba Brecka2016-11-071-1/+1
| | | | | | don't have nullptr. llvm-svn: 286166
* [tsan] Cast floating-point types correctly when instrumenting atomic ↵Kuba Brecka2016-11-071-0/+21
| | | | | | | | | | accesses, compiler-rt part Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this. Differential Revision: https://reviews.llvm.org/D26266 llvm-svn: 286136
* [tsan] Enable the tsan/libcxx/ testcase(s) on DarwinKuba Brecka2016-10-311-1/+3
| | | | | | | | Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it. Differential Revision: https://reviews.llvm.org/D26162 llvm-svn: 285634
* [tsan] Add support for GCD target queuesKuba Brecka2016-10-311-0/+41
| | | | | | | | | | GCD (libdispatch) has a concept of “target queues”: Each queue has either an implicit or explicit target queue, where the task is handed over to when it’s time to execute it. For example, a concurrent queue can have a serial target queue (effectively making the first queue serial), or multiple queues can have the same serial target queue (which means tasks in all the queues are mutually excluded). Thus we need to acquire-release semantics on the full “chain” of target queues. This patch changes the way we Acquire() and Release() when executing tasks in queues. Now we’ll walk the chain of target queues and synchronize on each queue that is serial (or when dealing with a barrier block). This should avoid false positives when using dispatch_set_target_queue(). Differential Revision: https://reviews.llvm.org/D25835 llvm-svn: 285613
* [tsan] Always use -std=c++11 in TSan testsKuba Brecka2016-10-181-3/+2
| | | | | | | | We currently only pass -std=c++11 when we have an instrumented libcxx. Differential Revision: https://reviews.llvm.org/D25740 llvm-svn: 284512
OpenPOWER on IntegriCloud