Commit Graph

1738 Commits

Author SHA1 Message Date
Kostya Serebryany 1cc54f0218 [asan] one more change missed at r171198
llvm-svn: 171199
2012-12-28 15:28:19 +00:00
Kostya Serebryany cb510e50e2 [asan] implement more strict checking for memset/etc parameters. Instead of checking the first and the last byte, we check the entire shadow region. This costs ~10 slowdown for the instrumented functions. Motivated by a nasty memset-buffer-overflow-by-140-bytes in chrome which was reported as a use-after-free or not at all
llvm-svn: 171198
2012-12-28 15:24:16 +00:00
Alexey Samsonov 1aa47efd2c [ASan] use macro instead of raw __attribute__
llvm-svn: 171188
2012-12-28 11:22:23 +00:00
Alexey Samsonov 8474843e3b [TSan] Blacklist test: Rename blacklisted function. Make this test work for custom TSan testing script.
llvm-svn: 171186
2012-12-28 10:06:26 +00:00
Alexey Samsonov 8c01e76d27 [TSan] Add lit test for -fsanitize-blacklist= flag
llvm-svn: 171185
2012-12-28 09:32:36 +00:00
Alexey Samsonov f96bfd8849 Make ASan and TSan tests a bit less brittle with @LINE FileCheck macro
llvm-svn: 171181
2012-12-28 08:38:09 +00:00
Kostya Serebryany 4a42cf69a6 [sanitizer] add statistics to the allocator; fix lint
llvm-svn: 171161
2012-12-27 14:09:19 +00:00
Alexey Samsonov c20f5d2246 Define COMPILER_RT_CAN_EXECUTE_TESTS variable on platforms where we can produce working binaries and use it in build rules for sanitizers tests
llvm-svn: 171160
2012-12-27 13:19:23 +00:00
Evgeniy Stepanov 8798729a22 [msan] Explicitly link unit tests with libstdc++.
llvm-svn: 171151
2012-12-27 08:44:19 +00:00
Kostya Serebryany 1302e8d6da [asan] enable alloc_dealloc_mismatch by default
llvm-svn: 171147
2012-12-27 08:08:05 +00:00
Kostya Serebryany 4a0d946a43 [asan] relax asan/lit_tests/malloc_delete_mismatch.cc to make it pass on Mac 10.7 (where extra frames creep in between malloc and main)
llvm-svn: 171145
2012-12-27 07:40:24 +00:00
Kostya Serebryany 6f604b5007 [asan/tsan] when unmapping a chunk of user memory, apply madvise(MADV_DONTNEED) to the corresponding chunk of shadow memory. Also update sanitizer_allocator64_testlib.cc
llvm-svn: 171144
2012-12-27 07:37:24 +00:00
Alexey Samsonov d66b12b701 [ASan] Teach ASan to print demangled function name when describing stack frame
llvm-svn: 171112
2012-12-26 14:44:46 +00:00
Kostya Serebryany 390cf94f88 [asan] asan_allocator2: do not align the requested size to the redzone size (saves a bit more memory)
llvm-svn: 171111
2012-12-26 12:20:35 +00:00
Kostya Serebryany 35cc75876a [asan] asan_allocator2: implement adaptive redzones. Now with asan_allocator2 allocations <= 48 bytes have 16 byte redzone, allocations of 48-96 bytes -- have 32 bytes redzone, etc (max redzone is 2048). If ASAN_OPTIONS=redzone=n is set, it changes the minimal redzone size
llvm-svn: 171107
2012-12-26 10:41:24 +00:00
Evgeniy Stepanov fee82c68ae [msan] MSan, New Year Tree style.
llvm-svn: 171106
2012-12-26 10:16:45 +00:00
Evgeniy Stepanov 367dc64563 [msan] Refactor report printing.
llvm-svn: 171105
2012-12-26 09:32:05 +00:00
Alexey Samsonov c914281341 [Sanitizer] attempt to fix InterlockedCompareExchangePointer intrinsic on MSVC
llvm-svn: 171104
2012-12-26 09:25:09 +00:00
Evgeniy Stepanov 794a73124b [msan] Check for conflicting memory mappings.
Check for conflicting memory mappings before attempting to map shadow.
Helps avoid segfault on Linux with disabled ASLR.

