Commit Graph

1522 Commits

Author SHA1 Message Date
Dmitry Vyukov 1e4b54d196 asan: rename the file (it's not 64-bit specific anymore)
llvm-svn: 172518
2013-01-15 08:04:27 +00:00
Will Dietz 9d3209b5c7 [ubsan] Use __sanitizer::atomic_exchange(), prefer shared impl.
Specify weaker memory order in case we optimize for it in the future,
presently still doing same __sync_lock_test_and_set() as before.

Change suggested by Alexey Samsonov, thanks!

llvm-svn: 172429
2013-01-14 16:13:52 +00:00
Evgeniy Stepanov 99d91289b6 Move large part of asan_test_utils.h to sanitizer_common.
Move my_rand() to the common header.

This lets us avoid the use of rand_r in sanitizer_common tests.
There is no rand_r on Android.

llvm-svn: 172421
2013-01-14 15:12:26 +00:00
Alexey Samsonov 4e958e5ddb Fix-up copypasto from r172410
llvm-svn: 172419
2013-01-14 14:52:35 +00:00
Dmitry Vyukov ff19809a3d asan: fix windows build
llvm-svn: 172415
2013-01-14 14:28:06 +00:00
Evgeniy Stepanov cfe3b3b956 Build rules for sanitizer_common tests on Android.
llvm-svn: 172410
2013-01-14 14:08:25 +00:00
Evgeniy Stepanov e375a1f036 Remove thread-locals from sanitizer_common tests.
Not supported on Android.

llvm-svn: 172408
2013-01-14 14:06:58 +00:00
Alexey Samsonov 66b35642d4 ASan: Disable alloc/dealloc mismatch test on Android. It's not supposed to work there
llvm-svn: 172398
2013-01-14 11:07:59 +00:00
Kostya Serebryany b05fc3a493 [asan] use the slow CFI-based unwinder when reporting an error. Still use the fast unwinder for malloc/free. Linux-x86-only for now.
llvm-svn: 172397
2013-01-14 11:01:34 +00:00
Dmitry Vyukov 4ebb4e5565 asan/tsan: mmap shadow memory before allocating memory (otherwise other threads can access non yet allocated shadow)
llvm-svn: 172395
2013-01-14 10:49:11 +00:00
Alexey Samsonov aaa50f06d4 ASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false positives on googletest)
llvm-svn: 172394
2013-01-14 10:18:38 +00:00
Dmitry Vyukov c1a1517a37 tsan: describe stack and TLS addresses
llvm-svn: 172393
2013-01-14 10:00:03 +00:00
Dmitry Vyukov 9de857a0be asan: enable allocator version 1 by default
llvm-svn: 172392
2013-01-14 09:03:24 +00:00
Dmitry Vyukov 38092f628b asan/tsan: fix memory allocator statistics
llvm-svn: 172390
2013-01-14 08:51:08 +00:00
Dmitry Vyukov 064c739cea asan: fix Android build
llvm-svn: 172389
2013-01-14 08:48:26 +00:00
Dmitry Vyukov 795eb90db5 asan/tsan: faster memory allocator
1. Increase size classes from 32k to 128k
2. Use lock-free stack in central cache
3. Use blocking mutex when allocate new memory with mmap

llvm-svn: 172388
2013-01-14 08:23:34 +00:00
Dmitry Vyukov 8d15db4a1e tsan: fix cmake warning (unused private field)
llvm-svn: 172387
2013-01-14 08:21:34 +00:00
Dmitry Vyukov 316faf78ee tsan: add the FIXME
llvm-svn: 172386
2013-01-14 08:12:47 +00:00
Dmitry Vyukov af4b0b084a asan: fix compilation errors in mutex
llvm-svn: 172385
2013-01-14 08:01:58 +00:00
Kostya Serebryany f55e719a13 [asan] add more frames to standalone_malloc_test
llvm-svn: 172383
2013-01-14 07:59:09 +00:00
Dmitry Vyukov 3d462f89de asan: add missing file
llvm-svn: 172381
2013-01-14 07:52:01 +00:00
Dmitry Vyukov f22982bf0a asan/tsan: move blocking mutex from asan to sanitizer_common
llvm-svn: 172380
2013-01-14 07:51:39 +00:00
Tim Northover 754d1e4932 Implement __aeabi_lcmp and ulcmp
Patch contributed by Andrew Turner.

