Dmitry Vyukov
1841219abd
tsan: restructure signal handling to allow recursive handling
...
Fixes issue
https://code.google.com/p/thread-sanitizer/issues/detail?id=71
llvm-svn: 216903
2014-09-02 12:27:45 +00:00
Dmitry Vyukov
34fb3799a3
tsan: fix false positive related to signal handlers
...
Users expect synchronization between sigaction and arrival
of the signal. See the test for details.
llvm-svn: 216878
2014-09-01 12:46:42 +00:00
Alexey Samsonov
591d15272e
[TSan] Add -lpthread to the test which uses pthread_ functions
...
llvm-svn: 215939
2014-08-18 22:09:17 +00:00
Dmitry Vyukov
70db9d4d72
tsan: allocate vector clocks using slab allocator
...
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
2014-08-05 18:45:02 +00:00
Dmitry Vyukov
5b1b02eb29
tsan: improve shadow flush benchmark
...
allow to specify access stride
llvm-svn: 214029
2014-07-26 16:40:33 +00:00
Kostya Serebryany
6cdb0b8051
[tsan] honour XFAIL in tsan/test_output.sh
...
llvm-svn: 212952
2014-07-14 16:03:13 +00:00
Kostya Serebryany
850a837cf2
[tsan] add a printf to a test
...
llvm-svn: 212951
2014-07-14 15:52:33 +00:00
Kostya Serebryany
94b6801839
[tsan] add a currently-failing test with a must-deadlock
...
llvm-svn: 212944
2014-07-14 14:27:21 +00:00
Diego Novillo
89360191c8
Fix expected column numbers in two tests.
...
This is a minor fix to two tsan tests that were expecting the wrong
column information. Now that clang emits column information by default
in its debugging output, the tests had started failing.
llvm-svn: 212779
2014-07-10 23:29:10 +00:00
Alexey Samsonov
3a2cb3ad41
[TSan] Fix a bug in libcxx-tsan build conditions spotted by Ryuta Suzuki
...
llvm-svn: 212749
2014-07-10 18:17:51 +00:00
Dmitry Vyukov
3f5ad1a98e
tsan: allow memory overlap in __tsan_java_move
...
JVM actually moves memory between overlapping ranges.
llvm-svn: 212560
2014-07-08 20:01:12 +00:00
Kostya Serebryany
6136aae323
[tsan] Enable tsan's deadlock detector by default.
...
The tsan's deadlock detector has been used in Chromium for a while;
it found a few real bugs and reported no false positives.
So, it's time to give it a bit more exposure.
llvm-svn: 212533
2014-07-08 13:40:08 +00:00
Alexey Samsonov
c1856835d1
[Sanitizer] Move test for malloc/free hooks under test/sanitizer_common
...
llvm-svn: 212474
2014-07-07 18:47:29 +00:00
Alexey Samsonov
91bb8e0e3a
Generalize sanitizer allocator public interface.
...
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
2014-07-07 17:39:31 +00:00
Dmitry Vyukov
9507af2d89
tsan: fix and re-enable a test
...
llvm-svn: 211966
2014-06-27 22:27:02 +00:00
Evgeniy Stepanov
63338af398
[tsan] Disable a failing test.
...
java_finalizer is failing on all sanitizer bots since it was added in r211829.
llvm-svn: 211882
2014-06-27 08:10:27 +00:00
Dmitry Vyukov
fb251f51a9
tsan: add __tsan_java_finalize interface function
...
It is required to prevent false positives between object ctor and finalizer,
as otherwise they look completely unsynchronized.
llvm-svn: 211829
2014-06-27 00:47:38 +00:00
Alexey Samsonov
f0d1fd6b32
[TSan] Exclude blacklist tests from manual test runner
...
llvm-svn: 210494
2014-06-09 22:02:14 +00:00
Alexey Samsonov
2c8dda4e53
[TSan] Make lit-tests more self-contained
...
llvm-svn: 210370
2014-06-06 21:04:55 +00:00
Alexey Samsonov
5c8ce21a6c
[TSan] Add a test case for r209939
...
llvm-svn: 209940
2014-05-31 00:12:20 +00:00
Dmitry Vyukov
dee68ba6e3
tsan: add a test from data-race-test suite:
...
https://code.google.com/p/data-race-test/source/browse/trunk/unittest/racecheck_unittest.cc
llvm-svn: 209900
2014-05-30 14:27:31 +00:00
Dmitry Vyukov
233f401c2b
tsan: make positive tests more robust
...
Add a script that is used to deflake inherently flaky tsan tests.
It is invoked from lit tests as:
%deflake %run %t
The script runs the target program up to 10 times,
until it produces a tsan warning.
llvm-svn: 209898
2014-05-30 14:08:51 +00:00
Dmitry Vyukov
bde4c9c773
tsan: refactor storage of meta information for heap blocks and sync objects
...
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
2014-05-29 13:50:54 +00:00
Evgeniy Stepanov
15d71b598e
[sanitizer] Replace -lpthread with -pthread in tests.
...
-lpthread does not work on Android.
llvm-svn: 209735
2014-05-28 13:13:30 +00:00
Dmitry Vyukov
96ebc5d7db
tsan: deflake test
...
llvm-svn: 209290
2014-05-21 12:02:08 +00:00
Alexey Samsonov
41c7302888
[TSan] Improve support for running TSan test suite with GCC-TSan.
...
Test results with GCC-4.9.0: 78 expected passes, 74 unexpected failures.
llvm-svn: 209014
2014-05-16 20:33:56 +00:00
Alexey Samsonov
36132035ca
[CMake] Don't build libcxx_tsan with compilers other than Clang
...
llvm-svn: 209003
2014-05-16 18:22:04 +00:00
Alp Toker
1ee7fc7a1a
Fix typos
...
llvm-svn: 208841
2014-05-15 02:22:34 +00:00
Alexey Samsonov
5716928ae2
[TSan] Build TSan-instrumented version of libcxx and use it in lit tests.
...
TSan can produce false positives in code that uses C++11 threading,
as it doesn't see synchronization inside standard library. See
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035408.html
for an example of such case.
We may build custom TSan-instrumented version libcxx to fight with that.
This change adds build rules for libcxx_tsan and integrates it into
testing infrastructure.
llvm-svn: 208737
2014-05-13 22:30:16 +00:00
Alexander Potapenko
4a6cac4382
[libsanitizer] Use internal_fork() to spawn the symbolizer process.
...
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61
llvm-svn: 208707
2014-05-13 16:17:54 +00:00
Greg Fitzgerald
b8aae5405b
Add %run to all lit tests
...
llvm-svn: 207709
2014-04-30 21:34:17 +00:00
Dmitry Vyukov
56a18f02ea
tsan: better reports for "read lock of a write locked mutex"
...
llvm-svn: 207209
2014-04-25 08:58:23 +00:00
Dmitry Vyukov
e296164f77
tsan: improve "read unlock of a write locked mutex" report
...
llvm-svn: 207208
2014-04-25 08:21:30 +00:00
Dmitry Vyukov
66dbbbc47b
tsan: fix tests
...
failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/3747/steps/test/logs/stdio
llvm-svn: 207207
2014-04-25 08:13:45 +00:00
Dmitry Vyukov
2c87108a42
tsan: better report for bad mutex unlocks
...
+ fixes crashes due to races on symbolizer, see
https://code.google.com/p/thread-sanitizer/issues/detail?id=55
llvm-svn: 207206
2014-04-25 07:55:11 +00:00
Dmitry Vyukov
ea014b787a
tsan: add new test for commit 207204 (forget to add new file)
...
llvm-svn: 207205
2014-04-25 07:49:36 +00:00
Dmitry Vyukov
ac81ee5533
tsan: fix atexit handling after fork
...
fixes issue http://code.google.com/p/thread-sanitizer/issues/detail?id=57
llvm-svn: 206980
2014-04-23 13:42:16 +00:00
Dmitry Vyukov
b1edac069e
tsan: more precise check for "app memory" in COMPAT mode
...
this fires when a user makes mmap with fixed address (see the test)
llvm-svn: 206952
2014-04-23 07:01:02 +00:00
Dmitry Vyukov
5e52f3a142
tsan: deflake test
...
ocasionally it fails with a slightly different report:
WARNING: ThreadSanitizer: signal handler spoils errno (pid=3674)
#0 MyHandler(int, siginfo*, void*)
...
#4 __tsan_free_hook
#5 main signal_errno.cc:40
llvm-svn: 206754
2014-04-21 14:21:24 +00:00
Dmitry Vyukov
10d4b14a16
tsan: add benchmark that allows to investigate shadow memory consumption
...
llvm-svn: 206578
2014-04-18 10:37:39 +00:00
Evgeniy Stepanov
77d8793fa6
[tsan] Fix output tests.
...
llvm-svn: 206031
2014-04-11 13:01:20 +00:00
Evgeniy Stepanov
652cbd7c15
[tsan] Fix false positive on xdr*_create.
...
llvm-svn: 206030
2014-04-11 12:29:24 +00:00
Dmitry Vyukov
1d66c4d5b7
tsan: improve error message in test
...
we've seen a flake on this test
next time it happens we will be able to gather some info
llvm-svn: 205619
2014-04-04 09:52:41 +00:00
Alexey Samsonov
28f30b4176
[TSan] Make this test more portable
...
llvm-svn: 205300
2014-04-01 11:51:50 +00:00
Kostya Serebryany
432c46bf70
[sanitizer] one more stress test for the deadlock detector; this one stresses the slow path with a global lock
...
llvm-svn: 205299
2014-04-01 11:35:55 +00:00
Alexander Potapenko
0315b52444
[TSan] Follow-up for r205175: typo fix in the test.
...
llvm-svn: 205176
2014-03-31 10:51:13 +00:00
Dmitry Vyukov
e31dd3473e
tsan: deflake test
...
llvm-svn: 204824
2014-03-26 15:51:11 +00:00
Dmitry Vyukov
4bfb4cb1e7
tsan: add pthread_barrier_t test
...
llvm-svn: 204810
2014-03-26 14:13:49 +00:00
Dmitry Vyukov
775b11cc53
tsan: reduce default number of threads in benchmarks
...
buildbots seem to OOM with that many threads
llvm-svn: 204610
2014-03-24 15:23:05 +00:00
Dmitry Vyukov
238bd23534
tsan: add benchmarks for synchronization handling
...
llvm-svn: 204608
2014-03-24 14:32:59 +00:00
Kostya Serebryany
3df5d87da4
[sanitizer] print threads in deadlock report
...
llvm-svn: 204461
2014-03-21 13:00:18 +00:00
Kostya Serebryany
7317d9499b
[sanitizer] more human-readable deadlock reports
...
llvm-svn: 204454
2014-03-21 11:37:43 +00:00
Dmitry Vyukov
454abc0093
tsan: deflake test
...
llvm-svn: 204340
2014-03-20 13:27:11 +00:00
Dmitry Vyukov
1af191e1f4
tsan: add test for second_deadlock_stack flag
...
llvm-svn: 204240
2014-03-19 15:00:38 +00:00
Kostya Serebryany
2ea796e05f
[sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
...
llvm-svn: 204225
2014-03-19 12:26:33 +00:00
Dmitry Vyukov
eac8cc7a42
tsan: fix flaky test
...
llvm-svn: 204119
2014-03-18 06:37:31 +00:00
Kostya Serebryany
5c0171b811
[sanitizer] a bit more informative deadlock detector report (still lots to improve)
...
llvm-svn: 204115
2014-03-18 05:56:14 +00:00
Kostya Serebryany
f01c094cdd
[sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph)
...
llvm-svn: 204043
2014-03-17 14:56:04 +00:00
Kostya Serebryany
8976539627
[sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
...
llvm-svn: 204042
2014-03-17 14:41:36 +00:00
Kostya Serebryany
779ccf3b2c
[sanitizer] one more output test for the deadlock detector
...
llvm-svn: 204036
2014-03-17 09:32:48 +00:00
Kostya Serebryany
b9cb473fb8
[sanitizer] fix build warnings; add an output test for the deadlock detecor
...
llvm-svn: 204035
2014-03-17 09:21:41 +00:00
Dmitry Vyukov
a02fac7bec
tsan: update the test since the bug is fixed
...
http://llvm.org/bugs/show_bug.cgi?id=19113 is fixed, so enable the better CHECK
llvm-svn: 203784
2014-03-13 10:54:16 +00:00
Kostya Serebryany
de3f20cf4b
[sanitizer] support recursive rwlocks in bitset-based deadlock detector
...
llvm-svn: 203779
2014-03-13 10:26:03 +00:00
Dmitry Vyukov
8c0f86e307
tsan: fix handling of pthread_cond_wait in presence of pthread_cancel
...
if the thread is cancelled in pthread_cond_wait, it locks the mutex before
processing pthread_cleanup stack
but tsan was missing that, thus reporting false double-lock/wrong-unlock errors
see the test for details
llvm-svn: 203648
2014-03-12 09:48:14 +00:00
Dmitry Vyukov
47fd6179b1
tsan: add disabled test for http://llvm.org/bugs/show_bug.cgi?id=19113
...
llvm-svn: 203646
2014-03-12 08:24:49 +00:00
Dmitry Vyukov
811d16c953
tsan: prevent actual deadlock in deadlock detector test
...
llvm-svn: 202502
2014-02-28 14:34:25 +00:00
Kostya Serebryany
eae464f911
[sanitizer] speedup deadlock detector for the case when we acquire the first lock in a thread
...
llvm-svn: 202492
2014-02-28 11:56:14 +00:00
Kostya Serebryany
afc4f2af76
[sanitizer] speedup deadlock detector for the case when we destroy a mutex that has never been locked
...
llvm-svn: 202487
2014-02-28 10:59:33 +00:00
Dmitry Vyukov
371639ea1f
tsan: deflake test
...
llvm-svn: 202484
2014-02-28 10:47:07 +00:00
Kostya Serebryany
261993ad1a
[sanitizer] a test for recursive rwlock and deadlock detector (currently fails)
...
llvm-svn: 202480
2014-02-28 10:03:51 +00:00
Kostya Serebryany
b86b56c0db
[tsan] one more test for deadlock detector
...
llvm-svn: 202476
2014-02-28 09:17:16 +00:00
Dmitry Vyukov
a12923e265
tsan: intercept vfork
...
this fixes obscure false positives
see the comments and the test for details
llvm-svn: 202400
2014-02-27 14:36:16 +00:00
Dmitry Vyukov
17ca4d06c7
tsan: 2 more deadlock detector benchmarks
...
llvm-svn: 202379
2014-02-27 12:05:17 +00:00
Dmitry Vyukov
8a0813d944
tsan: fix deadlock detector lit test output
...
llvm-svn: 202368
2014-02-27 09:18:08 +00:00
Dmitry Vyukov
511118c762
tsan: add another deadlock detector benchmark
...
llvm-svn: 202366
2014-02-27 09:05:07 +00:00
Dmitry Vyukov
794500ae4e
tsan: add recursive deadlock detector benchmark
...
llvm-svn: 202361
2014-02-27 08:33:52 +00:00
Dmitry Vyukov
c546943b6a
tsan: improve deadlock detector test
...
- allow to specify which test to run
- allow to specify number of iterations
- specify number of threads required in the test itself
llvm-svn: 202358
2014-02-27 08:04:20 +00:00
Dmitry Vyukov
0f34a3ba8c
tsan: fix deadlock detector test so that it does not force contention in runtime
...
llvm-svn: 202278
2014-02-26 17:06:58 +00:00
Kostya Serebryany
67968cbf93
[sanitizer] minimal support for recursive locks indeadlock detector
...
llvm-svn: 202153
2014-02-25 14:02:01 +00:00
Alexey Samsonov
98aa08c0e9
Update sanitizers' bash scripts.
...
* Fix bash scripts to work on FreeBSD (patch by Viktor Kutuzov)
* Update locations of lit tests in check_lint script.
llvm-svn: 202145
2014-02-25 12:09:25 +00:00
Kostya Serebryany
01be296dbb
[sanitizer] support pthread_rwlock_rd* in deadlock detector
...
llvm-svn: 202132
2014-02-25 10:33:37 +00:00
Kostya Serebryany
fd88edfddb
[sanitizer] partially support pthread_rwlock_* (no rd* form yet)
...
llvm-svn: 202128
2014-02-25 09:33:10 +00:00
Kostya Serebryany
8f240ec03f
[tsan] add deadlock detector tests for pthread_spin_lock
...
llvm-svn: 202123
2014-02-25 08:42:34 +00:00
Kostya Serebryany
11f4f30fa7
[sanitizer] add support for try_lock in deadlock detector
...
llvm-svn: 202120
2014-02-25 08:24:15 +00:00
Kostya Serebryany
d77dfcb384
[tsan] one more test for deadlock detector
...
llvm-svn: 202026
2014-02-24 11:45:47 +00:00
Kostya Serebryany
0548c79859
[tsan] add coarse-grained lock around the DeadlockDetector. We can do better than that, but that's a start.
...
llvm-svn: 201861
2014-02-21 15:07:18 +00:00
Alexey Samsonov
5e6d83258e
[CMake] lit tests shouldn't depend on runtimes in standalone build
...
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Alexey Samsonov
31043152d3
Add rudimentary support for running compiler-rt lit tests with GCC
...
llvm-svn: 201680
2014-02-19 15:13:14 +00:00
Kostya Serebryany
699b975014
[tsan] improve the test that checks for lock inversion with 3 locks
...
llvm-svn: 201676
2014-02-19 14:24:31 +00:00
Kostya Serebryany
b51f8d4990
[tsan] when printing a mutex, also print its address. Properly print the deadlock report.
...
llvm-svn: 201675
2014-02-19 14:17:25 +00:00
Alexey Samsonov
cd8535a96d
[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
...
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Kostya Serebryany
37ce26cb16
[sanitizer] when reporting a deadlock also report the lock cycle
...
llvm-svn: 201576
2014-02-18 14:56:19 +00:00
Kostya Serebryany
bd86a29a2a
[sanitizer] make sure the deadlock detector survives the change of epochs; add a test and a comment
...
llvm-svn: 201572
2014-02-18 13:41:49 +00:00
Kostya Serebryany
aa416c39cd
[tsan] in deadlock detector do not register locks on their creation and unregister them on destruction; added a relevant test
...
llvm-svn: 201568
2014-02-18 12:50:31 +00:00
Kostya Serebryany
67bf8bd124
[tsan] one more lit test for deadlock detector; more to come
...
llvm-svn: 201554
2014-02-18 09:08:03 +00:00
Alexey Samsonov
1c9b9bcb5c
Simplify defining Clang compile flags in lit configs
...
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Alexey Samsonov
e6a6183e9b
Move TSan lit-tests under test/tsan
...
llvm-svn: 201414
2014-02-14 14:35:48 +00:00