llvm-svn: 171100
2012-12-26 06:37:23 +00:00
Kostya Serebryany a11cd57a78 [asan] asan_allocator2: by default use the StackDepot to store the stack traces instead of storing them in the redzones
llvm-svn: 171099
2012-12-26 06:30:02 +00:00
Kostya Serebryany 27ad15e165 [asan] asan_allocator2: store the user requested size in just 32 bits (larger sizes use metadata). This allows to put one more 32-bit field into the chunk header
llvm-svn: 171089
2012-12-26 04:52:07 +00:00
Evgeniy Stepanov 84f46d9993 [msan] Improve recvfrom interceptor.
llvm-svn: 171071
2012-12-25 16:51:57 +00:00
Evgeniy Stepanov a57662d7c4 Add MSan unit tests to check-msan and check-all.
llvm-svn: 171065
2012-12-25 13:10:15 +00:00
Evgeniy Stepanov f45d92bb22 MemorySanitizer unit tests.
llvm-svn: 171062
2012-12-25 12:39:56 +00:00
Evgeniy Stepanov 6722716d78 [msan] Fix header comments.
llvm-svn: 171059
2012-12-25 11:53:51 +00:00
Kostya Serebryany eff9b4b9b1 [asan] add a test for right OOB with special large sizes. Fix this test in asan_allocator2. More test tweaking for allocator2
llvm-svn: 171058
2012-12-25 09:40:20 +00:00
Dmitry Vyukov 116518af74 tsan: fix tests to consistently use internal functions (otherwise it leads to false positives)
llvm-svn: 171057
2012-12-25 09:20:58 +00:00
Kostya Serebryany ad24c58e16 [sanitizer] increase the maximum size class of the fast allocator. This should save quite a bit of memory in tsan/msan (and later in asan). This also puts more stress on the large allocator. Add a couple of checks
llvm-svn: 171055
2012-12-25 07:50:35 +00:00
Dmitry Vyukov 774defc649 tsan: fix the code that searches for heap memory block metadata
(the old code won't work with new allocator)

llvm-svn: 171054
2012-12-25 07:45:40 +00:00
Kostya Serebryany 181f504d82 [asan] properly define ASAN_LOW_MEMORY. Due to a mistake it has been always true causing redzone and quarantine sizes to be smaller than it was some time before (and out of sync with the documentation). Also make one test less greedy
llvm-svn: 171052
2012-12-25 07:17:17 +00:00
Kostya Serebryany db3250b8b3 [sanitizer] fix gcc warnings, enable one tests under asan_allocator2
llvm-svn: 171036
2012-12-24 14:53:13 +00:00
Kostya Serebryany fc7de2910c [sanitizer] make LargeMmapAllocator::GetBlockBegin faster by not using a linked list
llvm-svn: 171035
2012-12-24 14:35:14 +00:00
Dmitry Vyukov 19969e5045 tsan: work around FileCheck feature that it does not accept empty input
llvm-svn: 171034
2012-12-24 14:02:34 +00:00
Dmitry Vyukov f6d8021520 tsan: remove static reference to glibc internal _dl_get_tls_static_info()
(this breaks RPM packages)

llvm-svn: 171033
2012-12-24 13:43:53 +00:00
Kostya Serebryany ebb23c8cfa [sanitizer] rework the size class map in the sanitizer allocator: make the differences between size classes more uniform.
llvm-svn: 171031
2012-12-24 13:41:07 +00:00
Dmitry Vyukov 73dac64b73 tsan: more defensive file descriptor verification
to prevent assertion failures on code like "write(-1, ...)"

llvm-svn: 171030
2012-12-24 11:43:34 +00:00
Kostya Serebryany fe80f080ee [asan] asan_allocator2 fix two asserts that happen on full chrome: a) memalign called with 0 size and large alignment and b) malloc called after TSD has been destructed
llvm-svn: 170900
2012-12-21 14:54:46 +00:00
Alexey Samsonov e30a84f08f [Sanitizer] CMake build rules for unittests: depend on headers when compiling a file with custom clang.
llvm-svn: 170897
2012-12-21 14:04:52 +00:00
Dmitry Vyukov b3bf5651bd tsan: add java malloc stress test
llvm-svn: 170896
2012-12-21 13:40:27 +00:00
Kostya Serebryany a1e29adab5 [sanitizer] mmap less on every size class to make the allocator more friendly to small programs
llvm-svn: 170895
2012-12-21 13:38:05 +00:00
Dmitry Vyukov c23b218520 tsan: add java rwlock test
llvm-svn: 170894
2012-12-21 13:31:07 +00:00
Dmitry Vyukov c55ed2f538 tsan: add a test for java memory move
llvm-svn: 170893
2012-12-21 13:28:39 +00:00
Dmitry Vyukov e6b51986bb tsan: move common part of java tests into a separate header
llvm-svn: 170892
2012-12-21 13:26:10 +00:00
Dmitry Vyukov a33bf2701e tsan: fix Java memory move operations and add the test
llvm-svn: 170891
2012-12-21 13:23:48 +00:00
Dmitry Vyukov fe817bdb88 tsan: less debug output
llvm-svn: 170889
2012-12-21 12:30:52 +00:00
Kostya Serebryany 3cc719fdf9 [asan] asan_allocator2: better memory stats
llvm-svn: 170888
2012-12-21 12:26:31 +00:00
Dmitry Vyukov 58e617121d tsan: update mutex lock table for java
llvm-svn: 170885
2012-12-21 11:30:41 +00:00
Dmitry Vyukov 22be55e47e tsan: update mutex table for java
llvm-svn: 170884
2012-12-21 11:30:14 +00:00
Dmitry Vyukov a5b57100d4 tsan: java: move shadow memory on GC compaction
llvm-svn: 170882
2012-12-21 11:16:40 +00:00
Dmitry Vyukov bed53cfc12 tsan: add a high-level comment to tsan_interface_java.h
llvm-svn: 170881
2012-12-21 10:57:59 +00:00
Alexander Potapenko 47a03a2ebe [ASan] Fix another FileCheck pattern to be c++filt-proof.
llvm-svn: 170878
2012-12-21 10:48:30 +00:00
Dmitry Vyukov 11bb06039a tsan: fix lint warnings
llvm-svn: 170877
2012-12-21 10:47:48 +00:00
Dmitry Vyukov 1859251df8 tsan: disable checks for limited address space and unlimited stack for Go
llvm-svn: 170876
2012-12-21 10:45:01 +00:00
Alexey Samsonov 53a965e125 [Sanitizer] Don't implicitly add object files to the list of dependencies when building compiler_rt unittests. Fix sanitizer_common and asan build rules accordingly. This also fixes check-sanitizer command on Ninja.
llvm-svn: 170870
2012-12-21 08:56:14 +00:00
Kostya Serebryany 3674c6b13b [asan] add a flag alloc_dealloc_mismatch (off by default for now) which finds malloc/delete, new/free, new/delete[], etc mismatches
llvm-svn: 170869
2012-12-21 08:53:59 +00:00
Dmitry Vyukov 1fbe87d0c9 tsan: add lit test with statically linker libstdc++
llvm-svn: 170866
2012-12-21 08:08:19 +00:00
Dmitry Vyukov 47a5ad0348 tsan: use clang in cmake build + add -Werror
llvm-svn: 170844
2012-12-21 06:30:27 +00:00
Richard Relph 27cfe1c1b5 Clean up some warnings that become errors. Seen in Xcode.
llvm-svn: 170843
2012-12-21 05:17:13 +00:00
Dmitry Vyukov 2547ac65eb tsan: java interface implementation skeleton
llvm-svn: 170707
2012-12-20 17:29:34 +00:00
Alexey Samsonov 19e8b7ecba [ASan] remove duplicate entry in shadow byte legend
llvm-svn: 170701
2012-12-20 15:19:10 +00:00
Alexey Samsonov aef6b78bcb [Sanitizer] Fix CMake build rules for sanitizer_common tests to respect universal static libraries on Mac
llvm-svn: 170698
2012-12-20 14:38:02 +00:00
Kostya Serebryany c0d8ca5537 [asan] asan_allocator2: implement memalign
llvm-svn: 170697
2012-12-20 14:35:06 +00:00
Evgeniy Stepanov e243708d6b [*san] Create unittests output directory, if it does not exist.
llvm-svn: 170696
2012-12-20 14:34:09 +00:00
Dmitry Vyukov 7b838ada82 tsan: add cmake build and tests into presubmit script
llvm-svn: 170695
2012-12-20 14:10:27 +00:00
Alexey Samsonov 01674dfc8f [Sanitizer] Modify CMake build rules for sanitizer_common unit tests: build them with fresh Clang for both 32- and 64-bits (if possible)
llvm-svn: 170691
2012-12-20 13:24:21 +00:00
Alexander Potapenko 5e9e51874e [ASan] Make the FileCheck pattern more c++filt-resistant.
This test didn't pass for me locally because of "T0's stack" being converted to "T0'short stack" by c++filt.
Strange enough this doesn't show up on our bots.

