summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* [tsan] Fix a typo in tsan_test_util.hKuba Brecka2015-11-131-1/+1
| | | | | | | | There is a typo in tsan_test_util.h, it shouldn't be `APPLE`, but `__APPLE__`. Differential Revision: http://reviews.llvm.org/D14647 llvm-svn: 253078
* [tsan] Filter OS X architectures for unit testingKuba Brecka2015-11-121-1/+5
| | | | | | | | 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 llvm-svn: 252873
* [tsan] Rename tsan_test_util_linux.cc to tsan_test_util_posix.ccKuba Brecka2015-11-112-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D14575 llvm-svn: 252741
* [tsan] Add TSan unit test support for OS XKuba Brecka2015-11-116-27/+86
| | | | | | | | This patch enables building and running TSan unit tests on OS X. Differential Revision: http://reviews.llvm.org/D14546 llvm-svn: 252731
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-211-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 245734
* [tsan] Enable tsan for aarch64Adhemerval Zanella2015-08-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 244055
* CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 240120
* [TSan][MIPS] Adding support for MIPS64Mohit K. Bhakkad2015-02-201-19/+21
| | | | | | | | | | | | Patch by Sagar Thakur Reviewers: dvyukov, samsonov, petarj, kcc, dsanders. Subscribers: mohit.bhakkad, Anand.Takale, llvm-commits. Differential Revision: http://reviews.llvm.org/D6291 llvm-svn: 229972
* [TSan] Fix -Werror=sign-compare warning. NFC.Alexey Samsonov2015-01-301-2/+2
| | | | llvm-svn: 227527
* tsan: remove TSAN_SHADOW_COUNTDmitry Vyukov2015-01-191-4/+0
| | | | | | | | | 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. llvm-svn: 226466
* [Sanitizer] Improve unit tests in COMPILER_RT_DEBUG=ON mode.Alexey Samsonov2015-01-061-0/+1
| | | | | | | Propagate -DSANITIZER_DEBUG definition to unit tests. Make sure unit tests depend on compiler-rt headers. llvm-svn: 225298
* Remove TSAN_DEBUG in favor of SANITIZER_DEBUG.Alexey Samsonov2015-01-032-2/+2
| | | | llvm-svn: 225111
* [TSan] Use StackTrace from sanitizer_common where applicableAlexey Samsonov2014-11-031-45/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 221194
* [TSan] Fix signed-compare warning in the unit testAlexey Samsonov2014-11-031-1/+1
| | | | llvm-svn: 221190
* tsan: support mmap(MAP_32BIT)Dmitry Vyukov2014-10-241-1/+1
| | | | | | | | | Allow user memory in the first TB of address space. This also enabled non-pie binaries and freebsd. Fixes issue: https://code.google.com/p/thread-sanitizer/issues/detail?id=5 llvm-svn: 220571
* [TSan] Use common flags in the same way as all the other sanitizersAlexey Samsonov2014-09-101-72/+0
| | | | llvm-svn: 217559
* Support building tsan_test_util_linux.cc on FreeBSDViktor Kutuzov2014-09-061-3/+8
| | | | | | Differential Revision: http://reviews.llvm.org/D5210 llvm-svn: 217309
* tsan: allocate vector clocks using slab allocatorDmitry Vyukov2014-08-052-25/+106
| | | | | | | | | | Vector clocks is the most actively allocated object in tsan runtime. Current internal allocator is not scalable enough to handle allocation of clocks in scalable way (too small caches). This changes transforms clocks to 2-level array with 512-byte blocks. Since all blocks are of the same size, it's possible to cache them more efficiently in per-thread caches. llvm-svn: 214912
* tsan: remove special handling of false reports coming from JVMDmitry Vyukov2014-07-151-4/+0
| | | | | | There is now a more common functionality in the form of called_from_lib suppressions. llvm-svn: 213057
* tsan: reapply 212531 and 212532 with a fixDmitry Vyukov2014-07-081-0/+12
| | | | | | don't reset s->addr as well llvm-svn: 212565
* [TSan] Revert r212531 and r212532.Alexey Samsonov2014-07-081-12/+0
| | | | | | They cause "check-tsan" command to hang. Details in r212532 review thread. llvm-svn: 212562
* tsan: fix a bug in metamapDmitry Vyukov2014-07-081-0/+12
| | | | | | | | | The bug happens in the following case: Mutex is located at heap block beginning, when we call MutexDestroy, s->next is set to 0, so free can't find the MBlock related to the block. llvm-svn: 212531
* Generalize sanitizer allocator public interface.Alexey Samsonov2014-07-071-27/+18
| | | | | | | | | | | | | | Introduce new public header <sanitizer/allocator_interface.h> and a set of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc. that will eventually replace their tool-specific equivalents (__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific functions are now deprecated and implemented as stubs redirecting to __sanitizer_ versions (which are implemented differently in each tool). Replace all uses of __xsan_ versions with __sanitizer_ versions in unit and lit tests. llvm-svn: 212469
* [TSan] Equalize the behavior of __tsan_get_allocated_size and ↵Alexey Samsonov2014-07-011-5/+6
| | | | | | | | | | | user_alloc_usable_size. The former used to crash with a null deref if it was given a not owned pointer, while the latter returned 0. Now they both return 0. This is still not the best possible behavior: it is better to print an error report with a stack trace, pointing to the error in user code, as we do in ASan. llvm-svn: 212112
* tsan: optimize memory access functionsDmitry Vyukov2014-05-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optimization is two-fold: First, the algorithm now uses SSE instructions to handle all 4 shadow slots at once. This makes processing faster. Second, if shadow contains the same access, we do not store the event into trace. This increases effective trace size, that is, tsan can remember up to 10x more previous memory accesses. Perofrmance impact: Before: [ OK ] DISABLED_BENCH.Mop8Read (2461 ms) [ OK ] DISABLED_BENCH.Mop8Write (1836 ms) After: [ OK ] DISABLED_BENCH.Mop8Read (1204 ms) [ OK ] DISABLED_BENCH.Mop8Write (976 ms) But this measures only fast-path. On large real applications the speedup is ~20%. Trace size impact: On app1: Memory accesses : 1163265870 Including same : 791312905 (68%) on app2: Memory accesses : 166875345 Including same : 150449689 (90%) 90% of filtered events means that trace size is effectively 10x larger. llvm-svn: 209897
* tsan: refactor storage of meta information for heap blocks and sync objectsDmitry Vyukov2014-05-293-54/+144
| | | | | | | | | | | | | | | The new storage (MetaMap) is based on direct shadow (instead of a hashmap + per-block lists). This solves a number of problems: - eliminates quadratic behaviour in SyncTab::GetAndLock (https://code.google.com/p/thread-sanitizer/issues/detail?id=26) - eliminates contention in SyncTab - eliminates contention in internal allocator during allocation of sync objects - removes a bunch of ad-hoc code in java interface - reduces java shadow from 2x to 1/2x - allows to memorize heap block meta info for Java and Go - allows to cleanup sync object meta info for Go - which in turn enabled deadlock detector for Go llvm-svn: 209810
* Fix typosAlp Toker2014-05-151-1/+1
| | | | llvm-svn: 208841
* tsan: better reports for "double lock of a mutex"Dmitry Vyukov2014-04-251-0/+4
| | | | | | | + fixes crashes due to races on symbolizer, see: https://code.google.com/p/thread-sanitizer/issues/detail?id=55 llvm-svn: 207204
* tsan: reduce number of iterations in the testDmitry Vyukov2014-04-231-1/+1
| | | | | | otherwise it runs for 50 seconds in debug mode llvm-svn: 206950
* tsan: fix vector clocksDmitry Vyukov2014-04-112-5/+45
| | | | | | | the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well llvm-svn: 206035
* [tsan] Fix more warnings in TSan tests.Evgeniy Stepanov2014-03-251-33/+33
| | | | llvm-svn: 204715
* [tsan] Fix compiler warnings in TSan tests.Evgeniy Stepanov2014-03-251-2/+2
| | | | llvm-svn: 204712
* tsan: optimize vector clock operationsDmitry Vyukov2014-03-241-48/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make vector clock operations O(1) for several important classes of use cases. See comments for details. Below are stats from a large server app, 77% of all clock operations are handled as O(1). Clock acquire : 25983645 empty clock : 6288080 fast from release-store : 14917504 contains my tid : 4515743 repeated (fast) : 2141428 full (slow) : 2636633 acquired something : 1426863 Clock release : 2544216 resize : 6241 fast1 : 197693 fast2 : 1016293 fast3 : 2007 full (slow) : 1797488 was acquired : 709227 clear tail : 1 last overflow : 0 Clock release store : 3446946 resize : 200516 fast : 469265 slow : 2977681 clear tail : 0 Clock acquire-release : 820028 llvm-svn: 204656
* [CMake] Rename the variableAlexey Samsonov2014-03-241-1/+1
| | | | llvm-svn: 204602
* [CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commandsAlexey Samsonov2014-03-241-1/+0
| | | | llvm-svn: 204593
* [CMake] Build sanitizer unit tests with -std=c++11Alexey Samsonov2014-03-191-0/+1
| | | | llvm-svn: 204234
* tsan: yet another attempt to fix pthread_cond interceptorsDmitry Vyukov2014-03-171-0/+4
| | | | | | | | | | | Make behavior introduced in r202820 conditional (under legacy_pthread_cond flag). The new issue that we've hit with the satellite pthread_cond_t struct is that pthread_condattr_getpshared does not work (satellite data is not shared between processes). The idea is that most processes do not use pthread 2.2.5. The rare ones that use (2.2.5 is dated by 2002) must specify legacy_pthread_cond=1 on their own risk. llvm-svn: 204032
* [CMake] break dependency between unit tests and runtimes in standalone buildAlexey Samsonov2014-02-201-2/+18
| | | | llvm-svn: 201778
* Move TSan lit-tests under test/tsanAlexey Samsonov2014-02-141-2/+2
| | | | llvm-svn: 201414
* [Sanitizer] Teach external symbolizer to work with addr2line if ↵Alexey Samsonov2014-02-121-1/+5
| | | | | | llvm-symbolizer is unavailable. Allow this mode in TSan. llvm-svn: 201218
* tsan: do not deadlock on forkDmitry Vyukov2014-01-241-0/+4
| | | | | | | | | | | | | Currently correct programs can deadlock after fork, because atomic operations and async-signal-safe calls are not async-signal-safe under tsan. With this change: - if a single-threaded program forks, the child continues running with verification enabled (the tsan background thread is recreated as well) - if a multi-threaded program forks, then the child runs with verification disabled (memory accesses, atomic operations and interceptors are disabled); it's expected that it will exec soon anyway - if the child tries to create more threads after multi-threaded fork, the program aborts with error message - die_after_fork flag is added that allows to continue running, but all bets are off http://llvm-reviews.chandlerc.com/D2614 llvm-svn: 199993
* [Sanitizer] Use different MemoryMappingLayout::DumpListOfModules on Linux ↵Alexey Samsonov2013-12-251-0/+3
| | | | | | | | and Mac. Make a unit test added in r198004 more robust. llvm-svn: 198012
* tsan: remove in_rtl counterDmitry Vyukov2013-12-246-21/+0
| | | | | | | | This is intended to address the following problem. Episodically we see CHECK-failures when recursive interceptors call back into user code. Effectively we are not "in_rtl" at this point, but it's very complicated and fragile to properly maintain in_rtl property. Instead get rid of it. It was used mostly for sanity CHECKs, which basically never uncover real problems. Instead introduce ignore_interceptors flag, which is used in very few narrow places to disable recursive interceptors (e.g. during runtime initialization). llvm-svn: 197979
* [Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).Alexey Samsonov2013-12-171-1/+1
| | | | | | | | | If 'symbolize' flag is not set, we still want to transform virtual address to module+offset pair in the call to Symbolizer::SymbolizeCode(). See https://code.google.com/p/address-sanitizer/issues/detail?id=251 for more details. llvm-svn: 197491
* tsan: do not leave verbosity>0 in testsDmitry Vyukov2013-11-271-2/+2
| | | | llvm-svn: 195833
* tsan: fix flags parsingDmitry Vyukov2013-11-271-0/+207
| | | | | | | | - running_on_valgrind was not parsed in some contexts - refactor code a bit - add comprehensive tests for flags parsing llvm-svn: 195831
* tsan: move shadow stack from thread descriptors to fixed addressesDmitry Vyukov2013-10-161-0/+9
| | | | | | | | This allows to increase max shadow stack size to 64K, and reliably catch shadow stack overflows instead of silently corrupting memory. llvm-svn: 192797
* [TSan] Use Clang to compile and link TSan unit tests with TSan runtimeAlexey Samsonov2013-09-114-26/+72
| | | | llvm-svn: 190503
* [tsan] make calloc crash instead of returning 0 on overflow (controlled by ↵Kostya Serebryany2013-09-061-1/+3
| | | | | | the allocator_may_return_null flag) llvm-svn: 190135
* [tsan] Move some suppressions-related code to common.Sergey Matveev2013-06-262-129/+0
| | | | | | Factor out code to be reused in LSan. Also switch from linked list to vector. llvm-svn: 184957
OpenPOWER on IntegriCloud