summaryrefslogtreecommitdiff
path: root/lib/tsan/tests
AgeCommit message (Collapse)Author
2014-10-24tsan: support mmap(MAP_32BIT)Dmitry Vyukov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220571 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10[TSan] Use common flags in the same way as all the other sanitizersAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217559 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06Support building tsan_test_util_linux.cc on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D5210 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-05tsan: allocate vector clocks using slab allocatorDmitry Vyukov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214912 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15tsan: remove special handling of false reports coming from JVMDmitry Vyukov
There is now a more common functionality in the form of called_from_lib suppressions. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@213057 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08tsan: reapply 212531 and 212532 with a fixDmitry Vyukov
don't reset s->addr as well git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212565 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08[TSan] Revert r212531 and r212532.Alexey Samsonov
They cause "check-tsan" command to hang. Details in r212532 review thread. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212562 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08tsan: fix a bug in metamapDmitry Vyukov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212531 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-07Generalize sanitizer allocator public interface.Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-01[TSan] Equalize the behavior of __tsan_get_allocated_size and ↵Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212112 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-30tsan: optimize memory access functionsDmitry Vyukov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209897 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29tsan: refactor storage of meta information for heap blocks and sync objectsDmitry Vyukov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209810 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15Fix typosAlp Toker
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208841 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25tsan: better reports for "double lock of a mutex"Dmitry Vyukov
+ fixes crashes due to races on symbolizer, see: https://code.google.com/p/thread-sanitizer/issues/detail?id=55 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207204 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23tsan: reduce number of iterations in the testDmitry Vyukov
otherwise it runs for 50 seconds in debug mode git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-11tsan: fix vector clocksDmitry Vyukov
the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206035 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25[tsan] Fix more warnings in TSan tests.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204715 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25[tsan] Fix compiler warnings in TSan tests.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204712 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24tsan: optimize vector clock operationsDmitry Vyukov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204656 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24[CMake] Rename the variableAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204602 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commandsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204593 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-19[CMake] Build sanitizer unit tests with -std=c++11Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204234 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17tsan: yet another attempt to fix pthread_cond interceptorsDmitry Vyukov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204032 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-20[CMake] break dependency between unit tests and runtimes in standalone buildAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201778 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-14Move TSan lit-tests under test/tsanAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201414 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12[Sanitizer] Teach external symbolizer to work with addr2line if ↵Alexey Samsonov
llvm-symbolizer is unavailable. Allow this mode in TSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201218 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-24tsan: do not deadlock on forkDmitry Vyukov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199993 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-25[Sanitizer] Use different MemoryMappingLayout::DumpListOfModules on Linux ↵Alexey Samsonov
and Mac. Make a unit test added in r198004 more robust. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198012 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-24tsan: remove in_rtl counterDmitry Vyukov
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). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197979 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-17[Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197491 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-27tsan: do not leave verbosity>0 in testsDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195833 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-27tsan: fix flags parsingDmitry Vyukov
- running_on_valgrind was not parsed in some contexts - refactor code a bit - add comprehensive tests for flags parsing git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195831 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16tsan: move shadow stack from thread descriptors to fixed addressesDmitry Vyukov
This allows to increase max shadow stack size to 64K, and reliably catch shadow stack overflows instead of silently corrupting memory. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192797 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-11[TSan] Use Clang to compile and link TSan unit tests with TSan runtimeAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190503 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-06[tsan] make calloc crash instead of returning 0 on overflow (controlled by ↵Kostya Serebryany
the allocator_may_return_null flag) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26[tsan] Move some suppressions-related code to common.Sergey Matveev
Factor out code to be reused in LSan. Also switch from linked list to vector. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184957 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07[sanitizer] Move GetThreadStackAndTls from TSan to sanitizer_common.Sergey Matveev
Move this function to sanitizer_common because LSan uses it too. Also, fix a bug where the TLS range reported for main thread was off by the size of the thread descriptor from libc (TSan doesn't care much, but for LSan it's critical). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@181322 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25[TSan] Build TSan unit tests with the same compile flags as TSan runtimeAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177859 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20tsan: fix incorrect test Dmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177519 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18tsan: smaller memory block headers (32b->16b)Dmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177312 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25[TSan] Add interceptor for malloc_usable_size()Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176013 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04[Sanitizer] extend internal libc with stat/fstat/lstat functionsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174316 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01[Sanitizer] make internal_open have the same interface as libc versionAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174187 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01tsan: flip is_write bit in shadow to is_readDmitry Vyukov
this makes calculation of interesting predicates faster git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01tsan: detect races between plain and atomic memory accessesDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30[Sanitizer] update style checker script and fix namespace style warningsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173910 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25[sanitizer] fix calloc overflow in asan/tsan/msanKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173441 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24tsan: allow a front-end to provide default suppressionsDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173345 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24tsan: implement malloc stats queryingDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18CMake variables renaming: X86_64->x86_64 I386->i386Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172812 91177308-0d34-0410-b5e6-96231b3b80d8