summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan
Commit message (Collapse)AuthorAgeFilesLines
* [tsan] Return 0 from malloc_size for non-malloc'd pointersKuba Brecka2016-04-301-11/+43
| | | | | | | | In http://reviews.llvm.org/D19100, I introduced a bug: On OS X, existing programs rely on malloc_size() to detect whether a pointer comes from heap memory (malloc_size returns non-zero) or not. We have to distinguish between a zero-sized allocation (where we need to return 1 from malloc_size, due to other binary compatibility reasons, see http://reviews.llvm.org/D19100), and pointers that are not returned from malloc at all. Differential Revision: http://reviews.llvm.org/D19653 llvm-svn: 268157
* [tsan] Rename ReportThread->pid to ReportThread->os_idKuba Brecka2016-04-211-4/+4
| | | | | | | | The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it. Differential Revision: http://reviews.llvm.org/D19365 llvm-svn: 266994
* [compiler-rt] Remove unwanted --check-prefix=CHECK from unit tests. NFC.Mandeep Singh Grang2016-04-191-1/+1
| | | | | | | | | | | | | | | Summary: Removed unwanted --check-prefix=CHECK from the following unit tests: test/asan/TestCases/Posix/start-deactivated.cc test/tsan/Darwin/ignored-interceptors.mm Patch by: Mandeep Singh Grang (mgrang) Reviewers: samsonov, kcc, dvyukov, eugenis Differential Revision: http://reviews.llvm.org/D19281 llvm-svn: 266813
* Replace hardcoded comment at 'lit.site.cfg.in'Alex Denisov2016-04-162-4/+2
| | | | | | | | | | | | At the moment almost every lit.site.cfg.in contains two lines comment: ## Autogenerated by LLVM/Clang configuration. # Do not edit! The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from configure_lit_site_cfg with the note and some useful information. llvm-svn: 266520
* [TSAN] Make tsan tests more portable (take 3)Renato Golin2016-04-1551-73/+73
| | | | | | | | Some tests didn't merge stderr with stdout. Patch by Maxim Kuvyrkov. llvm-svn: 266426
* Revert "Make tsan tests more portable (take 2)"Renato Golin2016-04-1451-63/+63
| | | | | | This reverts commit r266294, as it broke some buildbots again. :/ llvm-svn: 266300
* Make tsan tests more portable (take 2)Renato Golin2016-04-1451-63/+63
| | | | | | | | | Using stderr more uniformily, avoiding potential races when scanning stdout and stderr output. Patch by Maxim Kuvyrkov. llvm-svn: 266294
* [tsan] Fix size reporting for OS X zone allocator with 0-sized allocationsKuba Brecka2016-04-141-0/+23
| | | | | | | | The custom zone implementation for OS X must not return 0 (even for 0-sized allocations). Returning 0 indicates that the pointer doesn't belong to the zone. This can break existing applications. The underlaying allocator allocates 1 byte for 0-sized allocations anyway, so returning 1 in this case is okay. Differential Revision: http://reviews.llvm.org/D19100 llvm-svn: 266283
* [tsan] Replace 'not' with '%deflake' in gcd-apply-race.mm Darwin test.Kuba Brecka2016-04-111-1/+1
| | | | llvm-svn: 265919
* [tsan] Remove long sleeps from fork testsKuba Brecka2016-04-072-10/+2
| | | | | | | | On one of our testing machines, we're running the tests under heavy load, and especially in the fork-based TSan tests, we're seeing timeouts when a test uses sleep(10), assuming that calling fork() on another thread will finish sooner than that. This patch removes a timeout and makes another one longer. Differential Revision: http://reviews.llvm.org/D18476 llvm-svn: 265666
* [tsan] Add support for OS X OSAtomic* functionsKuba Brecka2016-04-072-0/+91
| | | | | | | | OS X provides atomic functions in libkern/OSAtomic.h. These provide atomic guarantees and they have alternatives which have barrier semantics. This patch adds proper TSan support for the functions from libkern/OSAtomic.h. Differential Revision: http://reviews.llvm.org/D18500 llvm-svn: 265665
* [tsan] Add interceptors for dispatch_applyKuba Brecka2016-04-072-0/+70
| | | | | | | | Adding an interceptor with two more release+acquire pairs to avoid false positives with dispatch_apply. Differential Revision: http://reviews.llvm.org/D18722 llvm-svn: 265662
* [tsan] Add XPC support (OS X)Kuba Brecka2016-04-072-0/+153
| | | | | | | | XPC APIs have async callbacks, and we need some more happen-before edges to avoid false positives. This patch add them, plus a test case (sorry for the long boilerplate code, but XPC just needs all that). Differential Revision: http://reviews.llvm.org/D18493 llvm-svn: 265661
* [tsan] Add support for dispatch event sourcesKuba Brecka2016-04-076-0/+214
| | | | | | | | GCD has APIs for event sources, we need some more release-acquire pairs to avoid false positives in TSan. Differential Revision: http://reviews.llvm.org/D18515 llvm-svn: 265660
* [tsan] Fix synchronization in dispatch_syncKuba Brecka2016-04-071-0/+34
| | | | | | | | In the interceptor for dispatch_sync, we're currently missing synchronization between the callback and the code *after* the call to dispatch_sync. This patch fixes this by adding an extra release+acquire pair to dispatch_sync() and similar APIs. Added a testcase. Differential Revision: http://reviews.llvm.org/D18502 llvm-svn: 265659
* [tsan] Fix Darwin tests (missing FileCheck's)Kuba Brecka2016-04-0711-16/+16
| | | | | | | | A little embarrassing, but we're missing the call to FileCheck in several Darwin tests. Let's fix this. Differential Revision: http://reviews.llvm.org/D18503 llvm-svn: 265658
* [asan,tsan] Make Darwin-specific tests more stable (use ↵Kuba Brecka2016-04-0411-17/+16
| | | | | | ignore_interceptors_accesses=1 for GCD tests and printf instead of NSLog). llvm-svn: 265300
* [tsan] Fix a crash when exiting the main thread (e.g. dispatch_main)Kuba Brecka2016-03-281-0/+38
| | | | | | | | This patch fixes the custom ThreadState destruction on OS X to avoid crashing when dispatch_main calls pthread_exit which quits the main thread. Differential Revision: http://reviews.llvm.org/D18496 llvm-svn: 264627
* Fix-up for OS X test failure after r264451 ("Add memset, memmove, and memcpy ↵Kuba Brecka2016-03-281-1/+1
| | | | | | to the common interceptors") llvm-svn: 264571
* Follow-up for r264261, adding a comment explaining what the testcase does.Kuba Brecka2016-03-241-0/+5
| | | | llvm-svn: 264271
* [tsan] Fix fork() and fork-based tests for OS XKuba Brecka2016-03-245-5/+0
| | | | | | | | On OS X, fork() under TSan asserts (in debug builds only) because REAL(fork) calls some intercepted functions, which check that no internal locks are held via CheckNoLocks(). But the wrapper of fork intentionally holds some locks. This patch fixes that by using ScopedIgnoreInterceptors during the call to REAL(fork). After that, all the fork-based tests seem to pass on OS X, so let's just remove all the UNSUPPORTED: darwin annotations we have. Differential Revision: http://reviews.llvm.org/D18409 llvm-svn: 264261
* [tsan] Use direct syscalls for internal_mmap and internal_munmap on OS XKuba Brecka2016-03-241-0/+19
| | | | | | | | On OS X, internal_mmap just uses mmap, which can invoke callbacks into libmalloc (e.g. when MallocStackLogging is enabled). This can subsequently call other intercepted functions, and this breaks our Darwin-specific ThreadState initialization. Let's use direct syscalls in internal_mmap and internal_munmap. Added a testcase. Differential Revision: http://reviews.llvm.org/D18431 llvm-svn: 264259
* [tsan] Change nullptr to NULL in one Darwin test.Kuba Brecka2016-03-221-1/+1
| | | | | | Depending on the version of libcxx, nullptr might not be available. Let's use NULL instead. llvm-svn: 264058
* [tsan] Adding a test case for r263939 ("Add some NULL pointer checks into ↵Kuba Brecka2016-03-211-0/+20
| | | | | | the debugging API") llvm-svn: 263946
* [TSAN] Fix build bot failure for powerpc64leSagar Thakur2016-03-181-3/+0
| | | | | | race_on_mutex.c passes for powerpc64le too after revision 263778. So removing the XFAIL marker. llvm-svn: 263779
* [TSAN] Relax the expected output of race_on_mutex.cSagar Thakur2016-03-181-7/+3
| | | | | | | | | | | | | | | | | | | The stack trace produced by TSan on MIPS is: Previous write of size 8 at 0x0120ed2930 by thread T1: #0 memset /home/slt/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:678 (race_on_mutex.c.tmp+0x0120071808) #1 __GI___pthread_mutex_init /build/glibc-g99ldr/glibc-2.19/nptl/pthread_mutex_init.c:84 (libpthread.so.0+0x000000d634) #2 <null> /home/slt/LLVM/llvm/projects/compiler-rt/test/tsan/race_on_mutex.c:11 (race_on_mutex.c.tmp+0x01200ea59c) Reviewers: samsonov, dvyukov Subscribers: llvm-commits, mohit.bhakkad, jaydeep Differential: http://reviews.llvm.org/D17796 llvm-svn: 263778
* [sanitizer] On OS X, verify that interceptors work and abort if not, take 2Kuba Brecka2016-03-171-0/+41
| | | | | | | | | | 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 llvm-svn: 263695
* [tsan] Detect uses of uninitialized, destroyed and invalid mutexesKuba Brecka2016-03-161-0/+25
| | | | | | | | This patch adds a new TSan report type, ReportTypeMutexInvalidAccess, which is triggered when pthread_mutex_lock or pthread_mutex_unlock returns EINVAL (this means the mutex is invalid, uninitialized or already destroyed). Differential Revision: http://reviews.llvm.org/D18132 llvm-svn: 263641
* Revert r263551 due to a test failure.Kuba Brecka2016-03-151-41/+0
| | | | llvm-svn: 263553
* [sanitizer] On OS X, verify that interceptors work and abort if notKuba Brecka2016-03-151-0/+41
| | | | | | | | 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. Differential Revision: http://reviews.llvm.org/D18121 llvm-svn: 263551
* Follow-up fix for r263126. Apparently `printf("%p", NULL)` can output 0x0, ↵Kuba Brecka2016-03-101-2/+2
| | | | | | (nil) or (null) on different platforms. llvm-svn: 263137
* [tsan] Add TSan debugger APIsKuba Brecka2016-03-101-0/+88
| | | | | | | | Currently, TSan only reports everything in a formatted textual form. The idea behind this patch is to provide a consistent API that can be used to query information contained in a TSan-produced report. User can use these APIs either in a debugger (via a script or directly), or they can use it directly from the process (e.g. in the __tsan_on_report callback). ASan already has a similar API, see http://reviews.llvm.org/D4466. Differential Revision: http://reviews.llvm.org/D16191 llvm-svn: 263126
* [powerpc] mark setuid.c and setuid2.c as unsupportedBill Seurer2016-03-072-0/+12
| | | | | | | | | setuid(0) hangs on powerpc64 big endian. When this is fixed remove the unsupported flag. https://llvm.org/bugs/show_bug.cgi?id=25799 llvm-svn: 262814
* [powerpc] pacify lint for java_race_pc.ccBill Seurer2016-03-041-2/+0
| | | | | | Fix blank lines. llvm-svn: 262689
* [powerpc] activate java_race_pc.cc on powerpc64leBill Seurer2016-03-041-0/+1
| | | | | | | | | The test case compiler-rt/test/tsan/java_race_pc.cc fails on powerpc64 big endian but not little endian. Add missing blank line. llvm-svn: 262675
* [powerpc] activate java_race_pc.cc on powerpc64leBill Seurer2016-03-031-2/+3
| | | | | | | The test case compiler-rt/test/tsan/java_race_pc.cc fails on powerpc64 big endian but not little endian. llvm-svn: 262669
* [TSAN] Fix test java_race_pcSagar Thakur2016-03-022-2/+12
| | | | | | | | | Incremented the pc for each architecture in accordance with StackTrace:GetPreviousInstructionPC Reviewers: samsonov, dvyukov Subscribers: llvm-commits, mohit.bhakkad, jaydeep Differential: http://reviews.llvm.org/D17802 llvm-svn: 262483
* Revert "[RT] Make tsan tests more portable"Renato Golin2016-03-0251-63/+63
| | | | | | This reverts commit r262476, as it broken the AArch64 VMA42 buildbot. llvm-svn: 262479
* [RT] Make tsan tests more portableRenato Golin2016-03-0251-63/+63
| | | | | | | | by avoiding potential races when scanning stdout and stderr output. Patch by Maxim Kuvyrkov. llvm-svn: 262476
* Use relative lines in CHECKs in race_on_mutex.cAlexander Kornienko2016-02-261-15/+14
| | | | llvm-svn: 262000
* [TSAN] XFAIL race_on_mutex.cc for MIPSSagar Thakur2016-02-261-0/+4
| | | | | | | | This test expects pthread_mutex_init in the frame #0 of thread T1 but we get memset at frame #0 because memset that is called from pthread_init_mutex is being intercepted by TSan llvm-svn: 261986
* [powerpc] reactivate ignore_lib4.cc on powerpc64leBill Seurer2016-02-251-2/+3
| | | | | | | The test case compiler-rt/test/tsan/ignore_lib4.cc fails on powerpc64 big endian but not little endian. llvm-svn: 261900
* tsan: disable ignore_lib4.cc test on powerpc64 and aarch64Dmitry Vyukov2016-02-241-0/+5
| | | | | | | | | | Fails on bots: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/1555/steps/ninja%20check%201/logs/FAIL%3A%20ThreadSanitizer-powerpc64%3A%3A%20ignore_lib4.cc http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/725/steps/ninja%20check-tsan/logs/stdio http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1468/steps/ninja%20check%202/logs/FAIL%3A%20ThreadSanitizer-aarch64%3A%3A%20ignore_lib4.cc http://lab.llvm.org:8011/builders/clang-native-aarch64-full/builds/2787/steps/ninja%20check%202/logs/FAIL%3A%20ThreadSanitizer-aarch64%3A%3A%20ignore_lib4.cc llvm-svn: 261728
* tsan: clean up code after r261658Dmitry Vyukov2016-02-232-2/+2
| | | | llvm-svn: 261660
* tsan: fix signal handling in ignored librariesDmitry Vyukov2016-02-233-0/+119
| | | | | | | | | | | | | | The first issue is that we longjmp from ScopedInterceptor scope when called from an ignored lib. This leaves thr->in_ignored_lib set. This, in turn, disables handling of sigaction. This, in turn, corrupts tsan state since signals delivered asynchronously. Another issue is that we can ignore synchronization in asignal handler, if the signal is delivered into an IgnoreSync region. Since signals are generally asynchronous, they should ignore memory access/synchronization/interceptor ignores. This could lead to false positives in signal handlers. llvm-svn: 261658
* [tests] Always specify correct config.target_arch when configuring test suite.Alexey Samsonov2016-02-233-2/+3
| | | | llvm-svn: 261601
* [TSan] PR26609: Fix two test cases.Alexey Samsonov2016-02-172-4/+4
| | | | llvm-svn: 261148
* [tests] Slightly improve a fix in r260669.Alexey Samsonov2016-02-171-1/+2
| | | | llvm-svn: 261142
* [compiler-rt] Fix test failures when switching default C++ libraryJonas Hahnfeld2016-02-152-1/+2
| | | | | | | | | | 1. Add two explicit -stdlib=libstdc++ in conjunction with -static-libstdc++ 2. Pass -nostdinc++ when adding include paths for libc++ built for tsan. This prevents clang finding the headers twice which would confuse #include_next Differential Revision: http://reviews.llvm.org/D17189 llvm-svn: 260883
* Re-commit r260230 with a fix for clang-cmake-aarch64-42vma.Daniel Sanders2016-02-121-1/+1
| | | | | | | There is now a default name_suffix ('default') which should appease the buildbot and reveal why this builder lacks a suffix. llvm-svn: 260679
OpenPOWER on IntegriCloud