Commit Graph

2165 Commits

Author SHA1 Message Date
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
Nick Kledzik 2b9a65e4c4 update how libcompiler_rt.dylib links under libSystem.dylib on MacOSX
llvm-svn: 176466
2013-03-05 00:16:52 +00:00
Evgeniy Stepanov f5d8c90f57 [asan] Revert r176255, r176264.
New allocator has 1.5x memory overhead of the old one.

llvm-svn: 176340
2013-03-01 09:33:05 +00:00
Evgeniy Stepanov 323771b3f1 [sanitizer] Fix check failure in SizeClassMap::Print.
llvm-svn: 176338
2013-03-01 08:49:14 +00:00
Evgeniy Stepanov 3305b177e6 [asan] Lower memory usage in LargeMallocTest on Android.
llvm-svn: 176264
2013-02-28 15:54:58 +00:00
Alexander Potapenko f1c48eb509 [ASan] Add the memcmp_strict flag (1 by default) that controls the behavior of accessibility checks in memcmp.
1: memcmp(p1, p2, n) always checks n bytes
0: memcmp checks up to n bytes depending on whether the memory contents differ.

llvm-svn: 176256
2013-02-28 14:09:30 +00:00
Evgeniy Stepanov 1cb95a17b8 [asan] Enable allocator2 on Android.
llvm-svn: 176255
2013-02-28 14:07:01 +00:00
Kostya Serebryany abebb57272 [asan] bump kMidMemEnd to 0x4fffffffffULL since in rare cases prelink uses addresses higher than 0x3fffffffff
llvm-svn: 176250
2013-02-28 12:28:37 +00:00
Alexey Samsonov 4a3234bec5 [Sanitizer] Relax ThreadLister tests to allow possible pre-existing threads. Do proper mutex destruction. Patch by Sergey Matveev
llvm-svn: 176249
2013-02-28 11:33:51 +00:00
Evgeniy Stepanov 218c582cb5 [msan] Lit tests for __attribute__((no_sanitize_memory)).
llvm-svn: 176248
2013-02-28 11:25:54 +00:00
Nick Lewycky 1052c99f46 Holy macaroons, somebody made a copy of llvm/runtime/profile/GCDAProfiling.c,
didn't delete the original, and now they've diverged. I have no idea what's
going on. Apply my patch in r176173 to this one too, this one looks newer?

llvm-svn: 176236
2013-02-28 07:00:13 +00:00
Kostya Serebryany 8ee2a5adc7 [asan] if calloc returns a freshly-mmaped memory, don't clear it with memset. Speeds up calloc-intensive code
llvm-svn: 176185
2013-02-27 13:38:19 +00:00
Alexey Samsonov 49b86b354a [Sanitizer] don't include missing header on Android
llvm-svn: 176183
2013-02-27 13:03:35 +00:00
Alexey Samsonov 46a36d5019 [UBSan] Use common report decorator to print colorful diagnostics in UBSan, and be more consistent w/ Printf/RawWrite
llvm-svn: 176182
2013-02-27 12:58:24 +00:00
Kostya Serebryany f0b8f989e9 add Linux syscall wrappers and ThreadLister to sanitizer_common
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev

llvm-svn: 176179
2013-02-27 11:22:40 +00:00
Kostya Serebryany c98cddd024 [asan] guard ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS definition with an #ifndef
llvm-svn: 176175
2013-02-27 08:28:24 +00:00
Alexey Samsonov 086b940b1e [Sanitizer] Don't die if external symbolizer is used on Mac, where it's not implemented yet
llvm-svn: 176091
2013-02-26 13:40:51 +00:00
Kostya Serebryany a8cfb900dd [sanitizer] A low-level vector implementation to be used in leak checking code. Patch by Sergey Matveev
llvm-svn: 176089
2013-02-26 13:30:27 +00:00
Kostya Serebryany 459df6f167 [asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Kostya Serebryany 01a32bdef1 [tsan] enable tsan-vs-gvn test since it is now fixed
llvm-svn: 176079
2013-02-26 08:18:27 +00:00
Kostya Serebryany 8caf654731 [asan] fix the output for range accesses (memset, etc); improve the tests; more strict checking in memcmp
llvm-svn: 176078
2013-02-26 07:25:18 +00:00
Kostya Serebryany c8ac15a66b [asan] use the new attribute syntax (no_address_safety_analysis => no_sanitize_address)
llvm-svn: 176077
2013-02-26 07:01:06 +00:00
Alexey Samsonov 54ff0f6388 [Sanitizer] one more fix for signed/unsigned mismatch in comparison
llvm-svn: 176020
2013-02-25 14:06:38 +00:00
Alexey Samsonov b2ac280f96 [Sanitizer] fix signed/unsigned compare warnings in sanitizer_stacktrace_test. Build sanitizer_common tests with -Werror as we use predictable just-built Clang for building them
llvm-svn: 176014
2013-02-25 09:00:03 +00:00
Alexey Samsonov 85f0a7e644 [TSan] Add interceptor for malloc_usable_size()
llvm-svn: 176013
2013-02-25 08:43:10 +00:00
Alexey Samsonov 10bccda948 [TSan] remove temporary build directory in 'make clean' command
llvm-svn: 176012
2013-02-25 08:32:02 +00:00
Richard Smith 0404ec8396 ubsan: Runtime handlers for array indexing checks.
llvm-svn: 175948
2013-02-23 02:40:07 +00:00
Reid Kleckner e1596856ec [Sanitizer] Add a test for the fast unwinder
Summary:
The test sets up fake x86-style fp+retaddr frames, since that's all the
unwinder works with.

Reviewers: kcc

CC: eugenis

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

llvm-svn: 175893
2013-02-22 15:10:16 +00:00
Evgeniy Stepanov 3065014026 [msan] MSanDR: initial commit.
MSanDR is a DynamoRio-based tool that handles uninstrumented libraries and
dynamically generated code for MSan.

llvm-svn: 175883
2013-02-22 09:34:19 +00:00
Kostya Serebryany 1d63d13ce2 [asan] move the .preinit_array hack into a separate file (added used attribute)
llvm-svn: 175871
2013-02-22 07:51:26 +00:00
Alexander Potapenko 97781c4dd0 [ASan] temporarily disable alloc_dealloc_mismatch on Mac, since the previous commit caused error reports in gTest.
llvm-svn: 175766
2013-02-21 17:12:21 +00:00
Alexander Potapenko a47c6ee286 [ASan] Make sure operator new/delete and friends are intercepted on OS X.
Because the interceptors will reside in a dylib, not the main executable, we can't just declare them,
but must use the interposition machinery.
Fix the test expectations in large_func_test.cc affected by the change.
This CL should make our Mac buildbots green.

llvm-svn: 175763
2013-02-21 16:54:09 +00:00
Alexander Potapenko 1615f193eb [ASan] Declare CreateThread as extern "C" to fix the Windows build.
llvm-svn: 175760
2013-02-21 15:32:50 +00:00