Commit Graph

119 Commits

Author SHA1 Message Date
Dmitry Vyukov e9a5f03716 tsan: support mmap(MAP_32BIT)
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
2014-10-24 17:07:29 +00:00
Viktor Kutuzov f266601ce9 [Tsan] Fix the thread_name tests to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5855

llvm-svn: 220552
2014-10-24 09:27:34 +00:00
Viktor Kutuzov 9003426e2f [Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5841

llvm-svn: 220550
2014-10-24 09:20:20 +00:00
Viktor Kutuzov 6b862f22e5 [Tsan] Fix the sunrpc.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5730

llvm-svn: 219791
2014-10-15 12:47:48 +00:00
Viktor Kutuzov adcf1ce904 [Tsan] Make the mutex_robust tests Linux-specific
Differential Revision: http://reviews.llvm.org/D5729

llvm-svn: 219790
2014-10-15 12:43:04 +00:00
Dmitry Vyukov 6373829449 tsan: fix false positive related to signals
Write interceptor calls malloc, which causes a false
unsafe-call-in-signal-handler report. See the test.

llvm-svn: 219784
2014-10-15 08:56:43 +00:00
Dmitry Vyukov ea2f3bffca tsan: refactor atexit handling
The current handling (manual execution of atexit callbacks)
is overly complex and leads to constant problems due to mutual ordering of callbacks.
Instead simply wrap callbacks into our wrapper to establish
the necessary synchronization.
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=80

llvm-svn: 219675
2014-10-14 09:32:45 +00:00
Dmitry Vyukov 02ff8bb986 tsan: better reporting for virtual-call-after-free
Previously we said that it's a data race, which is confusing
if it happens in the same thread.

llvm-svn: 219600
2014-10-13 08:46:25 +00:00
Viktor Kutuzov e3b6a6a379 [Tsan] Fix the getline_nohang.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5666

llvm-svn: 219482
2014-10-10 07:07:26 +00:00
Viktor Kutuzov 348758bbca [Tsan] Fix comments in the user_fopen.cc and user_malloc.cc tests
Related revision: http://reviews.llvm.org/D5670

llvm-svn: 219481
2014-10-10 07:01:52 +00:00
Viktor Kutuzov 918df1abd8 [Tsan] Make the user_fopen.cc and user_malloc.cc tests Linux-specific
Differential Revision: http://reviews.llvm.org/D5670

llvm-svn: 219478
2014-10-10 06:55:17 +00:00
Viktor Kutuzov e17b55be69 [Tsan] Fix the signal_errno.cc and signal_malloc.cc tests to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5669

llvm-svn: 219399
2014-10-09 09:40:02 +00:00
Viktor Kutuzov c2e274dc2c [Tsan] Fix the global_race tests to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5668

llvm-svn: 219398
2014-10-09 09:35:25 +00:00
Viktor Kutuzov 27781f993d [Tsan] Fix the blacklist2.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5665

llvm-svn: 219397
2014-10-09 09:04:26 +00:00
Dmitry Vyukov c0ae07e98c tsan: fix signal_longjmp test in debug mode
In debug mode tsan checks that user accesses
access user memory. NULL is not user memory.
So the test fails. Allocate real inaccessible
memory for the test.

llvm-svn: 218069
2014-09-18 19:00:02 +00:00
Dmitry Vyukov 9767d2f8da tsan: fix double semicolon ;;
llvm-svn: 218067
2014-09-18 18:58:44 +00:00
Dmitry Vyukov 538ceee2b9 tsan: fix bug number in comment
llvm-svn: 217992
2014-09-17 22:57:57 +00:00
Dmitry Vyukov 6466f43688 tsan: fix crash when a program registers zillions of atexit callbacks
I don't remember that crash on mmap in internal allocator
ever yielded anything useful, only crashes in rare wierd untested situations.
One of the reasons for crash was to catch if tsan starts allocating
clocks using mmap. Tsan does not allocate clocks using internal_alloc anymore.
Solve it once and for all by allowing mmaps.

llvm-svn: 217929
2014-09-17 00:12:50 +00:00
Dmitry Vyukov 69c4d37b45 tsan: support longjmp out of signal handlers
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=75

llvm-svn: 217908
2014-09-16 21:48:22 +00:00
Alexey Samsonov 62063b46fc Use "-gline-tables-only" instead of "-g" in sanitizer test suites.
We are interested in verifying that -gline-tables-only provides enough
debug information for verbose error reports and symbolized stack traces.

llvm-svn: 217284
2014-09-05 22:05:32 +00:00
Dmitry Vyukov f8cfdd9207 tsan: handle early signals
The second part of the fix of
https://code.google.com/p/thread-sanitizer/issues/detail?id=71

llvm-svn: 217031
2014-09-03 12:25:22 +00:00
Dmitry Vyukov 26411d6929 tsan: more precise handling of atexit callbacks
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=74

llvm-svn: 216906
2014-09-02 14:22:31 +00:00
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