Commit Graph

2121 Commits

Author SHA1 Message Date
Dmitry Vyukov f2cbda4082 tsan: print statistics about benign race annotations
(total count, unique, matched) if requested with print_benign=1
flag.

llvm-svn: 178245
2013-03-28 16:21:19 +00:00
Alexey Samsonov a88c60b085 [ASan] Speed-up initialization-order checking: create and use fast versions of PoisonShadow functions, store copies of __asan_global descriptors in a vector instead of list of pointers. This gives 3x speedup on both benchmarks and real binaries with lots of globals.
llvm-svn: 178239
2013-03-28 15:42:43 +00:00
Alexey Samsonov cfe56d47da [Sanitizer] Minor enhancements in InternalVector container
llvm-svn: 178238
2013-03-28 15:37:11 +00:00
Kostya Serebryany 3e73c84050 [tsan] a test checking that memset/memcpy/memmove are not inlined in tsan mode
llvm-svn: 178231
2013-03-28 11:21:50 +00:00
Alexey Samsonov e586170e86 Fix unmatching ASan runtime flag for init-order checking exposed by r178158. Add a test for r178158.
llvm-svn: 178229
2013-03-28 09:11:20 +00:00
Kostya Serebryany ac83282665 [tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)
llvm-svn: 178228
2013-03-28 08:41:49 +00:00
Richard Smith 74e3d39710 compiler-rt part of r178194. Remove ubsan test for diagnostic on inf/nan conversion between floating-point types.
llvm-svn: 178195
2013-03-27 23:21:10 +00:00
Dmitry Vyukov b365d40415 tsan: print matched suppressions if print_suppressions=1 flag is provided
llvm-svn: 178159
2013-03-27 17:59:57 +00:00
Dmitry Vyukov fd3f5ec0cb tsan: better flag parsing: do not confuse flag that is a part of another flag
(e.g. suppressions and print_suppressions)