llvm-svn: 170690
2012-12-20 13:17:49 +00:00
Kostya Serebryany 54c6086e9c [tsan] fix cmake build
llvm-svn: 170689
2012-12-20 12:26:09 +00:00
Kostya Serebryany 8627af3779 [asan] add memalign tests
llvm-svn: 170687
2012-12-20 12:11:52 +00:00
Kostya Serebryany 9da3dd0415 [asan] add a flag poison_heap to allow better allocator benchmarking, implemenet malloc_stats() on Linux
llvm-svn: 170685
2012-12-20 11:54:21 +00:00
Dmitry Vyukov d088b3b219 tsan: add java interface implementation stub
llvm-svn: 170681
2012-12-20 10:21:30 +00:00
Kostya Serebryany ab8d33184d [asan] asan_allocator2: make all remaining tests pass.
llvm-svn: 170680
2012-12-20 08:53:41 +00:00
Dmitry Vyukov 5a0761ed3c tsan: add Java interface
llvm-svn: 170679
2012-12-20 07:47:04 +00:00
Kostya Serebryany f855bbc2f3 [asan] add ASAN_PCRE_DOTALL to two new multi-line regexps
llvm-svn: 170677
2012-12-20 07:26:33 +00:00
Alexey Samsonov 74cbc4ccd7 [ASan] don't use -fsanitize=address linker flag for unit tests on Android
llvm-svn: 170670
2012-12-20 06:16:50 +00:00
Richard Smith 64e25ce53d Move C++ name demangling support from ubsan into sanitizer_common.
llvm-svn: 170666
2012-12-20 05:00:13 +00:00
Alexey Samsonov 826b324cb0 [ASan] explicitly link with dynamic ASan runtime when building unittests on Android
llvm-svn: 170552
2012-12-19 15:52:30 +00:00
Alexey Samsonov 85bd73d259 [ASan] Support building both 32- and 64-bit unit tests if we can target both architectures
llvm-svn: 170549
2012-12-19 15:17:23 +00:00
Kostya Serebryany dcdeecb257 [asan] asan_allocator2: add mmap/munmap stats
llvm-svn: 170548
2012-12-19 14:56:38 +00:00
Alexey Samsonov b29d37bea5 [ASan] make sure Android unittests depend on ASan runtime
llvm-svn: 170543
2012-12-19 13:46:58 +00:00
Alexey Samsonov ca7fcf2354 Significantly change the way we build ASan unittests in CMake
build tree. Now just-built Clang is used to:
  1) compile instrumented sources (as before);
  2) compile non-instrumented sources;
  3) compile our own instrumented version of googletest;
  4) link it all together using -fsanitize=address flag
     (instead of trying to copy linker behavior in
      CMake build rules).