llvm-svn: 172366
2013-01-13 19:18:02 +00:00
Tim Northover 0d8c9ca7e6 Correct name of __aeabi_f2lz.
Patch contributed by Andrew Turner.

llvm-svn: 172365
2013-01-13 19:18:00 +00:00
Dmitry Vyukov a40a805f30 asan: fix FIXME on windows
llvm-svn: 172226
2013-01-11 17:57:24 +00:00
Dmitry Vyukov ecd73d36d4 asan/tsan: faster memory allocator
replace lists with arrays

llvm-svn: 172217
2013-01-11 16:41:19 +00:00
Dmitry Vyukov 86585ad319 asan: add memory prefetch to quarantine recycle
llvm-svn: 172216
2013-01-11 16:40:24 +00:00
Dmitry Vyukov 7c6c943782 asan: add memory prefetch to quarantine recycle
llvm-svn: 172215
2013-01-11 16:40:01 +00:00
Dmitry Vyukov f3a7087194 asan: improve allocator benchmark
llvm-svn: 172213
2013-01-11 16:22:53 +00:00
Dmitry Vyukov f5fa4c8a77 asan: weaken memory ordering, it's expensive in current implementation
llvm-svn: 172210
2013-01-11 16:02:31 +00:00
Dmitry Vyukov 83c4a77265 asan: improve the benchmark
llvm-svn: 172209
2013-01-11 15:57:19 +00:00
Dmitry Vyukov af96edbad2 asan: fix format string in CHECK
llvm-svn: 172203
2013-01-11 15:07:49 +00:00
Dmitry Vyukov edac64ad3f asan: prevent inlining of cold function
llvm-svn: 172197
2013-01-11 11:39:59 +00:00
Kostya Serebryany 9a7e8ddb21 [asan] fid asan_allocator2 build
llvm-svn: 172194
2013-01-11 11:27:42 +00:00
Dmitry Vyukov 008dba6aa0 asan: always pass allocator cache to Allocate()
llvm-svn: 172193
2013-01-11 11:15:48 +00:00
Dmitry Vyukov b1c0dbe2c6 asan: faster quarantine
llvm-svn: 172192
2013-01-11 11:03:35 +00:00
Dmitry Vyukov 89698ecf8a tsan: fix compiler warning
llvm-svn: 172191
2013-01-11 11:02:40 +00:00
Dmitry Vyukov c14bb685a1 asan/tsan: fix bug in list implementation
llvm-svn: 172187
2013-01-11 10:15:13 +00:00
Dmitry Vyukov 0b7bce5ecf asan: set ASAN_ALLOCATOR_VERSION=1 back
llvm-svn: 172184
2013-01-11 08:08:31 +00:00
Dmitry Vyukov db0cf871d4 asan: Refactor asan memory quarantine.
llvm-svn: 172183
2013-01-11 08:07:43 +00:00
Dmitry Vyukov 5cb6c62641 tsan: symbolize global variables
llvm-svn: 172181
2013-01-11 07:23:51 +00:00
Richard Smith ffbe87eba2 UBSan: use %p not 0x%zx when printing pointers.
llvm-svn: 172129
2013-01-10 22:39:40 +00:00
Will Dietz ad5180d774 [ubsan] Move attribute specifier to fix build with gcc.
llvm-svn: 172078
2013-01-10 17:01:13 +00:00
Kostya Serebryany fdcfbda750 [sanitizer] better statistics for the large allocator
llvm-svn: 172069
2013-01-10 13:38:38 +00:00
Kostya Serebryany e1be48fe64 [sanitizer] fix the non-cmake build (2-nd attempt)
llvm-svn: 172068
2013-01-10 13:33:15 +00:00
Dmitry Vyukov 22c53df947 asan/tsan: fix comment
llvm-svn: 172064
2013-01-10 13:06:35 +00:00
Kostya Serebryany 1199dc0327 [sanitizer] fix the non-cmake build
llvm-svn: 172063
2013-01-10 13:05:16 +00:00
Kostya Serebryany 4f6e4ae44a [sanitizer] add standalone_malloc_test
llvm-svn: 172061
2013-01-10 12:34:12 +00:00
Dmitry Vyukov 1bc29bd7bf tsan: add check for invalid fd
llvm-svn: 172060
2013-01-10 12:28:58 +00:00
Kostya Serebryany e54a9e6fbf [asan] don't fail the test if prctl(PR_SET_NAME) is not supported
llvm-svn: 172059
2013-01-10 11:55:43 +00:00
Evgeniy Stepanov 9b52ce94db [msan] Set program exit code in keep-going mode.
llvm-svn: 172057
2013-01-10 11:17:55 +00:00
Kostya Serebryany 8cc7b627b4 [asan] asan_allocator2: do less work under the quarantine lock; make the strcasecmp test more resistant to the contents of unaddressable memory
llvm-svn: 172048
2013-01-10 09:25:16 +00:00
Kostya Serebryany 4dd086841f [asan] better protect the tests from memset/memcpy inlining, explicitly include unistd.h
llvm-svn: 172045
2013-01-10 06:38:43 +00:00
Will Dietz e4b1d2e32c [ubsan] Give entry methods default (not hidden) visibility.
Fixes using ubsan on shared libraries in linux, for example.

