Commit Graph

588 Commits

Author SHA1 Message Date
Dmitry Vyukov 46c1a4c25e tsan: implement malloc/free hooks
llvm-svn: 157196
2012-05-21 17:39:40 +00:00
Timur Iskhodzhanov ea365131a2 [ASan] Make for-Windows RTL compileable using Clang++
llvm-svn: 157188
2012-05-21 14:25:36 +00:00
Dmitry Vyukov 99ed663a42 tsan: do not assume non-recursive signal handlers
llvm-svn: 157187
2012-05-21 14:24:20 +00:00
Dmitry Vyukov 163a8338be tsan: replace CHECK with CHECK_EQ for better diagnostics
llvm-svn: 157181
2012-05-21 10:20:53 +00:00
Dmitry Vyukov 98953b7a6d tsan: better, more realistic handling of signals
llvm-svn: 157178
2012-05-21 08:26:51 +00:00
Dmitry Vyukov 9d2229f3ca tsan: add more checks for OOM conditions
tests like to try to malloc((size_t)-1)

llvm-svn: 157176
2012-05-21 06:46:27 +00:00
Dmitry Vyukov f64046cb3d tsan: check for overflow in malloc()
llvm-svn: 157048
2012-05-18 09:41:52 +00:00
Dmitry Vyukov bea47a5029 tsan: fix potential NULL deref
llvm-svn: 157047
2012-05-18 08:53:16 +00:00
Dmitry Vyukov 19b855fe3e tsan: remove shutdown code
tsan runtime shutdown is problematic for 2 reasons:
1. others crash during shutdown
2. we have to override user exit status (don't know it and can't return from atexit handler)

llvm-svn: 156991
2012-05-17 15:00:27 +00:00
Dmitry Vyukov fee5b7d2e0 tsan: detect accesses to freed memory
http://codereview.appspot.com/6214052

llvm-svn: 156990
2012-05-17 14:17:51 +00:00
Kostya Serebryany 82bcc58384 [tsan] fix dependency rules in Makefile.old
llvm-svn: 156983
2012-05-17 08:33:14 +00:00
Dmitry Vyukov 352358b715 tsan: ValgrindSlowdown() should be weak for some time
llvm-svn: 156982
2012-05-17 08:31:47 +00:00
Dmitry Vyukov 166b8e5f33 tsan: add ValgrindSlowdown() "dynamic annotation"
llvm-svn: 156981
2012-05-17 08:04:41 +00:00
Dmitry Vyukov f015a94f09 tsan: improve addr2line symbolizer
-provide support for non-continous modules
-ignore not loaded sections
-more debug output

llvm-svn: 156924
2012-05-16 16:40:47 +00:00
Kostya Serebryany e263221069 [tsan] add tiny_test.c
llvm-svn: 156908
2012-05-16 07:48:16 +00:00
Kostya Serebryany 480922f6a1 [tsan] fix old-style makefile -- we still need them to run our tests
llvm-svn: 156907
2012-05-16 07:46:55 +00:00
Kostya Serebryany c9fd917b36 [tsan] makefile machinery to build tsan-rt (linux-x86_64 only)
llvm-svn: 156822
2012-05-15 15:17:35 +00:00
Kostya Serebryany 8423f5654f [asan] fix the old-style Makefile, which we still need to run asan tests
llvm-svn: 156818
2012-05-15 12:41:14 +00:00
David Chisnall ca9c93c38d Update atomic.c to work with the new clang builtins.
llvm-svn: 156817
2012-05-15 12:36:14 +00:00
Kostya Serebryany 1dd4c606ed [asan] move lib/asan/interception to lib/interception so that other tools (e.g. tsan) can use it
llvm-svn: 156816
2012-05-15 12:21:33 +00:00
Dmitry Vyukov 572c5b2a44 tsan: add more atomics to public interface (fetch_or/and/xor + 1-,2-byte versions)
llvm-svn: 156766
2012-05-14 15:33:00 +00:00
Dmitry Vyukov 665ce2a2f4 tsan: enabled report suppression for signal-unsafe reports
llvm-svn: 156765
2012-05-14 15:28:03 +00:00
Dmitry Vyukov d004b99cc6 tsan: fix output_tests script to actually verify tests results
llvm-svn: 156764
2012-05-14 15:25:35 +00:00
Dmitry Vyukov f5cbda29cd tsan: make addr2line symbolizer understand dynamic libraries
Collect info about all dynamic libraries in the process (name, base, size).
Determine to what dyn lib the address relates, route request to addr2line instance for the lib.

llvm-svn: 156759
2012-05-14 14:38:29 +00:00
Dmitry Vyukov fa44dc5623 tsan: update output tests to race on heap memory
Races on stack of main thread are problematic for COMPAT mapping, because it's not 1-to-1 and race addr is not properly mapped from shadow back to application memory. 
Update output tests to race heap memory.

llvm-svn: 156758
2012-05-14 14:00:07 +00:00
Dmitry Vyukov b078a33151 tsan: fix mmap fd
This is mostly to test my commit access.
Fixes fd passed to mmap(), -1 is the proper invalid fd.

llvm-svn: 156741
2012-05-13 14:24:46 +00:00
Alexander Potapenko a1c3c6582c Increase error_message_buffer_size to 64K (16K is insufficient for large programs)
llvm-svn: 156711
2012-05-12 12:33:41 +00:00
Evgeniy Stepanov d989be1386 Fix GetFrameNameByAddr hitting stale stack guards.
In the current implementation AsanThread::GetFrameNameByAddr scans the
stack for a magic guard value to locate base address of the stack
frame. This is not reliable, especially on ARM, where the code that
stores this magic value has to construct it in a register from two
small intermediates; this register can then end up stored in a random
stack location in the prologue of another function.