This makes ASan unittests pretty much self-consistent
and independent of other LLVM libraries.

llvm-svn: 170541
2012-12-19 12:33:39 +00:00
Alexander Potapenko 7e1fcb8136 [ASan] Change the boilerplate check in the libdispatch tests to fix them.
llvm-svn: 170531
2012-12-19 11:26:41 +00:00
Kostya Serebryany d5c46cb2f7 [asan] print the shadow bytes in different colors and also output the shadow byte legend
llvm-svn: 170520
2012-12-19 09:53:32 +00:00
Alexey Samsonov d12943e028 [TSan] build only gtest-all.o when building TSan unit tests
llvm-svn: 170519
2012-12-19 09:19:57 +00:00
Dmitry Vyukov 1ed72076b4 tsan: add lint check back into presubmit script
llvm-svn: 170515
2012-12-19 08:53:31 +00:00
Alexey Samsonov 35ed02ebf1 [Sanitizer] add missing header on Windows
llvm-svn: 170514
2012-12-19 08:51:39 +00:00
Kostya Serebryany 479f05b276 [asan] asan_allocator2: improve FindHeapChunkByAddress to find memory chunks to the left of a given address. Almost all tests pass with the new allocator now, only 6 are left to fix.
llvm-svn: 170511
2012-12-19 08:32:50 +00:00
Alexey Samsonov b6219c060b [Sanitizer] implement internal_isatty on Windows
llvm-svn: 170507
2012-12-19 07:57:42 +00:00
Dmitry Vyukov c467933dc7 tsan: fix -Wgnu warnings
llvm-svn: 170499
2012-12-19 06:59:45 +00:00
Kostya Serebryany 2abbce6701 [sanitizer] one more stability fix in 64-bit allocator
llvm-svn: 170498
2012-12-19 06:51:45 +00:00
Kostya Serebryany 12676268fa [sanitizer] fix LargeMmapAllocator::GetBlockBegin
llvm-svn: 170434
2012-12-18 14:56:38 +00:00
Dmitry Vyukov 44e1beaee6 tsan: intercept fork() to prevent false race reports on fd's
llvm-svn: 170433
2012-12-18 14:44:44 +00:00
Dmitry Vyukov a2ce1e0055 tsan: warn about reports from signal handlers
llvm-svn: 170430
2012-12-18 14:19:24 +00:00
Dmitry Vyukov d509179a0b tsan: add signalfd() and inotify_init() interceptors
llvm-svn: 170429
2012-12-18 12:35:31 +00:00
Dmitry Vyukov 42230ae216 tsan: add io_sync flag that controls amount of IO synchronization
llvm-svn: 170427
2012-12-18 12:20:55 +00:00
Dmitry Vyukov 9c7bcfea6f tsan: remove TSAN_OPTIONS from the script
The runtime skips atexit sleep if there are no threads now,
so it must be fast w/o it.
Allows to specify own TSAN_OPTIONS for the tests.

llvm-svn: 170426
2012-12-18 12:19:50 +00:00
Alexey Samsonov f37c45c20d [Sanitizer] Expose StackTrace::GetPreviousInstructionPc() to get PC of call instruction from return address
llvm-svn: 170424
2012-12-18 09:57:34 +00:00
Richard Smith 7e45562ad0 ubsan: Demangle class names, and be more informative when a reinterpret_cast
has got us to the wrong offset within an object.

