summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan
Commit message (Collapse)AuthorAgeFilesLines
...
* [Fuzzer] Avoid the unnecessary rebuild of the custom libc++Petr Hosek2018-03-071-1/+1
| | | | | | | | | | | | This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 llvm-svn: 326921
* Fix which Darwin versions have ObjC runtime with full subscripting support.Volodymyr Sapsai2018-02-261-1/+1
| | | | | | | | | | | | | | | | | Update min deployment target in some tests so that they don't try to link against libarclite and don't fail when it's not available. rdar://problem/29253617 Reviewers: vsk, kubamracek Reviewed By: vsk Subscribers: jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43787 llvm-svn: 326143
* Correct a typo in tsan_pthread_setname_np in the FreeBSD codeKamil Rytarowski2018-02-101-1/+1
| | | | | | Noted by David CARLIER. llvm-svn: 324811
* tsan: deflake a testDmitry Vyukov2018-01-292-7/+12
| | | | | | | | | | | | | | | | | | There was a failure on a bot: http://lab.llvm.org:8011/builders/clang-cmake-mipsel/builds/1283 strerror test is indeed flaky. We protect all races by a barrier in other tests to eliminate flakiness. Do the same here. No idea why tls_race2.cc failed. Add output at the end of the test as we do in other tests. Sometimes test process crashes somewhere in the middle (e.g. during race reporting) and it looks like empty output. Output at the end of test allows to understand if the process has crashed, or it has finished but produced no race reports. Reviewed in https://reviews.llvm.org/D42633 llvm-svn: 323657
* Force lit to execute the ASan and TSan tests on iOS devicesDan Liew2018-01-201-2/+5
| | | | | | | | | | | | | | | | | | | | sequentially. The current implementation of commands in `test/sanitizer_common/ios_commands/` for iOS devices cannot be executed in parallel which results in the ASan and TSan tests failing when executed in parallel by lit which was the default behaviour. We now force the ASan and TSan tests to be a new parallelism group named `darwin-ios-device-sanitizer` which allows only one test to be run at a time. We also emit a warning informing the user that tests are being run sequentially. This only applies if the target is an iOS device. Differential Revision: https://reviews.llvm.org/D42156 llvm-svn: 323026
* [CMake] Support runtimes and monorepo layouts when looking for libcxxPetr Hosek2017-12-121-1/+1
| | | | | | | | | This also slightly refactors the code that's checking the directory presence which allows eliminating one unnecessary variable. Differential Revision: https://reviews.llvm.org/D40637 llvm-svn: 320446
* [ubsan] Re-commit: lit changes for lld testing, future lto testing.Roman Lebedev2017-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. The original attempt, r319525 was reverted in r319526 due to the failures in compiler-rt standalone builds. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 llvm-svn: 319575
* Revert "[ubsan] lit changes for lld testing, future lto testing."Roman Lebedev2017-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit r319525. This change has introduced a problem with the Lit tests build for compiler-rt using Gold: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/6047/steps/test%20standalone%20compiler-rt/logs/stdio llvm-lit: /b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg', traceback: Traceback (most recent call last): File "/b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path exec(compile(data, path, 'exec'), cfg_globals, None) File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 37, in <module> if root.host_os not in ['Linux'] or not is_gold_linker_available(): File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 27, in is_gold_linker_available stderr = subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory llvm-svn: 319529
* [ubsan] lit changes for lld testing, future lto testing.Roman Lebedev2017-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 llvm-svn: 319525
* [TSan] Do not run cond_cancel.c test on ppc64.Matt Morehouse2017-11-271-1/+1
| | | | | | | After r319004, the expected failure on ppc64 manifests as an infinite loop. llvm-svn: 319114
* Implement GetTls() for NetBSDKamil Rytarowski2017-11-162-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Reuse the existing code for FreeBSD that is compatible with NetBSD. Add NetBSD support in tests: tls_race.cc and tls_race2.cc. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka, kcc, eugenis Reviewed By: dvyukov Subscribers: srhines, emaste, kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40105 llvm-svn: 318431
* Correct atexit(3) support in TSan/NetBSDKamil Rytarowski2017-11-081-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The NetBSD specific implementation of cxa_atexit() does not preserve the 2nd argument if dso is equal to NULL. Changes: - Split paths of handling intercepted __cxa_atexit() and atexit(3). This affects all supported Operating Systems. - Add a local stack-like structure to hold the __cxa_atexit() context. atexit(3) is documented in the C standard as calling callback from the earliest to the oldest entry. This path also fixes potential ABI problem of passing an argument to a function from the atexit(3) callback mechanism. - Add new test to ensure LIFO style of atexit(3) callbacks: atexit3.cc Proposal to change the behavior of __cxa_atexit() in NetBSD has been rejected. With the above changes TSan/NetBSD with the current tsan_interceptors.cc can bootstrap into operation. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, dvyukov, joerg, kcc, eugenis Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39619 llvm-svn: 317735
* Add NetBSD improvements in sanitizersKamil Rytarowski2017-10-253-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 316591
* tsan: add tests missed in r316209Dmitry Vyukov2017-10-202-0/+66
| | | | llvm-svn: 316210
* [tsan] Add Mutex annotation flag for constant-initialized ↵Dmitry Vyukov2017-10-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | __tsan_mutex_linker_init behavior Add a new flag, _⁠_tsan_mutex_not_static, which has the opposite sense of _⁠_tsan_mutex_linker_init. When the new _⁠_tsan_mutex_not_static flag is passed to _⁠_tsan_mutex_destroy, tsan ignores the destruction unless the mutex was also created with the _⁠_tsan_mutex_not_static flag. This is useful for constructors that otherwise woud set _⁠_tsan_mutex_linker_init but cannot, because they are declared constexpr. Google has a custom mutex with two constructors, a "linker initialized" constructor that relies on zero-initialization and sets ⁠_⁠_tsan_mutex_linker_init, and a normal one which sets no tsan flags. The "linker initialized" constructor is morally constexpr, but we can't declare it constexpr because of the need to call into tsan as a side effect. With this new flag, the normal c'tor can set _⁠_tsan_mutex_not_static, the "linker initialized" constructor can rely on tsan's lazy initialization, and _⁠_tsan_mutex_destroy can still handle both cases correctly. Author: Greg Falcon (gfalcon) Reviewed in: https://reviews.llvm.org/D39095 llvm-svn: 316209
* Disable TSan tests on Android.Evgeniy Stepanov2017-10-112-1/+4
| | | | | | They never passed. This change excludes them from 'check-all'. llvm-svn: 315512
* Factor out "stable-runtime" feature and enable it on all android.Evgeniy Stepanov2017-10-101-5/+0
| | | | | | | This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android. llvm-svn: 315389
* tsan: handle signals in pause callDmitry Vyukov2017-09-281-0/+35
| | | | llvm-svn: 314384
* Deflake the "xpc-race.mm" test.Kuba Mracek2017-09-221-22/+31
| | | | llvm-svn: 314014
* [tsan] Disable user_malloc test which fails glibc 2.24Vitaly Buka2017-09-121-0/+7
| | | | llvm-svn: 313069
* Add NetBSD support in test/tsan/thread_name*.ccKamil Rytarowski2017-08-302-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A snipped from the documentation of thread_setname_np(3): NAME pthread_getname_np - get and set descriptive name of a thread LIBRARY POSIX Threads Library (libpthread, -lpthread) SYNOPSIS #include <pthread.h> int pthread_getname_np(pthread_t thread, char *name, size_t len); int pthread_setname_np(pthread_t thread, const char *name, void *arg); Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37306 llvm-svn: 312159
* tsan: fix darwin buildDmitry Vyukov2017-08-251-1/+1
| | | | | | | | Runtime hooks do not seem to work on darwin. The test failed on builder: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/34882/consoleFull#7286766538254eaf0-7326-4999-85b0-388101f2d404 Move the test to Linux dir. llvm-svn: 311776
* tsan: don't pass bogus PCs to __tsan_symbolize_externalDmitry Vyukov2017-08-251-0/+52
| | | | | | | | See the added comment for an explanation. Reviewed in https://reviews.llvm.org/D37107 llvm-svn: 311768
* [Sanitizers] TSan allocator set errno on failure.Alex Shlyapnikov2017-07-241-1/+11
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 308929
* [tsan] Disable test with debug runtimeVitaly Buka2017-07-161-0/+2
| | | | | | Test expects at least -O1 compiled runtime. llvm-svn: 308121
* Add explicit CMake targets for ASan/TSan iOS Simulator testing and update ↵Kuba Mracek2017-07-121-4/+13
| | | | | | the instructions how to run them. llvm-svn: 307844
* tsan: add test for __tsan_java_findDmitry Vyukov2017-07-121-0/+69
| | | | | | | | | | | The test should have been added in 289682 "tsan: allow Java VM iterate over allocated objects" but I forgot to avn add. Author: Alexander Smundak (asmundak) Reviewed in https://reviews.llvm.org/D27720 llvm-svn: 307776
* Fix-up for r307537: We need to #include stdint.h to get int32_t.Kuba Mracek2017-07-101-0/+1
| | | | llvm-svn: 307557
* Fixup whitespace.Kuba Mracek2017-07-101-1/+1
| | | | llvm-svn: 307538
* [tsan] Add support for running TSan tests on iOS simulator and devicesKuba Mracek2017-07-1010-6/+68
| | | | | | Differential Revision: https://reviews.llvm.org/D35157 llvm-svn: 307537
* [tsan] Use pthread_sigmask instead of sigprocmask to block signals in a ↵Kuba Mracek2017-07-051-0/+75
| | | | | | | | | | thread on Darwin On Darwin, sigprocmask changes the signal mask for the entire process. This has some unwanted consequences, because e.g. internal_start_thread wants to disable signals only in the current thread (to make the new thread inherit the signal mask), which is currently broken on Darwin. This patch switches to pthread_sigmask. Differential Revision: https://reviews.llvm.org/D35016 llvm-svn: 307212
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-032-2/+2
| | | | llvm-svn: 307005
* [Sanitizers] Operator new() interceptors always die on allocation errorAlex Shlyapnikov2017-06-281-33/+83
| | | | | | | | | | | | | | | | | | | | | Summary: Operator new interceptors behavior is now controlled by their nothrow property as well as by allocator_may_return_null flag value: - allocator_may_return_null=* + new() - die on allocation error - allocator_may_return_null=0 + new(nothrow) - die on allocation error - allocator_may_return_null=1 + new(nothrow) - return null Ideally new() should throw std::bad_alloc exception, but that is not trivial to achieve, hence TODO. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34731 llvm-svn: 306604
* tsan: fix reading of mutex flagsDmitry Vyukov2017-06-135-6/+52
| | | | | | | SyncVar::IsFlagSet returns true if any flag is set. This is wrong. Check the actual requested flag. llvm-svn: 305281
* Mark the tsan strerror_r test as unsupported on DarwinVedant Kumar2017-06-071-0/+1
| | | | llvm-svn: 304944
* Revert "Fix tsan test for Darwin. NFCI."Vedant Kumar2017-06-071-2/+1
| | | | | | | | | This reverts commit r304941. Vitaly Buka writes: "Actually it depends on return value. Test is for char* version of function. It will probably fail for int version." llvm-svn: 304943
* Fix tsan test for Darwin. NFCI.Vedant Kumar2017-06-071-1/+2
| | | | | | | | On Darwin, strerror_r returns an int, not a char*. I don't think this test really depends on what strerror_r returns, so I've used something else in place of the result of the call to strerror_r. llvm-svn: 304941
* [tsan]: Fix GNU version of strerror_r interceptorVitaly Buka2017-06-071-0/+28
| | | | | | | | | | GNU version of strerror_r returns a result pointer that doesn't match the input buffer. The result pointer is in fact a pointer to some internal storage. TSAN was recording a write to this location, which was incorrect. Fixed https://github.com/google/sanitizers/issues/696 llvm-svn: 304858
* [tsan] Detect races on modifying accesses in Swift codeKuba Mracek2017-05-033-8/+102
| | | | | | | | This patch allows the Swift compiler to emit calls to `__tsan_external_write` before starting any modifying access, which will cause TSan to detect races on arrays, dictionaries and other classes defined in non-instrumented modules. Races on collections from the Swift standard library and user-defined structs and a frequent cause of subtle bugs and it's important that TSan detects those on top of existing LLVM IR instrumentation, which already detects races in direct memory accesses. Differential Revision: https://reviews.llvm.org/D31630 llvm-svn: 302050
* [powerpc] deactivate flakey tests on powerpc64leBill Seurer2017-05-012-0/+6
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 301798
* TSan: update line number after XFAIL on iOS.Tim Northover2017-04-271-2/+2
| | | | llvm-svn: 301560
* XFAIL the TSan XPC tests on iOS. XPC isn't available on iOS.Kuba Mracek2017-04-263-0/+6
| | | | llvm-svn: 301459
* [tsan] Include __tsan_external_* API from a header file instead of declaring ↵Kuba Mracek2017-04-244-26/+9
| | | | | | | | them manually. NFC. Differential Revision: https://reviews.llvm.org/D32384 llvm-svn: 301190
* [tsan] Remove the extra word "object" from description of external racesKuba Mracek2017-04-241-6/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D32383 llvm-svn: 301189
* [tsan] Add a test for "external" API that checks the dup suppression is ↵Kuba Mracek2017-04-211-0/+66
| | | | | | | | | | based on the caller PC We need to make sure that the "external" API isn't dup'ing all data races into a single one (because the stack might look the same) and suppressing all external races. This works now, so just adding a test for that. Differential Revision: https://reviews.llvm.org/D31734 llvm-svn: 301011
* [tsan] Ignore memory accesses for libignored modules for "external" racesKuba Mracek2017-04-214-63/+117
| | | | | | | | On Darwin, the setting ignore_noninstrumented_modules is used to suppress false positives in code that users don't have control of. The recently added "external" API (which can be used to detect races on objects provided by system libraries, but the race is actually user's fault) ignores this flag and it can report issues in non-instrumented modules. This patch fixes that. Differential Revision: https://reviews.llvm.org/D31553 llvm-svn: 301000
* [tsan] Don't report bugs from interceptors called from libignored modulesKuba Mracek2017-04-211-0/+47
| | | | | | | | This patch make sure we don't report deadlocks and other bug types when we're inside an interceptor that was called from a noninstrumented module (when ignore_noninstrumented_modules=1 is set). Adding a testcase that shows that deadlock detection still works on Darwin (to make sure we're not silencing too many reports). Differential Revision: https://reviews.llvm.org/D31449 llvm-svn: 300998
* [tsan] Add missing include for uint64_t in test.Benjamin Kramer2017-04-171-0/+1
| | | | llvm-svn: 300484
* [sanitizer] Introduce tid_t as a typedef for OS-provided thread IDsKuba Mracek2017-04-173-7/+7
| | | | | | | | We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD). Differential Revision: https://reviews.llvm.org/D31774 llvm-svn: 300473
* [tsan] Fall-back to IPv6 if IPv4 is not available.Vitaly Buka2017-04-102-28/+62
| | | | | | | | | | Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D31897 llvm-svn: 299885
OpenPOWER on IntegriCloud