With this change, GetFrameNameByAddr scans the shadow memory for the
signature of a left stack redzone instead. It is now possible to
remove the magic from the instrumentation pass for additional
performance gain. We keep it there for now just to make sure the new
algorithm does not fail in some corner case.

llvm-svn: 156710
2012-05-12 12:33:10 +00:00
Kostya Serebryany 0e6705ec67 [tsan] run output tests in parallel
llvm-svn: 156617
2012-05-11 14:58:20 +00:00
Kostya Serebryany 07c4805175 [tsan] run more kinds of builds as presubmit test (and fix gcc debug build)
llvm-svn: 156616
2012-05-11 14:42:24 +00:00
Kostya Serebryany 1136764ab0 [tsan] a bit more lint
llvm-svn: 156614
2012-05-11 13:49:53 +00:00
Kostya Serebryany 5b7cb1db61 [tsan] old-dstyle Makefile for tests; two helper scripts that analyze the assembly code of the hot functions
llvm-svn: 156547
2012-05-10 15:10:03 +00:00
Kostya Serebryany ff15ef0c50 [tsan] ThreadSanitizer tests and micro benchmarks. No makefiles yet.
llvm-svn: 156545
2012-05-10 14:18:22 +00:00
Kostya Serebryany df68b67f06 [tsan] add the old Makefile (which is the only way to build the tsan-rtl for now)
llvm-svn: 156544
2012-05-10 14:04:19 +00:00
Kostya Serebryany 4ad375f0a9 [tsan] First commit of ThreadSanitizer (TSan) run-time library.
Algorithm description: http://code.google.com/p/thread-sanitizer/wiki/ThreadSanitizerAlgorithm

Status:
The tool is known to work on large real-life applications, but still has quite a few rough edges.
Nothing is guaranteed yet.

The tool works on x86_64 Linux.
Support for 64-bit MacOS 10.7+ is planned for late 2012.
Support for 32-bit OSes is doable, but problematic and not yet planed.

Further commits coming:
  - tests
  - makefiles
  - documentation
  - clang driver patch

The code was previously developed at http://code.google.com/p/data-race-test/source/browse/trunk/v2/
by Dmitry Vyukov and Kostya Serebryany with contributions from
Timur Iskhodzhanov, Alexander Potapenko, Alexey Samsonov and Evgeniy Stepanov.

llvm-svn: 156542
2012-05-10 13:48:04 +00:00
Alexander Potapenko 66e6de10cf Fix ReadFileToBuffer to return 0 on failure (-1 is too large if returned as size_t).
llvm-svn: 156538
2012-05-10 12:03:09 +00:00
Alexey Samsonov fbadfddcf1 [ASan] use CLANG_VERSION in Makefile (currently 3.2)
llvm-svn: 155350
2012-04-23 13:27:47 +00:00
Kostya Serebryany c5bf3ad922 [asan] fix asan issue #66 (correctly report type of the bug)
llvm-svn: 155344
2012-04-23 10:08:16 +00:00
Alexander Potapenko 0825d35b57 Bump the LLVM minor version. This should fix our 32-bit Linux build.
llvm-svn: 155338
2012-04-23 07:36:24 +00:00
Kostya Serebryany d45a71c2bc [asan] test for issue #66
llvm-svn: 155127
2012-04-19 14:53:51 +00:00
Alexander Potapenko ec316e5940 Partially revert r154390 (http://llvm.org/viewvc/llvm-project?view=rev&revision=154390)
Until we work out the solution for http://code.google.com/p/address-sanitizer/issues/detail?id=65 we'd better not allow
the clients to override AddressSanitizer's signal handler.

The second part of r154390 (removing the sighandler-related tests) is not reverted, because those tests were broken
and didn't test anything.

llvm-svn: 154803
2012-04-16 08:33:01 +00:00
Alexey Samsonov cc0b3e6607 [asan] minor fix: pass flag -g to output tests as a part of CXXFLAGS
llvm-svn: 154589
2012-04-12 13:31:13 +00:00
Alexey Samsonov f2a8ea3afd Don't build atomic.c when building compiler-rt using make
llvm-svn: 154583
2012-04-12 09:43:57 +00:00
Alexey Samsonov a5f6fd9884 [ASan] fix output tests - r154570 changed debug info for static functions and now they are symbolized a bit differently
llvm-svn: 154581
2012-04-12 07:32:08 +00:00
Alexander Potapenko bc42d44112 Change the way ASan interacts with custom signal handlers.
From now on we allow the clients to override signal handlers set by ASan, but print a warning in such a case.

Remove the tests for signal() and sigaction(), because they made little sense even without this change.

llvm-svn: 154390
2012-04-10 11:00:26 +00:00
Alexey Samsonov 7ec936a4f4 [ASan] remove dispatch.h header once again - it's not present on Leopard, and we don't want to break the build of compiler-rt there. See https://trac.macports.org/ticket/33362
llvm-svn: 154326
2012-04-09 16:45:18 +00:00
Timur Iskhodzhanov 36a7cc6292 Use 'typename' instead of 'class' in template<> definitions supporting POD types
llvm-svn: 154314
2012-04-09 11:50:27 +00:00
Kostya Serebryany d2863dab85 [asan] last bit for gcc compatibility
llvm-svn: 154203
2012-04-06 20:36:18 +00:00
Kostya Serebryany b7f68dee45 [asan] minor change to please gcc
llvm-svn: 154201
2012-04-06 20:19:59 +00:00
Alexey Samsonov 6a19d5d209 [ASan] move replacements for new/delete to separate file
llvm-svn: 154167
2012-04-06 08:21:08 +00:00