llvm-svn: 170423
2012-12-18 09:30:21 +00:00
Kostya Serebryany bad01549b6 [asan] add some colors to asan output if printing to tty (following ubsan)
llvm-svn: 170418
2012-12-18 07:32:16 +00:00
Dmitry Vyukov 6d315cbcc3 tsan: describe "file descriptor" location
llvm-svn: 170417
2012-12-18 06:57:34 +00:00
Richard Smith cf56ebd52a ubsan: When diagnosing something wrong somewhere in memory, emit a note
pointing at the bad location and a snippet of nearby memory values. This is
strictly best-effort; reading these bytes to display the note could lead to a
seg fault, and that's explicitly OK.

llvm-svn: 170415
2012-12-18 06:30:32 +00:00
Richard Smith 54fc2370f9 Don't escape %s in printf usage message; it's not written by printf.
llvm-svn: 170413
2012-12-18 05:49:49 +00:00
Richard Smith 52987120f9 ubsan: if the frontend didn't provide us with a source location, try to work
one out from the return address. Currently, we can only resolve this address to
a file and line number if we have an external symbolizer.

llvm-svn: 170407
2012-12-18 04:23:18 +00:00
Richard Smith 37a913ae8f Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.

llvm-svn: 170388
2012-12-18 00:23:12 +00:00
Dmitry Vyukov 09b0dbfaf9 tsan: say what thread had created a thread in reports
llvm-svn: 170346
2012-12-17 16:28:15 +00:00
Kostya Serebryany d6aec5a8e0 [asan] asan_allocator2: implement malloc_usable_size and fix 32-bit
llvm-svn: 170339
2012-12-17 14:57:25 +00:00
Kostya Serebryany ec339f70d6 [asan] asan_allocator2: don't use TLS and fix calloc
llvm-svn: 170329
2012-12-17 13:43:47 +00:00
Kostya Serebryany 1aae0e67fa [asan] asan_alocator2: implement quarantine and Reallocate
llvm-svn: 170315
2012-12-17 09:06:25 +00:00
Kostya Serebryany 41ffe3db59 [asan] implement AsanChunkFifoList via IntrusiveList<AsanChunk>
llvm-svn: 170313
2012-12-17 07:54:29 +00:00
Kostya Serebryany c510015419 [asan] asan_alocator2: implement free() stacks and actually make malloc/free stacks work
llvm-svn: 170310
2012-12-17 06:31:53 +00:00
Kostya Serebryany c8208c5258 [sanitizer] fix a bug that has crept into the sanitizer allocator and caused SEGV on allocations between 1Mb and 2Mb, improve the test
llvm-svn: 170274
2012-12-15 18:36:23 +00:00
Dmitry Vyukov 38d0b60fb9 tsan: synchronize connect->accept calls
llvm-svn: 170235
2012-12-14 20:01:58 +00:00
Alexey Samsonov 6a68a9117b [Sanitizer] remove extra typename
llvm-svn: 170208
2012-12-14 15:37:35 +00:00
Dmitry Vyukov 5a3d15c126 tsan: add test for errno spoiling in signal handler
llvm-svn: 170207
2012-12-14 14:42:40 +00:00
Kostya Serebryany 673c052631 [sanitizer] add AllocatorLeakTest
llvm-svn: 170206
2012-12-14 14:20:29 +00:00
Dmitry Vyukov be6005a0d5 tsan: add test for malloc/free in signal handler
llvm-svn: 170205
2012-12-14 13:56:27 +00:00
Evgeniy Stepanov fb37510e96 Add MemorySanitizer.cpp to the lint script.
llvm-svn: 170204
2012-12-14 13:48:55 +00:00
Dmitry Vyukov 51b6e07deb tsan: fix lint warning
llvm-svn: 170202
2012-12-14 13:46:03 +00:00
Kostya Serebryany 025d64a1b9 [asan] more asan_allocator2 code: record the allocation stack trace, implement calloc/etc
llvm-svn: 170193
2012-12-14 13:16:19 +00:00
Dmitry Vyukov 5b375d84c0 tsan: fix build
llvm-svn: 170191
2012-12-14 12:24:11 +00:00
Kostya Serebryany 7dfb168eb8 [asan] more asan_allocator2 code: actually un/poison shadow on malloc/free
llvm-svn: 170190
2012-12-14 12:15:09 +00:00
Alexey Samsonov cd1e68ebb1 [Sanitizer] use INTERCEPT_FUNCTION(foo) instead of CHECK(INTERCEPT_FUNCTION(foo)) - this check may fail on Linux if user program defines its own version of library function foo
llvm-svn: 170189
2012-12-14 11:52:02 +00:00
Dmitry Vyukov 34aef74a4d tsan: disable allocator tests in debug build
llvm-svn: 170187
2012-12-14 10:17:22 +00:00
Dmitry Vyukov ed6d54368c tsan: comment out debug output in test
llvm-svn: 170186
2012-12-14 10:12:14 +00:00
Dmitry Vyukov 714accd917 tsan: add sanity test for Go runtime into presubmit test
llvm-svn: 170185
2012-12-14 10:10:57 +00:00
Dmitry Vyukov e0c37640f7 tsan: add socketpair() interceptor and test
llvm-svn: 170184
2012-12-14 09:57:42 +00:00
Dmitry Vyukov 12ae8897e6 tsan: fix compilation with -pedantic
llvm-svn: 170131
2012-12-13 15:26:04 +00:00
Kostya Serebryany bb69879d09 [asan] pop the internal stack frames in SlowUnwindStack, extend the test to check this
llvm-svn: 170124
2012-12-13 12:31:55 +00:00
Alexey Samsonov 506b97d61e [Sanitizer] disable lint check for line length in ASan output tests
llvm-svn: 170123
2012-12-13 12:09:47 +00:00
Kostya Serebryany 704c1cb23a [asan] extend overflow-in-qsort.cc to check both unwind kinds. One more test for SlowUnwind. Move both to Linux dir (no slow unwind on Mac)
llvm-svn: 170122
2012-12-13 11:47:49 +00:00
Alexey Samsonov 78ba6c1b37 [ASan] Allow leading underscore in function name to please output tests on Mac
llvm-svn: 170121
2012-12-13 11:11:28 +00:00
Alexey Samsonov 340de607a3 [ASan] don't print memory stats on CheckFailed
llvm-svn: 170120
2012-12-13 11:09:26 +00:00
Kostya Serebryany 060bfab568 [asan] fix win build
llvm-svn: 170119
2012-12-13 10:03:50 +00:00
Kostya Serebryany 6852bce2f2 [asan] fix mac build
llvm-svn: 170118
2012-12-13 10:01:20 +00:00
Kostya Serebryany baf583c443 [asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to allow using the slow CFI-based unwinder
llvm-svn: 170117
2012-12-13 09:34:23 +00:00
Dmitry Vyukov 3533f76996 tsan: completely disable deadlock detector for Go
seems to cause some weird stack overflow

llvm-svn: 170116
2012-12-13 09:22:11 +00:00
Alexey Samsonov 5a26e1fbf2 [Sanitizer] Add new header - sanitizer_platform_interceptors.h, which should define whether or not given function should be intercepted on a given platform.
llvm-svn: 170115
2012-12-13 08:50:16 +00:00
Alexey Samsonov 447e2f2f19 [ASan] one more macro for 'read' interception
llvm-svn: 170114
2012-12-13 08:36:13 +00:00
Dmitry Vyukov 3e7ede230f tsan: support MapThreadTrace() on all platforms
llvm-svn: 170113
2012-12-13 08:14:02 +00:00
Alexey Samsonov 65c14f5314 [ASan] more macro for conditional interception of pread functions
llvm-svn: 170112
2012-12-13 08:10:23 +00:00
Kostya Serebryany ad81738822 [asan] add asan/lit_tests/overflow-in-qsort.cc (not fully working yet)
llvm-svn: 170111
2012-12-13 08:05:03 +00:00
Richard Smith 177f80376d ubsan unit tests for -fsanitize=bool and -fsanitize=enum.
llvm-svn: 170109
2012-12-13 07:12:20 +00:00
Richard Smith 32952215b6 ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.

llvm-svn: 170107
2012-12-13 07:00:14 +00:00
Kostya Serebryany 07bb3925b0 [sanitizer] replace size_t with SIZE_T in interceptors (same for ssize_t, off_t and off64_t). This is done to avoid confusion and to make the code work with compilers that define size_t w/o any includes (MSVC)
llvm-svn: 170103
2012-12-13 06:31:40 +00:00
Kostya Serebryany a167087571 [asan] fix windows build
llvm-svn: 170101
2012-12-13 05:51:02 +00:00
Kostya Serebryany 9806628792 [sanitizer] introduce MmapFixedOrDie and use it in SizeClassAllocator64
llvm-svn: 170099
2012-12-13 05:36:00 +00:00
Kostya Serebryany eec22a628b [asan] fix the Android build (pread64 interceptor again)
llvm-svn: 170098
2012-12-13 05:27:08 +00:00
Kostya Serebryany 2ce42e0aef [sanitizer] change the way SizeClassAllocator64 allocated memory from the system: instead of one huge mmap(NORESERVE) it does one huge mprotect and then does small on-demand mmaps. This allows us to call OnMap callbacks which are required to poison newly allocated memory in asan
llvm-svn: 170097
2012-12-13 05:05:11 +00:00
Alexander Potapenko d27e4861bf [ASan] Fix test expectations for strcat/strncat.
llvm-svn: 169987
2012-12-12 16:10:46 +00:00
Kostya Serebryany e29883c10a [sanitizer] add OnMap/OnUmap callbacks to the allocator interface
llvm-svn: 169985
2012-12-12 14:32:18 +00:00
Kostya Serebryany c219f6c777 [tsan] fix cmake build
llvm-svn: 169982
2012-12-12 14:26:06 +00:00
Dmitry Vyukov 7d95323047 tsan: explain why pthread_cond_init() interceptor is commented out
llvm-svn: 169975
2012-12-12 13:11:44 +00:00
Alexander Potapenko dab1a61011 [ASan] Enhance OOB tests to check for access type (read or write).
llvm-svn: 169974
2012-12-12 12:59:47 +00:00
Dmitry Vyukov 9ba0f3d51c tsan: add comment to tsan_fd.h file
llvm-svn: 169973
2012-12-12 12:45:07 +00:00
Alexander Potapenko 602a09fa52 [ASan] Fixed a compiler warning.
llvm-svn: 169972
2012-12-12 12:32:57 +00:00
Dmitry Vyukov 9190a036d7 tsan: add missing files
llvm-svn: 169971
2012-12-12 12:27:00 +00:00
Dmitry Vyukov 60c14ce625 tsan: more precise handling of IO synchronization
llvm-svn: 169970
2012-12-12 11:59:30 +00:00
Alexander Potapenko ada2fbd2d4 [ASan] fix compilation on Mac.
llvm-svn: 169969
2012-12-12 11:52:26 +00:00
Kostya Serebryany 28a32c89e9 [asan] fix android build and lint
llvm-svn: 169968
2012-12-12 11:37:23 +00:00
Evgeniy Stepanov 4e772db66a [msan] Remove an extra semicolon.
llvm-svn: 169967
2012-12-12 10:50:48 +00:00
Kostya Serebryany 9a58d399c7 [asan] add sanitizer_common/sanitizer_common_interceptors.h with pread/pread64/read interceptors. Use it in asan. Add asan tests for pread/etc. Add FIXME to tsan/msan interceptors
llvm-svn: 169966
2012-12-12 09:54:35 +00:00
Kostya Serebryany 90a59fafc0 [asan] more code for asan_allocator2: basic Allocate/Deallocate code
llvm-svn: 169864
2012-12-11 14:41:31 +00:00
Evgeniy Stepanov 83f05bf960 Add MemorySanitizer runtime to check_lint.sh.
llvm-svn: 169861
2012-12-11 12:52:38 +00:00
Evgeniy Stepanov 375aec7476 [msan] Add a missing file from r169858.
llvm-svn: 169860
2012-12-11 12:44:43 +00:00
Evgeniy Stepanov c5033786ba [msan] MemorySanitizer runtime.
Initial commit of the MemorySanitizer runtime library.

llvm-svn: 169858
2012-12-11 12:27:27 +00:00
Timur Iskhodzhanov 4c97604415 ASan: fix lint problems introduced
llvm-svn: 169857
2012-12-11 12:24:41 +00:00
Timur Iskhodzhanov 9b1d42a2a9 Hopefully fix the Windows build (2)
llvm-svn: 169856
2012-12-11 12:23:00 +00:00
Timur Iskhodzhanov aacd3d79b1 Hopefully fix the Windows build by not including intrin.h
llvm-svn: 169855
2012-12-11 12:03:06 +00:00
Kostya Serebryany 5e2a7acdbe [asan] more sceleton code for asan_allocator2
llvm-svn: 169836
2012-12-11 09:02:36 +00:00
Kostya Serebryany 54af660d2c [asan] fix the Windows build
llvm-svn: 169828
2012-12-11 07:27:59 +00:00
Kostya Serebryany 3ba26fe553 [asan] make ThreadNamesTest more flexible
llvm-svn: 169822
2012-12-11 06:23:10 +00:00
Alexander Potapenko af5a108ea8 [ASan] Typo fix in memcpy() and memmove() interceptors: ASAN_WRITE_RANGE and ASAN_READ_RANGE were swapped.
This has been spotted by Anna Zaks (ganna@apple.com)

llvm-svn: 169736
2012-12-10 16:02:13 +00:00
Kostya Serebryany 13bdbe698e [asan] move FakeStack into a separate file
llvm-svn: 169734
2012-12-10 14:19:15 +00:00
Kostya Serebryany 14282a91d5 [asan] introduce asan_allocator2.cc, which will have the replacement for asan allocator (now, just a bit of boilerplate)
llvm-svn: 169733
2012-12-10 13:52:55 +00:00
Alexander Potapenko 1746f555ee Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
the client programs to notify the tools that sandboxing is about to be turned on.

llvm-svn: 169732
2012-12-10 13:10:40 +00:00
Dmitry Vyukov 1046031e1a tsan: exclude flaky test
llvm-svn: 169729
2012-12-10 09:16:17 +00:00
Alexey Samsonov f0e638c6df ASan: fix interface-symbols test on Mac by explicitly listing all weak functions
llvm-svn: 169660
2012-12-08 01:12:12 +00:00
Alexey Samsonov 5aa36def74 ASan: use new option -fsanitize-blacklist in output tests
llvm-svn: 169646
2012-12-07 22:21:21 +00:00
Alexey Samsonov a0e4706fe6 ASan: change the strategy we use for installing malloc/free/symbolization hooks on Linux: don't provide a default no-op implementations for hooks in runtime, and optionally call hooks if they are provided by the user. Don't force weak interface functions into runtime.
llvm-svn: 169641
2012-12-07 22:01:28 +00:00
David Blaikie a00d9caa8f Unbreak the C++98 build.
llvm-svn: 169636
2012-12-07 21:39:54 +00:00
Dmitry Vyukov 54b87409b4 tsan: even more fd interceptors + fixes
llvm-svn: 169628
2012-12-07 19:23:59 +00:00
Dmitry Vyukov 04580518ce tsan: more fd interceptors + bug fixes + tests
llvm-svn: 169621
2012-12-07 18:30:40 +00:00
Kostya Serebryany 40bac5b01f [asan] fix lint, remove debug prints
llvm-svn: 169620
2012-12-07 18:07:52 +00:00
Alexey Samsonov fa94fa52ad ASan: intercept prctl on Linux only
llvm-svn: 169616
2012-12-07 17:54:38 +00:00
Dmitry Vyukov 0ef99e2a48 tsan: fix pipe interceptors and add 2 tests
llvm-svn: 169607
2012-12-07 16:22:54 +00:00
Dmitry Vyukov 3a2046b3a6 tsan: fix lint warnings
llvm-svn: 169606
2012-12-07 16:20:06 +00:00
Dmitry Vyukov 4e7c0f95fb tsan: add pipe interceptors
llvm-svn: 169602
2012-12-07 15:32:56 +00:00
Kostya Serebryany e7108227ca [asan] intercept prctl(PR_SET_NAME) and set the thread name. Output the thread names (if non-empty) in asan reports
llvm-svn: 169601
2012-12-07 15:15:01 +00:00
Dmitry Vyukov 5f4ab30be0 tsan: refactoring is preparation to more precise fd synchronization handling
llvm-svn: 169600
2012-12-07 14:40:10 +00:00
Kostya Serebryany 35f9e5e87b [sanitizer] implement SanitizerSetThreadName/SanitizerGetThreadName. Just for linux so far (using prctl(PR_GET_NAME))
llvm-svn: 169598
2012-12-07 11:27:24 +00:00
Evgeniy Stepanov 5d2d761ad6 Switch to r83 of cpplint.
Ubuntu Precise compatibility.

llvm-svn: 169597
2012-12-07 11:00:14 +00:00
Kostya Serebryany 52a3b92abd [sanitizer] try not to use libc mem* functions in sanitizer_common tests (conflicts with our own interceptors)
llvm-svn: 169595
2012-12-07 10:13:10 +00:00
Kostya Serebryany 378f93e804 [sanitizer] fix the build on ancient gcc which has stricter rules about what can be put on TLS. Long term, we absolutely must build the run-times with the fresh target clang
llvm-svn: 169593
2012-12-07 09:40:17 +00:00
Dmitry Vyukov 5e700abc1c tsan: deflake output tests (by increasing sleeps)
llvm-svn: 169592
2012-12-07 09:24:57 +00:00
Alexey Samsonov a152d1b20d arcconfig for compiler-rt
llvm-svn: 169575
2012-12-07 02:11:47 +00:00
Kostya Serebryany 6986550c7d [sanitizer] POD-ify the allocator cache
llvm-svn: 169514
2012-12-06 16:22:04 +00:00
Dmitry Vyukov e3e0557f19 tsan: fix lint warning and make output tests more robust
llvm-svn: 169511
2012-12-06 15:42:54 +00:00
Kostya Serebryany 6d2d30f61d [asan/msan] one more test for 32-bit allocator + minor code simplification
llvm-svn: 169507
2012-12-06 14:39:41 +00:00
Kostya Serebryany c14ae88b08 [asan/msan] add BulkAllocate to the 32-bit allocator (and a test)
llvm-svn: 169506
2012-12-06 14:27:32 +00:00
Kostya Serebryany 0f67d01031 [asan/msan] refactor allocator's BulkAllocate (move to AllocatorFreeList)
llvm-svn: 169503
2012-12-06 13:34:11 +00:00
Dmitry Vyukov 6ee2cde066 tsan: add new file to cmake
llvm-svn: 169502
2012-12-06 13:32:49 +00:00