llvm-svn: 178158
2013-03-27 17:59:13 +00:00
Dmitry Vyukov 9f08fe5065 tsan: fix lint warning
llvm-svn: 178157
2013-03-27 17:57:58 +00:00
Alexey Samsonov 7152debedd [ASan] Demangle global names in error reports.
llvm-svn: 178131
2013-03-27 10:41:22 +00:00
Alexey Samsonov f903a9ee6e [TSan] Fixup for r178128: verify that TSan indeed doesn't report race
llvm-svn: 178129
2013-03-27 10:22:51 +00:00
Alexey Samsonov 059e61f8b0 [TSan] Run test output through FileCheck
llvm-svn: 178128
2013-03-27 09:25:06 +00:00
Alexey Samsonov 56a784d2f6 [ASan] Change the ABI of __asan_before_dynamic_init function: now it takes pointer to private string with module name. This string serves as a unique module ID in ASan runtime. compiler-rt part
llvm-svn: 178014
2013-03-26 13:06:12 +00:00
Alexander Potapenko 29310ba077 [libsanitizer] Fix the Win build.
llvm-svn: 178012
2013-03-26 13:02:11 +00:00
Kostya Serebryany 79a6e189b0 [tsan] make memcpy_race.cc test immune to memcpy inlining
llvm-svn: 178011
2013-03-26 12:42:18 +00:00
Dmitry Vyukov 6f4b34bcf4 asan/tsan: move strcasecmp() interceptor to sanitizer_common
llvm-svn: 178010
2013-03-26 12:40:23 +00:00
Dmitry Vyukov f3bc56bb6b asan/tsan: change SANITIZER_GO to more general SANITIZER_SUPPORTS_WEAK_HOOKS
llvm-svn: 178009
2013-03-26 12:07:04 +00:00
Alexander Potapenko f8109dd0f8 [libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 178000
2013-03-26 10:34:37 +00:00
Alexey Samsonov 7ef76c1cd8 [Sanitizer] Disable atomic_test on Android, where it crashes Clang.
llvm-svn: 177998
2013-03-26 08:55:38 +00:00
Kostya Serebryany 4d7efba66e [tsan] add a test for aligned-vs-unaligned race (tsan's false negative)
llvm-svn: 177996
2013-03-26 08:31:02 +00:00
Kostya Serebryany 88b2b45ec8 [asan] print thread number while reporting invalid-free and double-free; add tests; also add a test for use-after-poison
llvm-svn: 177993
2013-03-26 08:01:37 +00:00
Timur Iskhodzhanov 2dee3dd61c Add a GetTid() implementation for Windows
llvm-svn: 177927
2013-03-25 22:04:29 +00:00
Alexey Samsonov 6210e1f9ff Add basic support for building profile compiler-rt library in CMake build on Darwin
llvm-svn: 177870
2013-03-25 14:20:11 +00:00
Alexey Samsonov 961b636cf1 [ASan] Use dynamic symbol table when checking exported ASan runtime symbols
llvm-svn: 177868
2013-03-25 13:47:53 +00:00
Dmitry Vyukov 7886253fee asan/tsan: add Printf/Report hook
The hook can be overriden in frontend to print to e.g. a file.

llvm-svn: 177864
2013-03-25 12:58:09 +00:00
Alexey Samsonov 9328ba400a [ASan] mark local function as static
llvm-svn: 177862
2013-03-25 11:38:42 +00:00
Alexey Samsonov acfb82e611 [Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.
llvm-svn: 177860
2013-03-25 10:31:49 +00:00
Alexey Samsonov 31a2c483ed [TSan] Build TSan unit tests with the same compile flags as TSan runtime
llvm-svn: 177859
2013-03-25 10:23:20 +00:00
Dmitry Vyukov 4adf49d253 tsan: intercept setjmp/longjmp
llvm-svn: 177858
2013-03-25 10:10:44 +00:00
Dmitry Vyukov 510ad11800 tsan: add SetEnv() function that can be used in frontends
llvm-svn: 177857
2013-03-25 09:56:45 +00:00
Alexey Samsonov a208c397bf [Sanitizer] First effort to implement atomic_compare_exchange for 1-byte vars on Windows
llvm-svn: 177854
2013-03-25 09:23:30 +00:00
Alexey Samsonov c6fd019c77 [Sanitizer] Add basic test for atomic_compare_exchange implementation
llvm-svn: 177851
2013-03-25 08:48:16 +00:00
Richard Smith c91e327cba Build and install .syms files alongside sanitizer runtimes. These are used to
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.

llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Timur Iskhodzhanov fb74020cea Revert 177745 as it was incorrect
llvm-svn: 177746
2013-03-22 18:16:57 +00:00
Timur Iskhodzhanov e117eef77f Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...
llvm-svn: 177745
2013-03-22 18:05:28 +00:00
Dmitry Vyukov 9af68719ed tsan: return 0 on malloc() failure instead of crashing
llvm-svn: 177741
2013-03-22 17:06:22 +00:00
Evgeniy Stepanov ecbf64648f [msan] Handle dlopen() failure in dlopen interceptor.
llvm-svn: 177728
2013-03-22 11:59:49 +00:00
Dmitry Vyukov 3bd5ffb62b tsan: test that tsan explicitly says "race on vptr".
Requires llvm r177717.

llvm-svn: 177726
2013-03-22 10:54:39 +00:00
Kostya Serebryany 667a34a120 [asan] Change the way we report the alloca frame on stack-buff-overflow.
Before: the function name was stored by the compiler as a constant string
and the run-time was printing it.
Now: the PC is stored instead and the run-time prints the full symbolized frame.
This adds a couple of instructions into every function with non-empty stack frame,
but also reduces the binary size because we store less strings (I saw 2% size reduction).
This change bumps the asan ABI version to v3.

compiler-rt part, llvm part will follow.

Example of report (now):
==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8
READ of size 1 at 0x7fffa77cf1c5 thread T0
    #0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20
    #1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24
    #2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28
    #3 0x41f194 in Frame3(int) stack-oob-frames.cc:32
    #4 0x41eee0 in main stack-oob-frames.cc:38
    #5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c)
Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame
    #0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12  <<<<<<<<<<<<<< this is new
  This frame has 6 object(s):
    [32, 36) 'frame.addr'
    [96, 104) 'a.addr'
    [160, 168) 'b.addr'
    [224, 232) 'c.addr'
    [288, 292) 's'
    [352, 360) 'd'

llvm-svn: 177723
2013-03-22 10:36:24 +00:00
Evgeniy Stepanov 93a842bd1f [msan] Move test main and gtest include to separate files.
llvm-svn: 177718
2013-03-22 09:01:26 +00:00
Evgeniy Stepanov bfe9df221d [msan] Place dlopen in an anon namespace.
llvm-svn: 177716
2013-03-22 08:49:36 +00:00
Dmitry Vyukov 2f411641fe tsan: work around FileCheck bug with empty outputs
llvm-svn: 177715
2013-03-22 08:48:34 +00:00
Evgeniy Stepanov 5d69168906 [msan] Get rid of "using std::string" in msandr.
llvm-svn: 177714
2013-03-22 08:47:42 +00:00
Alexey Samsonov f1311dfce1 [ASan] fix-up for r177634 on Windows.
llvm-svn: 177711
2013-03-22 07:48:23 +00:00
Alexey Samsonov a5eb3cb721 [ASan] Fix an error on invalid deallocation in ASan allocator. When ASan checks if memory freed by user was indeed previously allocated, it first does an atomic write to presumed location of chunk header. This is wrong, as if the free is invalid, we may overwrite some valuable data (like other fields of the chunk header). Fix this by using atomic_compare_exchange instead.
llvm-svn: 177710
2013-03-22 07:40:34 +00:00
Dmitry Vyukov a7e42b5be5 asan: fix lint warning about line length
llvm-svn: 177709
2013-03-22 07:29:59 +00:00
Richard Smith b30d11194c ubsan: Pass floating-point arguments to the runtime by value if they fit the
value argument.

llvm-svn: 177689
2013-03-22 00:47:05 +00:00
Richard Smith 1ea5b805ce Don't forget to link in the C++-specific parts of the ubsan runtime when using the Makefile build system on Darwin.
llvm-svn: 177684
2013-03-22 00:01:44 +00:00
Dmitry Vyukov ebf63d0095 tsan: better reporting of thread leaks
1. do not report running threads as leaks
2. aggregate leaked threads by creation stack

llvm-svn: 177647
2013-03-21 16:55:17 +00:00