Commit Graph

2197 Commits

Author SHA1 Message Date
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
Dmitry Vyukov 0851fa8819 tsan: better reporting for races on vptr
explicitly say "ctor/dtor vs virtual call"

llvm-svn: 177640
2013-03-21 15:37:39 +00:00
Dmitry Vyukov 2c3b919ad3 tsan: add flag to control symbolizer flush frequency
llvm-svn: 177638
2013-03-21 13:01:50 +00:00
Dmitry Vyukov 69c323d66f tsan: intercept abort() to fflush() libc streams
llvm-svn: 177637
2013-03-21 12:50:43 +00:00
Dmitry Vyukov 6911a7f1d1 tsan: remove bogus CHECK
Asynchronous signal (e.g. SIGABRT) can be received with any value of in_rtl.

llvm-svn: 177636
2013-03-21 12:44:44 +00:00
Alexey Samsonov 54afba8b62 [ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ASan-specific AsanThreadRegistry.
llvm-svn: 177634
2013-03-21 11:23:41 +00:00
Dmitry Vyukov 48e5d4a2d3 tsan: flush symbolizer cache if not symbolized for more than 5 seconds
llvm-svn: 177629
2013-03-21 07:02:36 +00:00
Dmitry Vyukov 5e797a8e57 tsan: add a comment about magic numbers
llvm-svn: 177628
2013-03-21 06:28:04 +00:00
Dmitry Vyukov 78693730a4 tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
llvm-svn: 177627
2013-03-21 06:24:31 +00:00
Richard Smith b6f3905450 Per discussion on cxx-abi-dev, switch from comparing type_info objects to
comparing type_info names, since the latter have better uniqueness guarantees
in practice.

llvm-svn: 177618
2013-03-21 00:42:03 +00:00
Richard Smith e86b7b0bb9 Split ubsan runtime into three pieces (compiler-rt part):
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other
   sanitizer runtime is present.
 * libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on
   a C++ ABI library, and is always linked in.
 * libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a
   C++ ABI library, and is only linked in when linking a C++ binary.

The Darwin ubsan runtime is unchanged.

For more details, see Clang change r177605.

llvm-svn: 177606
2013-03-20 23:49:17 +00:00
Bill Wendling 7184d34f96 Add declaration for linux.
llvm-svn: 177601
2013-03-20 23:21:08 +00:00
Bill Wendling 51a6ff5799 Create a coverage initialization function.
This function replaces the call of `atexit' from being generated in the compile
units. Basically, it registers the "writeout" and "flush" functions (if
present). It will generate calls to the `atexit' function for cleanups and final
writeout functions, but only once. This is better than checking for `main',
because a library may not have a `main' function in it.
<rdar://problem/12439551>

llvm-svn: 177578
2013-03-20 21:11:47 +00:00
Dmitry Vyukov 6120bac6e6 tsan: correct sizes of signal-related data structures
llvm-svn: 177526
2013-03-20 14:57:28 +00:00
Dmitry Vyukov 9f94dff7a6 tsan: add missing stat descriptions
llvm-svn: 177523
2013-03-20 14:04:23 +00:00
Dmitry Vyukov 0954e9c01d tsan: call fflush(0) on exit again
llvm-svn: 177522
2013-03-20 14:01:10 +00:00
Dmitry Vyukov c638a7127e tsan: reduce size of mutexsets from 64 to 16 mutexes
overflow is handled anyway
saves memory because each thread holds 1024 mutexsets

llvm-svn: 177520
2013-03-20 13:50:47 +00:00
Dmitry Vyukov 3330200d92 tsan: fix incorrect test
llvm-svn: 177519
2013-03-20 13:49:45 +00:00
Dmitry Vyukov b62c158d81 tsan: special handling of .rodata (don't try to find races, don't keep shadow, dont' put into traces)
llvm-svn: 177517
2013-03-20 13:21:50 +00:00
Dmitry Vyukov ccbdea956f tsan: fix build
llvm-svn: 177513
2013-03-20 11:22:03 +00:00
Dmitry Vyukov 79915de6af tsan: move trace header into 0x600000000000 range
eliminat thread "dead info" altogether

llvm-svn: 177512
2013-03-20 10:31:53 +00:00
Dmitry Vyukov b6eace8a2f tsan: add internal_unlink() function
llvm-svn: 177510
2013-03-20 10:28:36 +00:00
Alexey Samsonov 920b3b9a0c [ASan] Move malloc stats collection away from AsanThreadRegistry class.
llvm-svn: 177508
2013-03-20 10:11:24 +00:00
Dmitry Vyukov 31056968fc asan/tsan: reduce per-thread memory allocator caches
256 blocks (which is 512 in reallity) seems to be too big cache,
reducing the size reduces memory consumption but does not degrade performance.

llvm-svn: 177502
2013-03-20 09:26:46 +00:00
Alexey Samsonov cf025cb2e6 [ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class into plain functions: they don't actually use registry
llvm-svn: 177501
2013-03-20 09:23:28 +00:00
Dmitry Vyukov b7c68ee856 tsan: fix flaky test
llvm-svn: 177500
2013-03-20 09:22:13 +00:00
Dmitry Vyukov f6c4a7a2f5 tsan: fix incorrect test
llvm-svn: 177499
2013-03-20 09:21:49 +00:00
Evgeniy Stepanov 52b2d13245 [sanitizer] Enable prctl interceptor on Android.
llvm-svn: 177497
2013-03-20 07:35:52 +00:00
Bill Wendling e647659d58 Add a way to register and execute "writeout" functions.
It may be prohibitively expensive to write out >1000 files at the same time. So
we would rather emit them serially. These functions allow the GCOV
implementation to register the functions that writeout the GCOV information per
compile unit. At exit, they are written.
<rdar://problem/12439551>

llvm-svn: 177436
2013-03-19 21:01:19 +00:00
Evgeniy Stepanov 9a8f0f55d5 [asan] s/ASAN_POSIX/SANITIZER_POSIX/
llvm-svn: 177407
2013-03-19 15:26:41 +00:00
Evgeniy Stepanov 95eaa21637 [sanitizer] More renamed macros.
llvm-svn: 177401
2013-03-19 14:54:17 +00:00
Evgeniy Stepanov 0af672326a [sanitizer] Replace more platform checks with SANITIZER_ constants.
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov d3b56605f1 [sanitizer] Move ASan platform macros to sanitizer_common and rename them appropriately.
llvm-svn: 177397
2013-03-19 13:54:41 +00:00
Alexey Samsonov 45d2f96582 Don't use --sysroot to linux SDK when building libprofile - SDK on Linux seems to be incomplete.
llvm-svn: 177396
2013-03-19 13:34:23 +00:00
Dmitry Vyukov 082afc8346 tsan: fix build
llvm-svn: 177395
2013-03-19 13:34:12 +00:00
Dmitry Vyukov 4ecfa696e0 tsan: flush dead thread info earlier (when another thread is finished rather than new thread is created)
llvm-svn: 177394
2013-03-19 12:25:48 +00:00
Dmitry Vyukov 9dd06ad47a tsan: instruct malloc() to consume less memory
llvm-svn: 177393
2013-03-19 12:24:19 +00:00
Dmitry Vyukov f3fde82667 tsan: symbolizer "flush caches" support
llvm-svn: 177389
2013-03-19 10:24:01 +00:00
Dmitry Vyukov 29f335ae80 tsan: symbolizer "flush caches" functinality
llvm-svn: 177388
2013-03-19 10:23:17 +00:00
Dmitry Vyukov 509dab30ae tsan: fix memory leak
llvm-svn: 177387
2013-03-19 10:22:33 +00:00
Evgeniy Stepanov 6d02c1c598 [sanitizer] Avoid use of uintptr_t.
llvm-svn: 177384
2013-03-19 09:39:15 +00:00
Evgeniy Stepanov b4a218db34 [sanitizer] Don't adjust the size of the user-allocated stack.
Moved this code to sanitizer_common.

llvm-svn: 177383
2013-03-19 09:30:52 +00:00
Alexey Samsonov 4c17c1b157 Support CMake build of profile runtime library on Linux
llvm-svn: 177382
2013-03-19 09:17:35 +00:00
Dmitry Vyukov b59fa875ad tsan: do not allocate sync vars on relaxed atomic operations
helps to reduce memory consumption if an atomic is used only with relaxed ops (stats)

llvm-svn: 177381
2013-03-19 09:15:31 +00:00
Richard Smith 807e4dced5 Update ubsan test for clang change r177362.
llvm-svn: 177363
2013-03-19 00:04:20 +00:00
Bill Wendling 2428f167f7 Add some GCOV functions that register all of the __llvm_gcov_flush() functions.
The __llvm_gcov_flush() functions only work for the local compile unit. However,
when __gcov_flush() is called, the user expects all of the counters to be
flushed, not just the ones in the current compile unit.

This adds some library functions that register the flush functions. It also
defined __gcov_flush() so that loops through that list and calls the functions.

PR15191 & <rdar://problem/13167507>

llvm-svn: 177337
2013-03-18 22:59:47 +00:00
Dmitry Vyukov 4ddd37ba5b tsan: smaller memory block headers (32b->16b)
llvm-svn: 177312
2013-03-18 19:47:36 +00:00
Dmitry Vyukov 61ce9560d4 tsan: add support for idle threads
llvm-svn: 177292
2013-03-18 17:21:15 +00:00
Dmitry Vyukov ce26a0aa92 tsan: touch less shadow memory during operations on big memory ranges
greatly reduces memory consumption

llvm-svn: 177289
2013-03-18 16:56:48 +00:00
Dmitry Vyukov 2e7f29f042 tsan: mark shadow for thread stack as "don't need" when thread exits
llvm-svn: 177288
2013-03-18 15:49:07 +00:00
Dmitry Vyukov f123337275 tsan: better memory profiler
llvm-svn: 177286
2013-03-18 13:55:33 +00:00
Dmitry Vyukov 15bee188c4 tsan: madvise(DONTNEED) shadow memory on munmap()
llvm-svn: 177278
2013-03-18 11:51:51 +00:00
Kostya Serebryany 9138f75d0a [asan] make the __asan_get_heap_size more robust
llvm-svn: 177270
2013-03-18 10:52:25 +00:00
Dmitry Vyukov 20bf8c7778 tsan: move implementation out of h file
llvm-svn: 177269
2013-03-18 10:32:21 +00:00
Dmitry Vyukov 49e462fab2 tsan: fix clang -Wall build
Clang does not like classes with virtual functions but w/o virtual dtor.
Go does not like libstdc++ (operator delete).

llvm-svn: 177267
2013-03-18 10:10:15 +00:00
Alexey Samsonov b5d10f69e4 [TSan] re-apply r177249 lost in edits
llvm-svn: 177265
2013-03-18 09:45:22 +00:00
Evgeniy Stepanov 6488b2b257 [asan] Switch to allocator2 on Android.
llvm-svn: 177263
2013-03-18 09:22:58 +00:00
Dmitry Vyukov a1bdd2d942 tsan: fix memory leak
llvm-svn: 177262
2013-03-18 09:09:41 +00:00
Dmitry Vyukov 7cd2025c4d tsan: use StackDepot for thread creation stacks
llvm-svn: 177261
2013-03-18 09:02:27 +00:00
Dmitry Vyukov 50160030e1 tsan: fix Go build
llvm-svn: 177260
2013-03-18 08:52:46 +00:00
Dmitry Vyukov a221620b2e tsan: use StackDepot in sync object to store creation stacks
llvm-svn: 177258
2013-03-18 08:27:47 +00:00
Dmitry Vyukov 6f7ca81cce tsan: fix huge stack frames
llvm-svn: 177255
2013-03-18 08:09:42 +00:00
Kostya Serebryany c4722a65a5 [asan] while generating the description of a global variable, emit the module name in a separate field, thus not duplicating this information if every description. This decreases the binary size (observed up to 3%). https://code.google.com/p/address-sanitizer/issues/detail?id=168 . This changes the asan API version. compiler-rt part, llvm-part will follow
llvm-svn: 177253
2013-03-18 08:04:55 +00:00
Dmitry Vyukov 0f2c7ea5d0 tsan: fix lint warnings
llvm-svn: 177251
2013-03-18 07:58:20 +00:00
Alexey Samsonov cbed82ea70 [TSan] fix undefined variable in debug TSan build
llvm-svn: 177249
2013-03-18 07:33:00 +00:00
Alexey Samsonov 4f1c8a13d5 [TSan] Use ThreadRegistry::FindThreadContextLocked() to find thread by its stack/tls address.
llvm-svn: 177248
2013-03-18 07:02:08 +00:00
Alexey Samsonov e1955b851d [TSan] Makefiles: allow configurable paths to clang and FileCheck. Add -fno-rtti flag.
llvm-svn: 177247
2013-03-18 07:00:36 +00:00
Alexey Samsonov f9dbbda5bc [Sanitizer] Get rid of global mutexes in StopTheWorld implementation
llvm-svn: 177246
2013-03-18 06:27:13 +00:00
Alexey Samsonov e25c72958a [Sanitizer] Rely on template argument deduction in sanitizer_allocator_test
llvm-svn: 177245
2013-03-18 06:07:44 +00:00
Alexander Potapenko 845b575370 [libsanitizer] StopTheWorld in sanitizer_common
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.

Linux implementation provided.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 177156
2013-03-15 14:37:21 +00:00
Alexey Samsonov 3a6b6b9d55 [Sanitizer] Don't intercept frexpf and frexpl on Windows. Add frexp declaration to asan_intercepted_functions.h
llvm-svn: 177155
2013-03-15 14:02:21 +00:00
Alexey Samsonov 9aecdfe34d [TSan] Switch TSan runtime to use ThreadRegistry class from sanitizer_common
llvm-svn: 177154
2013-03-15 13:48:44 +00:00
Alexey Samsonov e4385c4b98 [Sanitizer] Don't link tests with -lpthread on Android.
llvm-svn: 177151
2013-03-15 12:54:01 +00:00
Kostya Serebryany 96a7620f3a [sanitizer] fix gcc build warnings
llvm-svn: 177149
2013-03-15 12:27:52 +00:00
Kostya Serebryany b941a2fca4 [asan] Add ForEachChunk() to sanitizer allocators. Patch by Sergey Matveev
llvm-svn: 177147
2013-03-15 11:39:41 +00:00
Alexey Samsonov cdd46d9ccc [Sanitizer] Generalize compile/link flags for sanitizer_common tests on Android and on other platforms.
llvm-svn: 177146
2013-03-15 10:39:26 +00:00
Alexey Samsonov 337b0fcf9c [Sanitizer] Build sanitizer_common tests w/o RTTI. Move ThreadRegistry class members below methods.
llvm-svn: 177143
2013-03-15 07:08:52 +00:00
Eric Christopher d3c993b396 Fix a virtual destructor warning.
Patch by Manuel Klimek!

llvm-svn: 177132
2013-03-15 00:20:17 +00:00
Alexey Samsonov d1999a1ccc [Sanitizer] Fix compiler warnings and style issues in sanitizer_common tests. Use -Werror=sign-compare when building them.
llvm-svn: 177077
2013-03-14 15:15:35 +00:00
Alexey Samsonov 1cb684381a [Sanitizer] Add generic ThreadRegistry class for sanitizer runtimes. This class holds basic thread bookkeeping logic and allows specific sanitizer runtimes to create thread contexts and mark threads as created/running/joined etc. The class is based on the way we currently store thread contexts in TSan.
llvm-svn: 177074
2013-03-14 13:54:30 +00:00
Alexey Samsonov a097f7b1e3 [Sanitizer] Add default constructor for BlockingMutex
llvm-svn: 177072
2013-03-14 13:30:56 +00:00
Evgeniy Stepanov 8d487b4407 [sanitizer] No dirent64 on Android.
llvm-svn: 177071
2013-03-14 13:24:03 +00:00
Alexey Samsonov 3d09fdbf21 [Sanitizer] Build sanitizer_common with -fno-rtti
llvm-svn: 177070
2013-03-14 13:16:35 +00:00
Kostya Serebryany d332d42372 [asan] remove one redundant malloc stress test, unify the usage of ASAN_LOW_MEMORY macro in tests, slightly reduce test memory usage (all to make 32-bit runs consume less RAM)
llvm-svn: 177069
2013-03-14 13:16:09 +00:00
Alexander Potapenko 34e1171768 [libsanitizer] fixed a bug in ThreadLister tests where we forgot to terminate one thread
Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 177068
2013-03-14 13:15:14 +00:00
Evgeniy Stepanov 740e6ebe71 [msan] Add changes missing from r177065.
llvm-svn: 177067
2013-03-14 13:13:49 +00:00
Evgeniy Stepanov c6bce93591 [msan] Intercept readdir64.
llvm-svn: 177065
2013-03-14 12:49:23 +00:00
Alexey Samsonov 1dc928e1b1 [ASan] remove -fsanitize=init-order from lit tests as now it's implied by -fsanitize=address
llvm-svn: 177064
2013-03-14 12:43:03 +00:00
Alexander Potapenko ac3bbb3ef3 [libsanitizer] Fixed incorrect handling of pre-existing threads in ThreadLister test.
Also, extended the test to check that ThreadLister::Reset() works as intended.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 177060
2013-03-14 12:06:54 +00:00
Evgeniy Stepanov 4062a396c7 [msan] Fix a typo in test.
llvm-svn: 177059
2013-03-14 11:58:13 +00:00
Alexey Samsonov 963be1ddd8 [ASan] turn off checking initialization order in ASan runtime by default. Instead, it should be turned on by default in the compiler
llvm-svn: 177058
2013-03-14 11:49:40 +00:00
Evgeniy Stepanov fe0199ea54 [msan] Options for switching between fast and cfi unwinders in run time.
Does not change default behavior.

llvm-svn: 177057
2013-03-14 11:47:03 +00:00
Evgeniy Stepanov 231894a902 [sanitizer] Intercept frexp and friends.
llvm-svn: 177056
2013-03-14 11:34:39 +00:00
Alexey Samsonov 7d2385419a [Sanitizer] fix compilation for Windows
llvm-svn: 177054
2013-03-14 11:29:06 +00:00
Evgeniy Stepanov ead6cf7c72 [msan] Intercept __strdup, strndup, __strndup.
llvm-svn: 177052
2013-03-14 11:10:36 +00:00
Alexey Samsonov 83e7622df6 [Sanitizer] Write a slightly better implementation of GetEnv() function on Windows
llvm-svn: 177051
2013-03-14 11:10:23 +00:00
Alexey Samsonov 140cd84155 [ASan] make ASan assume ASAN_OPTIONS=symbolize=1 if ASAN_EXTERNAL_SYMBOLIZER is defined
llvm-svn: 177036
2013-03-14 10:07:40 +00:00
Alexey Samsonov 41a560b8cd [TSan] Add missing header inclusion
llvm-svn: 177013
2013-03-14 07:13:00 +00:00
Alexey Samsonov 109ddd0fe4 [TSan] Use __sanitizer_pthread_attr_t in TSan
llvm-svn: 177012
2013-03-14 07:10:52 +00:00
Reid Kleckner 2325273641 [msan] Clean up extensions during msandr shutdown
Otherwise debug DynamoRIO complains at us for leaking memory.

llvm-svn: 176947
2013-03-13 13:59:09 +00:00
Evgeniy Stepanov 96f82f8ac3 [sanitizer] Fix lint.
llvm-svn: 176943
2013-03-13 10:20:35 +00:00
Alexey Samsonov d7ab381f53 [Sanitizer] Build ASan, TSan and MSan runtimes with -fno-rtti.
llvm-svn: 176940
2013-03-13 09:18:30 +00:00
Evgeniy Stepanov 98f5ea0dba [msan] Increase stack size as required.
Adjust stack size in pthread_attr_t when the app-requested size does not fit MSan TLS.

llvm-svn: 176939
2013-03-13 09:01:40 +00:00
Evgeniy Stepanov 5697b58ec4 [sanitizer] Move GetTlsSize code from TSan to sanitizer_common.
llvm-svn: 176938
2013-03-13 08:19:53 +00:00
Evgeniy Stepanov 24aad9c0cb Break a >80 char line.
llvm-svn: 176937
2013-03-13 08:17:39 +00:00
Alexey Samsonov 91f833a413 [Sanitizer] Fixup for r176931 for Mac and Windows
llvm-svn: 176935
2013-03-13 07:39:25 +00:00
Alexey Samsonov d38aceda4e [Sanitizer] Fix a typo in function name
llvm-svn: 176932
2013-03-13 06:55:02 +00:00
Alexey Samsonov 06d3aa4884 [Sanitizer] Change MemoryMappingLayout methods to also report memory protection flags (for future use in leak checker). Patch by Sergey Matveev.
llvm-svn: 176931
2013-03-13 06:51:02 +00:00
Kostya Serebryany 67b1478914 [asan] use 4Tb of address space for the asan allocator instead of 1Tb. This increases the memory available for a single size class from 16Gb to 64Gb. The total VM footprint becomes 20Tb
llvm-svn: 176857
2013-03-12 09:04:49 +00:00
Kostya Serebryany 138b155042 [sanitizer] use fewer size classes in the allocator to reduce the memory footprint. There is no all-size-fits-all constant here, but this change is positive or neutral on several large apps I've tested
llvm-svn: 176855
2013-03-12 08:44:40 +00:00
Evgeniy Stepanov 26d5bc7fdf [msan] Use sptr instead of ptrdiff_t.
llvm-svn: 176854
2013-03-12 07:21:17 +00:00
Kostya Serebryany ba56c8d4f9 [sanitizer] simplify the allocator's SizeClassMap: do not require an extra template parameter, instead compute it in flight. No functionality change
llvm-svn: 176853
2013-03-12 07:01:27 +00:00
Reid Kleckner c9d382b5a4 [msan] intercept dlopen and clear shadow for it
Summary:
The loader does not call mmap() through the PLT because it has to
bootstrap the process before libc is present.  Hooking dlopen() isn't
enough either because the loader runs module initializers before
returning, and they could run arbitrary msan instrumented code.

If msandr is present, then we can intercept the mmaps from dlopen at the
syscall layer and clear the shadow there.  If msandr is missing, we
clear the shadow after dlopen() and hope any initializers are trivial.

Reviewers: eugenis

CC: kcc, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D509

llvm-svn: 176818
2013-03-11 18:07:42 +00:00
Alexey Samsonov db7d9656bb [Sanitizer] Implement BlockingMutex::CheckLocked()
llvm-svn: 176805
2013-03-11 15:45:20 +00:00
Alexander Potapenko 1f78ad5da4 [ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime.
llvm-svn: 176804
2013-03-11 13:36:39 +00:00
Alexander Potapenko 18c916c6c5 [ASan] Try to use a small (512 bytes) stack-local buffer in Report() for short messages, fall back to MmapOrDie() in the case of a failure.
This shall eliminate most of the cryptic "ERROR: failed to mmap" messages caused by recursively calling MmapOrDie() from MmapOrDie().

llvm-svn: 176802
2013-03-11 11:47:43 +00:00
Alexander Potapenko 92cc1a6d24 [ASan] don't call strerr from functions that map memory, since this results in malloc().
llvm-svn: 176800
2013-03-11 10:21:28 +00:00
Kostya Serebryany 0f5c20b417 [sanitizer] make SizeClassAllocator64::GetBlockBegin more bullet proof (by Sergey Matveev)
llvm-svn: 176799
2013-03-11 09:43:12 +00:00
Nick Lewycky 593eeb000a Don't emit the extra checksum into the .gcda file if the user hasn't asked for
it. Fortunately, versions of gcov that predate the extra checksum also ignore 
any extra data, so this isn't a problem. This matches the API change made in
r176745.

llvm-svn: 176746
2013-03-09 01:33:12 +00:00
Nick Lewycky 8015c6ee2f Take the GCDA version string as an input to llvm_gcda_start_file.
llvm-svn: 176618
2013-03-07 08:28:54 +00:00
Reid Kleckner 063dfe3244 [msan] Block reports from interceptors during _Unwind_Backtrace
Summary:
I'm hitting a big recursive report from:
  uninit on strlen ->
  __msan::PrintWarningWithOrigin() ->
  __msan::GetStackTrace() ->
  __sanitizer::StackTrace::SlowUnwindStack() ->
  _Unwind_Backtrace() ->
  ... libgcc calls ->
  uninit on strlen() ->
  ... repeats

Reviewers: eugenis

Differential Revision: http://llvm-reviews.chandlerc.com/D497

llvm-svn: 176555
2013-03-06 16:11:58 +00:00
Reid Kleckner c193da57b8 [msan] pthread_join() returns int, not void*
pthread_join() returns an error code, not the result of the
pthread_create() function like I thought.

llvm-svn: 176554
2013-03-06 15:41:35 +00:00
Reid Kleckner 66c26e5e96 [sanitizers] Fix check failure on dealloc from new thread
Summary:
Adds a test for this case, which was reduced from a chromium build of
WebKit's DumpRenderTree.

Reviewers: eugenis

CC: glider

Differential Revision: http://llvm-reviews.chandlerc.com/D495

llvm-svn: 176552
2013-03-06 14:54:08 +00:00
Alexey Samsonov dcb0e72e6f [Sanitizer] fix signed-unsigned mismatch in test and use correct order of EXPECT_EQ() args
llvm-svn: 176479
2013-03-05 12:23:07 +00:00
Alexey Samsonov 434dde9996 [Sanitizer] Add methods back() and pop_back() to InternalVector. Patch by Sergey Matveev
llvm-svn: 176478
2013-03-05 11:58:25 +00:00