llvm-svn: 172041
2013-01-10 03:37:30 +00:00
Dmitry Vyukov a626d03266 tsan: detect races on fd passed to epoll_ctl
llvm-svn: 171981
2013-01-09 17:31:27 +00:00
Kostya Serebryany 864ef315c0 [asan] make the slow unwinder a bit more robust. The unittests pass with fast_unwind_on_fatal=0, but I still observe some differences between the two unwinders
llvm-svn: 171973
2013-01-09 13:55:00 +00:00
Timur Iskhodzhanov 1d1f74cbf5 [ASan/Win] Satisfy lint
llvm-svn: 171970
2013-01-09 12:43:16 +00:00
Timur Iskhodzhanov 73e484aa8a [ASan/Win] Unbreak the 32-bit RTL build
llvm-svn: 171968
2013-01-09 12:03:27 +00:00
Dmitry Vyukov a681c01b69 tsan: fix crash when user defines own fopen/fileno
llvm-svn: 171967
2013-01-09 11:54:52 +00:00
Dmitry Vyukov b4ede780b0 tsan: fix crash when user defines own fopen/fileno
llvm-svn: 171958
2013-01-09 08:22:06 +00:00
Will Dietz b50565b21a [ubsan] Drop use of __atomic_exchange_n for now to fix build for some.
Need a more reliable way to check for support of this intrinsic.

llvm-svn: 171955
2013-01-09 06:18:40 +00:00
Will Dietz 765c266892 [ubsan] Add deduplication functionality, always enabled.
llvm-svn: 171948
2013-01-09 03:40:03 +00:00
Will Dietz 2b40b7ef84 [ubsan] Check for appropriate types on compound assignment overflow diagnostics.
llvm-svn: 171802
2013-01-07 22:25:54 +00:00
Will Dietz 82f61bf4b6 [ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
Fixed version of r171273.

llvm-svn: 171278
2012-12-31 06:36:44 +00:00
Chandler Carruth 5f8061bc36 Revert r171273 which doesn't actually compile.
Original commit message:
[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.

llvm-svn: 171277
2012-12-31 06:16:47 +00:00
Will Dietz d6cd3203f6 [ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
llvm-svn: 171273
2012-12-31 02:20:55 +00:00
Will Dietz 2a5f569d88 [ubsan] Update test now that check recovery is default and has driver flag.
llvm-svn: 171265
2012-12-30 20:53:39 +00:00
Kostya Serebryany 9756e2e0b3 [asan] make LargeOOBInMemset test resistant to clever compiler optimizations
llvm-svn: 171223
2012-12-29 14:42:48 +00:00
Kostya Serebryany b3d04ede8c [asan] add a new interface function __asan_describe_address, useful for running asan-ified binary under a debugger (e.g. gdb)
llvm-svn: 171217
2012-12-29 10:18:31 +00:00
Kostya Serebryany 9479a85963 [asan] fix a build warning
llvm-svn: 171200
2012-12-28 15:55:43 +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