summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan
Commit message (Collapse)AuthorAgeFilesLines
...
* [NFC][libdispatch] Improve a few testsJulian Lettner2019-04-023-6/+7
| | | | llvm-svn: 357510
* [NFC][TSan][libdispatch] Don't use ignore_noninstrumented_modules on LinuxJulian Lettner2019-03-221-3/+0
| | | | llvm-svn: 356728
* [NFC][TSan][libdispatch] Fix test for dispatch_apply[_f]Julian Lettner2019-03-181-12/+18
| | | | | | | | | | | | | | | | * Array index out of bounds: 100 iterations, but size of array is 2. * Unmatched barrier_init (2) with barrier_wait (200) * Number of iterations must be smaller than the available parallelism for the queue, otherwise we deadlock (since every barrier_wait call blocks the thread). Scary: All of this worked reliably in gcd-apply.mm (for Darwin) Rievewed By: kubamracek Differential Revision: https://reviews.llvm.org/D59510 llvm-svn: 356418
* [TSan][libdispatch] Configure libdispatch lit testsJulian Lettner2019-03-161-1/+6
| | | | llvm-svn: 356311
* [TSan][libdispatch] Enable linking and running of tests on LinuxJulian Lettner2019-03-151-0/+3
| | | | | | | | | | | | | | | | | | | | | When COMPILER_RT_INTERCEPT_LIBDISPATCH is ON the TSan runtime library now has a dependency on the blocks runtime and libdispatch. Make sure we set all the required linking options. Also add cmake options for specifying additional library paths to instruct the linker where to search for libdispatch and the blocks runtime. This allows us to build TSan runtime with libdispatch support without installing those libraries into default linker library paths. `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` is necessary to avoid aborting the build due to failing the link step in CMake's check_c_compiler test. Reviewed By: dvyukov, kubamracek Differential Revision: https://reviews.llvm.org/D59334 llvm-svn: 356281
* [NFC][TSan] Move libdispatch tests into their own subfolderJulian Lettner2019-03-1413-28/+15
| | | | | | | | | | | | | | | | | Remove 'gcd' file prefix. GCD stands for Grand Central Dispatch, which is another name for libdispatch. https://apple.github.io/swift-corelibs-libdispatch/ Remove `REQUIRE: dispatch` from tests. Also rename lit feature 'dispatch' -> 'libdispatch' to be more explicit what this is about. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D59341 llvm-svn: 356202
* [TSan] Temporarily disable test which fails on build botJulian Lettner2019-03-071-0/+3
| | | | llvm-svn: 355642
* [TSan] Temporarily disable test which fails on build botJulian Lettner2019-03-071-0/+3
| | | | llvm-svn: 355633
* [NFC][TSan] Add libdispatch tests for non-Darwin platformsJulian Lettner2019-03-0712-0/+540
| | | | | | | | | | | | Add new sets of tests (copy instead of move existing tests) because there could be subtle differences between C/Obj-C and with/without Foundation etc. Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D59047 llvm-svn: 355618
* [Sanitizer] lit test config: Respect existing parallelism_groupJulian Lettner2019-02-281-1/+2
| | | | llvm-svn: 355128
* [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on DarwinJulian Lettner2019-02-271-3/+1
| | | | | | | | | | | | | | | | | | | Underlying condition for throttling is "has large mmap'd regions" (i.e., shadow memory) and not sanitizers in general (e.g., UBSan does not need to be throttled). Rename parallelism group `darwin-64bit-sanitizer` to `shadow-memory` and apply it unconditionally to all tests which require it. We can then have all the Darwin throttling logic in one place in the commen lit config. Throttle sanitizer_common unit tests. Configuration was previously missing from sanitizer_common/Unit/lit.site.cfg. Reviewed by: kubamracek Differential Revision: https://reviews.llvm.org/D58677 llvm-svn: 355018
* [compiler-rt] Fix broken sanitizer bots (hopefully)Jonas Hahnfeld2019-02-1712-13/+15
| | | | | | | | | | | | | | | | | | | According to the logs and local debugging there were two issues: 1) tsan tests listed libc++.a before the source file. That's usually ok for shared libraries, but the linker will not add symbols from a static library unless needed at that time. As a result the tests that rely upon symbols from the library (and not only include the headers) had undefined references. To solve this I'm adding a new substitution %link_libcxx_tsan which expands to libc++.a if available. 2) The target Fuzzer-x86_64-Test linked in SANITIZER_TEST_CXX_LIBRARIES which defaults to -lstdc++. This resulted in error messages like hidden symbol '_ZdlPv' is not defined locally hidden symbol '_Znwm' is not defined locally when using GNU gold (ld.bfd and lld are fine). Removing the linkage is fine because we build a custom libc++ for that purpose. llvm-svn: 354231
* [compiler-rt] Build custom libcxx with libcxxabiJonas Hahnfeld2019-02-174-9/+8
| | | | | | | | | | | | | | | This changes add_custom_libcxx to also build libcxxabi and merges the two into a static and hermetic library. There are multiple advantages: 1) The resulting libFuzzer doesn't expose C++ internals and looks like a plain C library. 2) We don't have to manually link in libstdc++ to provide cxxabi. 3) The sanitizer tests cannot interfere with an installed version of libc++.so in LD_LIBRARY_PATH. Differential Revision: https://reviews.llvm.org/D58013 llvm-svn: 354212
* [Sanitizer] iOS: Pull up parallelism_group handling into common.lit.configJulian Lettner2019-02-151-2/+0
| | | | | | | | | | | | | | | | | | | Serial execution on iOS devices is not specific to sanitizers. We want to throttle all on-device tests. Pull the setting of the parallelism_group up into the common lit configuration file. Rename `darwin-ios-device-sanitizer` to `ios-device`. This group is not specific to sanitizers and (theoretically) independent from the host OS. Note that we don't support running unit tests on-device (there are no configurations generated for that). If that ever changes, we also need this configuration in `unittests/lit.common.unit.cfg`. Reviewers: delcypher Differential Revision: https://reviews.llvm.org/D58209 llvm-svn: 354179
* Dmitry Vyukov2019-02-136-0/+348
| | | | | | | | | | | | | | | | | | | | | | | tsan: add fiber support This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 [The previous commit of this change was reverted, this is a resubmit with a squashed fix for check_analyze.sh and COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED] llvm-svn: 353947
* Revert "tsan: add fiber support"Diana Picus2019-02-136-348/+0
| | | | | | | This reverts commit r353817 because we think it broke AARch64 and PowerPC buildbots. llvm-svn: 353939
* tsan: add fiber supportDmitry Vyukov2019-02-126-0/+348
| | | | | | | | | | | | | | | | | This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 llvm-svn: 353817
* [tsan] Remove debug logging and disable test on ppc64beVitaly Buka2019-02-091-1/+1
| | | | llvm-svn: 353624
* [tsan] Remove debug logging and disable test on ppc64beVitaly Buka2019-02-091-5/+5
| | | | llvm-svn: 353623
* [tsan] Debug failing test on PPC botVitaly Buka2019-02-091-1/+5
| | | | llvm-svn: 353617
* tsan: Implement pthread_exit() interceptor for Thread sanitizerDmitry Vyukov2019-02-071-0/+25
| | | | | | | | | | This change is preparation for fiber support. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D57876 Context: https://reviews.llvm.org/D54889 llvm-svn: 353385
* [test] Disable sunrpc tests when rpc/xdr.h is missingMichal Gorny2019-01-141-0/+2
| | | | | | | | | | | | | | | | | Disable tests requiring sunrpc when the relevant headers are missing. In order to accommodate that, move the header check from sanitizer_common to base-config-ix, and define the check result as a global variable there. Use it afterwards both for definition needed by sanitizer_common, and to control 'sunrpc' test feature. While at it, remove the append_have_file_definition macro that was used only once, and no longer fits the split check-definition. Bug report: https://github.com/google/sanitizers/issues/974 Differential Revision: https://reviews.llvm.org/D47819 llvm-svn: 351109
* [TSan] Remove ignore_interceptors_accesses flagJulian Lettner2019-01-103-87/+34
| | | | | | | | | | | | | | | | | | | | | | Summary: It has been superseded by the `ignore_noninstrumented_modules` flag and is no longer needed. Also simplify a test that checks that `mmap_interceptor` respects ignore annotations (`thr->ignore_reads_and_writes `). Relevant: https://reviews.llvm.org/rL269855 <rdar://problem/46263073> Remove obsolete Apple-specific suppression option Reviewers: dcoughlin, kubamracek, dvyukov, delcypher Reviewed By: dvyukov Subscribers: jfb, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55075 llvm-svn: 350883
* [TSan] Support Objective-C @synchronized with tagged pointersJulian Lettner2019-01-071-2/+1
| | | | | | | | | | | | | | | | | | | Summary: Objective-C employs tagged pointers, that is, small objects/values may be encoded directly in the pointer bits. The resulting pointer is not backed by an allocation/does not point to a valid memory. TSan infrastructure requires a valid address for `Acquire/Release` and `Mutex{Lock/Unlock}`. This patch establishes such a mapping via a "dummy allocation" for each encountered tagged pointer value. Reviewers: dcoughlin, kubamracek, dvyukov, delcypher Reviewed By: dvyukov Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D56238 llvm-svn: 350556
* [TSan] Enable detection of lock-order-inversions for Objective-C @synchronizedJulian Lettner2019-01-023-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: @synchronized semantics can be synthesized by using existing mutex_[un]lock operations. ``` @synchronized(obj) { // ... } => { mutex_lock(obj); // ... mutex_unlock(obj); } ``` Let me know whether you think this a good idea. Reviewers: dcoughlin, dvyukov, kubamracek, delcypher Reviewed By: dvyukov Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55959 llvm-svn: 350258
* tsan: align default value of detect_deadlocks flag with actual behaviorDmitry Vyukov2018-12-192-6/+6
| | | | | | | | | | | | | | I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.) I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this This changes aligns the default value of the flag with the actual default behavior. Author: yln (Julian Lettner) Reviewed in: https://reviews.llvm.org/D55846 llvm-svn: 349609
* tsan: add pthread_tryjoin_np and pthread_timedjoin_np interceptorsDmitry Vyukov2018-11-212-0/+80
| | | | | | | | | | Add pthread_tryjoin_np() and pthread_timedjoin_np() interceptors on Linux, so that ThreadSanitizer can handle programs using these functions. Author: Yuri Per (yuri) Reviewed in: https://reviews.llvm.org/D54521 llvm-svn: 347383
* [tsan] Add __cxa_guard_acquire hooks to support cooperative schedulingVitaly Buka2018-11-201-0/+25
| | | | | | | | | | Reviewers: dvyukov Subscribers: krytarowski, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D54664 llvm-svn: 347336
* Switch getline_nohang from XFAIL to UNSUPPORTED for NetBSDKamil Rytarowski2018-10-301-2/+2
| | | | | | This test sometimes works, usually breaks. llvm-svn: 345655
* Mark breaking TSan tests on NetBSD with XFAILKamil Rytarowski2018-10-303-1/+5
| | | | | | | | | Failing tests: - dtls - ignored-interceptors-mmap - mutex_lock_destroyed llvm-svn: 345595
* Mark test/tsan/getline_nohang as XFAIL for NetBSDKamil Rytarowski2018-10-291-0/+3
| | | | llvm-svn: 345493
* Disable the GNU strerror_r TSan test for NetBSDKamil Rytarowski2018-10-291-5/+3
| | | | | | | | | Revert older change that was incorrect in this test. It was already reverted in the past after an attempt to port it to Darwin. While there, mark FreeBSD as unsupported as well. llvm-svn: 345492
* Mark test/tsan/ignore_lib5 as unsupported for NetBSDKamil Rytarowski2018-10-291-1/+3
| | | | | | ReadProcMaps() on NetBSD does not handle >=1MB of memory layout information. llvm-svn: 345490
* Mark two tests, which require too much available VM, as "UNSUPPORTED: ios".Kuba Mracek2018-10-032-0/+6
| | | | llvm-svn: 343650
* [tsan] Avoid calling Block_copy in the "sync" GCD interceptorsKuba Mracek2018-08-211-0/+34
| | | | | | | | | | The synchronous dispatch functions in GCD (dispatch_sync, dispatch_barrier_sync), don't make a copy of the passed block. To maintain binary compatibility, we should avoid doing that as well in TSan, as there's no reason to do that. The synchronous dispatch functions will not return before the block is actually executed. rdar://problem/42242579 Differential Revision: https://reviews.llvm.org/D50920 llvm-svn: 340342
* [tsan] Fix crash in objc_sync_enter/objc_sync_exit when using an Obj-C ↵Kuba Mracek2018-07-241-0/+62
| | | | | | | | | | tagged pointer Objective-C tagged pointers (either bottom-most or top-most bit is 1) are valid Obj-C objects but are not valid pointers. Make sure we don't crash on them when used in objc_sync_enter/objc_sync_exit. Instead, let's synchronize on a global object. Differential Revision: https://reviews.llvm.org/D49707 llvm-svn: 337837
* Remove `tsan/Darwin/gcd-after-null.mm` test.Dan Liew2018-07-131-23/+0
| | | | | | | | | | | | | | | | | Summary: This test invokes undocumented behaviour that could change in the future. Given this, it's probably best to just remove the test. rdar://problem/42022283 Reviewers: kubamracek Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49269 llvm-svn: 336977
* [compiler-rt] Get rid of "%T" expansionsFilipe Cabecinhas2018-07-108-33/+54
| | | | | | | | | | | | | | | | | | | Summary: Original patch by Kuba Mracek The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in compiler-rt. Differential Revision: https://reviews.llvm.org/D48618 llvm-svn: 336661
* [TSan] fix build and couple of unit tests on FreeBSDDavid Carlier2018-06-202-0/+3
| | | | | | | | | | | | | Similarly to Msan adding -pie provokes linkage issue, was spotted with pie_test.cc Set to XFAIL for couple of unit tests. Reviewers: vitalybuka, krytarowski, dim Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48317 llvm-svn: 335166
* [sanitizer] Unify and generalize Apple platforms in CMake and lit test configsKuba Mracek2018-06-203-15/+7
| | | | | | | | There's more platforms than just "ios" and "iossim" that we should support, and adding more lit config variables for each platform isn't great. Let's generalize and have a single value that determines what the platform under test is. Differential Revision: https://reviews.llvm.org/D48309 llvm-svn: 335123
* [TSan] Report proper error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-06-181-124/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: Following up on and complementing D44404 and other sanitizer allocators. Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, no stack, no details, not too helpful nor informative. To improve the situation, detailed and structured common errors were defined and reported under the appropriate conditions. Common tests were generalized a bit to cover a slightly different TSan stack reporting format, extended to verify errno value and returned pointer value check is now explicit to facilitate debugging. Reviewers: dvyukov Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48087 llvm-svn: 334975
* [sanitizer] Add fgets, fputs and puts into sanitizer_commonPeter Wu2018-06-111-0/+29
| | | | | | | | | | | | | | | Summary: Add fgets, fputs and puts to sanitizer_common. This adds ASAN coverage for these functions, extends MSAN support from fgets to fputs/puts and extends TSAN support from puts to fputs. Fixes: https://github.com/google/sanitizers/issues/952 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D46545 llvm-svn: 334450
* [tsan] Fix a failure in test java_race_pc on AArch64 after r333071Igor Kudrin2018-05-241-1/+1
| | | | llvm-svn: 333180
* Fix another case where libstdc++ is being inappropriately requested (seeDan Liew2018-05-141-1/+2
| | | | | | | | | | | | | | | | | | | r328775) for all platforms. Given that this is the second occurance of this problem it seemed worth fixing this problem in a more generic way. r328775 has been reverted and now a substitution `%linux_static_libstdcplusplus` has been provided. This substitution expands to Clang driver arguments to use a static libstdc++ on Linux and on all other platforms it expands to nothing. The `asan/TestCases/throw_invoke_test.cc` and `test/tsan/static_init6.cc` test cases now use this substitution. rdar://problem/39948818 Differential Revision: https://reviews.llvm.org/D46401 llvm-svn: 332254
* [tsan] Add debugging API to retrieve the "external tag" from reportsKuba Mracek2018-05-101-0/+68
| | | | | | Differential Revision: https://reviews.llvm.org/D46661 llvm-svn: 332048
* Revert "Follow-up to r331378. Update tests to allow to use C atomics in C++."Volodymyr Sapsai2018-05-033-3/+3
| | | | | | | | | | | | | It reverts commit r331484 because it caused test failures ThreadSanitizer-x86_64 :: Darwin/gcd-groups-destructor.mm ThreadSanitizer-x86_64 :: Darwin/libcxx-shared-ptr-stress.mm ThreadSanitizer-x86_64 :: Darwin/xpc-race.mm Foundation.h transitively includes <atomic>, so we have a case of benign mixing <stdatomic.h> and <atomic>. llvm-svn: 331491
* Follow-up to r331378. Update tests to allow to use C atomics in C++.Volodymyr Sapsai2018-05-033-3/+3
| | | | | | | | | | | | Reviewers: kubamracek Reviewed By: kubamracek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46363 llvm-svn: 331484
* tsan: improve "destroy of a locked mutex" reportsDmitry Vyukov2018-04-273-0/+50
| | | | | | | | | | | | | | | 1. Allow to suppress by current stack. We generally allow to suppress by all main stacks. Current is probably the stack one wants to use to suppress such reports. 2. Fix last lock stack restoration. We trimmed shadow value by storing it in u32. This magically worked for the test that provoked the report on the main thread. But this breaks for locks in any other threads. llvm-svn: 331023
* [tsan] Add interceptors for objc_sync_enter and objc_sync_exitKuba Mracek2018-04-131-0/+57
| | | | | | | | Objective-C's @synchronize synchronization primitive uses calls to objc_sync_enter and objc_sync_exit runtime functions. In most cases, they end up just calling pthread_mutex_lock/pthread_mutex_unlock, but there are some cases where the synchronization from pthread_mutex_lock/pthread_mutex_unlock interceptors isn't enough. Let's add explicit interceptors for objc_sync_enter and objc_sync_exit to handle all cases. Differential Revision: https://reviews.llvm.org/D45487 llvm-svn: 329982
* tsan: support inlined frames in external symbolizationDmitry Vyukov2018-03-212-11/+51
| | | | | | | | | | | | New API passes a callback function to the external symbolizer, allowing it to add multiple frames to the traceback. Note that the old interface API will be still supported until the clients migrate to the new one. Author: asmundak (Alexander Smundak) Reviewed in: https://reviews.llvm.org/D44714 llvm-svn: 328079
OpenPOWER on IntegriCloud