Alexey Samsonov
2e50809961
[ASan] remove debug output from the test
...
llvm-svn: 174188
2013-02-01 16:06:25 +00:00
Kostya Serebryany
bda64b4d40
[sanitizer] make the error messages from sanitizer_common contain the actual tool name
...
llvm-svn: 174059
2013-01-31 14:11:21 +00:00
Alexey Samsonov
a0c0da8f51
[ASan] Split ASan interface header into private and public parts. Add a test that makes sure users can include interface header
...
llvm-svn: 174058
2013-01-31 13:46:14 +00:00
Evgeniy Stepanov
358698279d
[sanitizer] Further split private and public sanitizer headers.
...
And make msan_interface.h C-compatible.
llvm-svn: 173928
2013-01-30 13:12:08 +00:00
Alexey Samsonov
0d92533b29
Use LLVM_BUILD_TYPE instead of CMAKE_BUILD_TYPE in compiler-rt unit tests to match the behavior of llvm unittests
...
llvm-svn: 173926
2013-01-30 12:18:49 +00:00
Alexey Samsonov
49a32c1d08
[Sanitizer] update style checker script and fix namespace style warnings
...
llvm-svn: 173910
2013-01-30 07:45:58 +00:00
Alexey Samsonov
322d7fbd9d
ASan: fix lint
...
llvm-svn: 173795
2013-01-29 12:08:12 +00:00
Dmitry Vyukov
73b12d7132
asan: fix the test
...
llvm-svn: 173786
2013-01-29 09:59:53 +00:00
Alexey Samsonov
9aa2e4f5c4
[ASan] fix deallocation hook in allocator2: according to specification, dealloc hook should be called before deallocating memory
...
llvm-svn: 173778
2013-01-29 08:19:11 +00:00
Alexey Samsonov
615b86cf0a
[ASan] Do allocate memory even for zero-size allocation requests. Explain why we have to do this in comments.
...
llvm-svn: 173776
2013-01-29 07:51:34 +00:00
Alexey Samsonov
7eda134fa7
[ASan] fix a bug in allocator-v2 which could lead to SEGV on realloc(malloc(0), 4)
...
llvm-svn: 173681
2013-01-28 11:24:13 +00:00
Kostya Serebryany
61761f182b
[asan] fix a crash in asan stats printing (initialize the allocator in __asan_init)
...
llvm-svn: 173676
2013-01-28 08:05:47 +00:00
Kostya Serebryany
6c17547ef1
[asan] two more internal flags for asan-rt: print_stats (0) and print_legend (1)
...
llvm-svn: 173671
2013-01-28 07:34:22 +00:00
Alexey Samsonov
5311754b62
[CMake] Fix compiler-rt tests after r173617
...
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
Kostya Serebryany
c1056f90ae
[sanitizer] improve the calloc overflow check (spotted by samsonov@)
...
llvm-svn: 173443
2013-01-25 12:22:21 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +00:00
Kostya Serebryany
35fb1167b0
[asan] run-time tests for adaptive redzones
...
llvm-svn: 173336
2013-01-24 10:36:11 +00:00
Alexander Potapenko
56a3724cf1
[ASan] fix compilation on Mac by adding a missing pwrite parameter.
...
llvm-svn: 173333
2013-01-24 09:15:08 +00:00
Kostya Serebryany
7206a145dd
[sanitizer] increase the minimal mmap size in allocator to 2^16; fix the asan Mac build
...
llvm-svn: 173261
2013-01-23 14:07:17 +00:00
Kostya Serebryany
8f267137c2
[asan] initialize kHighMemEnd at startup (instead of at compile time) to simplify further changes for various address space layouts. Fix asan_allocator2 for PowerPC (tested on 44-bit address space)
...
llvm-svn: 173260
2013-01-23 13:27:43 +00:00
Kostya Serebryany
7d2e4c0389
[asan] simplify the code that poisons global redzones, add some more tests
...
llvm-svn: 173251
2013-01-23 11:14:21 +00:00
Alexander Potapenko
81f0b331dc
[ASan] Disable the new/delete implementations for OSX
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=131
llvm-svn: 173149
2013-01-22 11:39:28 +00:00
Alexey Samsonov
1e63b08575
ASan: add output test for -fsanitize-address-zero-based-shadow option on Linux
...
llvm-svn: 173146
2013-01-22 10:45:20 +00:00
Alexander Potapenko
dc00c44d46
[ASan] Remove the declarations of pthread_workqueue_t and pthread_workitem_handle_t, which are used no more.
...
Kudos to Jeremy Huddleston Sequoia <jeremyhu@apple.com>
llvm-svn: 173143
2013-01-22 10:32:06 +00:00
Alexey Samsonov
d7b901d581
ASan: use Clang -fsanitize-blacklist flag in unit tests (instead of -mllvm)
...
llvm-svn: 173142
2013-01-22 10:30:17 +00:00
Alexander Potapenko
0c92557fcb
[ASan] Fix the path to ASan interface in interface_symbols_linux.c
...
llvm-svn: 173140
2013-01-22 10:13:37 +00:00
Alexander Potapenko
5ef0f677ae
[ASan] Moved interface_symbols.c to lit_tests/Linux.
...
We already have Darwin-specific version of this test.
llvm-svn: 173136
2013-01-22 09:22:10 +00:00
Alexander Potapenko
cae42d23a6
[ASan] Use dylib interposition to hook memory allocation in the dynamic runtime.
...
This CL drastically simplifies the way we're hooking the memory allocation routines in ASan on Mac by using dylib interposition to replace the main malloc_zone_* functions. This allows us to avoid replacing the default CFAllocator and drop the CF dependency at all.
Committing this patch will result in the static runtime being broken. A follow-up CL will switch ASan to use the dynamic runtime library.
llvm-svn: 173134
2013-01-22 09:14:54 +00:00
Alexey Samsonov
a168f30073
ASan: simplify build rules for unit tests
...
llvm-svn: 173133
2013-01-22 07:31:28 +00:00
Alexey Samsonov
2f20275730
ASan: disable flexible mapping and offset on Android. It doesn't work for dynamic ASan runtime there
...
llvm-svn: 173132
2013-01-22 07:21:24 +00:00
Kostya Serebryany
56fc958506
[asan] split asan_test.cc even more
...
llvm-svn: 173131
2013-01-22 07:01:47 +00:00
Kostya Serebryany
81e916893d
[asan] split asan_test.cc more
...
llvm-svn: 173130
2013-01-22 06:50:42 +00:00
Kostya Serebryany
4184b64094
[asan] split asan_test.cc to speedup parallel build (most important if building with a debug clang, which takes a couple of minutes on this large file with templates). More splits to follow
...
llvm-svn: 173129
2013-01-22 06:39:20 +00:00
Kostya Serebryany
031b69d8df
[asan] fix linux build
...
llvm-svn: 173049
2013-01-21 15:04:36 +00:00
Alexander Potapenko
c21aa5cb39
[ASan] Move Mac-specific tests to asan_mac_test.cc
...
llvm-svn: 173048
2013-01-21 14:49:55 +00:00
Alexey Samsonov
b670018c9f
CMake: generalize checking for target availability and add initial support for PowerPC native arch. With this patch, building LLVM on PowerPC native arch produces a working ASan runtime.
...
llvm-svn: 173044
2013-01-21 14:31:45 +00:00
Alexey Samsonov
362286f34c
Fixup for r173021: build tests with zero-based shadow on Android only, fix condition in checking for shadow gap in asan_mapping.h
...
llvm-svn: 173026
2013-01-21 11:36:38 +00:00
Alexey Samsonov
6ad1d7809d
ASan: build unit tests with -fsanitize-address-zero-base-shadow on Linux and Android
...
llvm-svn: 173021
2013-01-21 10:51:18 +00:00
Evgeniy Stepanov
f940b2e381
[asan] Move *scanf declarations out of mac-only section.
...
llvm-svn: 173020
2013-01-21 10:33:14 +00:00
Alexey Samsonov
a58bcf70a1
ASan: use dynamic lookup when building dynamic ASan runtime on Mac, because shadow mapping and offset are defined in the instrumented modules instead of runtime
...
llvm-svn: 173015
2013-01-21 09:07:01 +00:00
Alexey Samsonov
b52d1a56f0
ASan: build runtime library with ASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 as shadow mapping/offset are always emitted by the LLVM backend now
...
llvm-svn: 173013
2013-01-21 08:24:19 +00:00
Alexey Samsonov
b399118cad
CMake: add functions creating universal runtime libraries for several architectures on OS X and use them in ASan and UBSan build rules
...
llvm-svn: 173011
2013-01-21 08:12:20 +00:00
Alexey Samsonov
3292fde911
Temporary disable test added in r172828 as it seems to be flaky on the buildbots
...
llvm-svn: 172976
2013-01-20 13:41:26 +00:00
Alexey Samsonov
b068483d4d
CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
...
llvm-svn: 172829
2013-01-18 16:51:07 +00:00
Alexander Potapenko
b4ba995366
[ASan] Fix the log_path option to use different log files for parent and child processes after fork().
...
llvm-svn: 172828
2013-01-18 16:44:27 +00:00
Alexey Samsonov
163ab9d0a5
CMake: create AddCompilerRT module and implement convenience add_compiler_rt_object_library function
...
llvm-svn: 172826
2013-01-18 16:05:21 +00:00
Evgeniy Stepanov
01671c33ff
[sanitizer] lint
...
llvm-svn: 172817
2013-01-18 13:12:56 +00:00
Kostya Serebryany
84c7e47b5c
[asan] kill some dead code
...
llvm-svn: 172815
2013-01-18 13:01:44 +00:00
Evgeniy Stepanov
a6c4a387ee
[sanitizer] Rename 2 files *.h->*.inc as appropriate.
...
Also add a missing include.
llvm-svn: 172814
2013-01-18 13:01:18 +00:00
Alexey Samsonov
193b45f4fe
CMake variables renaming: X86_64->x86_64 I386->i386
...
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Alexander Potapenko
a6d40f638e
[ASan] Fix compilation on Mac.
...
llvm-svn: 172810
2013-01-18 12:31:16 +00:00
Evgeniy Stepanov
91181eaa59
[sanitizer] Fix Mac build.
...
llvm-svn: 172809
2013-01-18 11:38:23 +00:00
Kostya Serebryany
63c36bbe5e
[asan] fix two off-by-one errors that seem to affect only PowerPC because only there the stack top may be equal to the address space top. Noted by Andreas Schwab in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55975#c11 . Also make swapcontext interceptor a bit more robust
...
llvm-svn: 172807
2013-01-18 11:30:36 +00:00
Evgeniy Stepanov
222076e972
[sanitizer] Common *scanf interceptors.
...
llvm-svn: 172805
2013-01-18 11:17:23 +00:00
Alexander Potapenko
51794a390f
Remove references to pthread_workqueue_additem_np(), which isn't in the official libdispatch API.
...
llvm-svn: 172802
2013-01-18 10:27:31 +00:00
Alexey Samsonov
9585613334
[ASan] fixes for Android build
...
llvm-svn: 172800
2013-01-18 09:20:06 +00:00
Kostya Serebryany
69fe0ba415
[sanitizer] reapply r172719, r172721-172723, r172725, and also fix the warning on Mac.
...
llvm-svn: 172791
2013-01-18 06:43:13 +00:00
Jakob Stoklund Olesen
7956e0094d
Revert r172719, r172721-172723, and r172725.
...
The r172719 patch broke the build on Mac, the others depended on it.
compiler-rt/lib/asan/asan_interceptors.cc:78:13: error: unused function
'SetThreadName' [-Werror,-Wunused-function]
static void SetThreadName(const char *name) {
Orignal headlines:
[asan] attempting to fix the Mac build
[asan] restructure read/pread/pread64 tests
[sanitizer] move write/pwrite/pwrite64 interceptors to common
[msan] start using common interceptors in msan
[tsan] move prctl interceptor from asan to common_interceptors thus enabling it for tsan too
llvm-svn: 172763
2013-01-17 22:51:56 +00:00
Alexey Samsonov
4f1885a109
[ASan] minor changes to swapcontext handling: don't clear shadow memory if context stack is too large
...
llvm-svn: 172727
2013-01-17 15:45:28 +00:00
Alexey Samsonov
708442294e
ASan: Allow __asan_get_allocated_size(malloc(0)) to be 0 or 1
...
llvm-svn: 172726
2013-01-17 15:26:47 +00:00
Kostya Serebryany
87eb229241
[asan] attempting to fix the Mac build
...
llvm-svn: 172725
2013-01-17 15:14:20 +00:00
Kostya Serebryany
709d0dac81
[asan] restructure read/pread/pread64 tests
...
llvm-svn: 172723
2013-01-17 14:58:29 +00:00
Kostya Serebryany
f7f5566055
[tsan] move prctl interceptor from asan to common_interceptors thus enabling it for tsan too
...
llvm-svn: 172719
2013-01-17 13:38:16 +00:00
Alexey Samsonov
769af07372
[ASan] fix __asan_get_ownership(p) and __asan_get_allocated_size(p) for the p = malloc(0)
...
llvm-svn: 172717
2013-01-17 13:25:17 +00:00
Kostya Serebryany
93ebdb5d64
[sanitizer] a bit more unification for interceptors (merge read/pread/pread64 in asan and tsan)
...
llvm-svn: 172713
2013-01-17 13:09:00 +00:00
Kostya Serebryany
b7062cec53
[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated chunk in case there is an old memalign magic)
...
llvm-svn: 172603
2013-01-16 09:12:14 +00:00
Kostya Serebryany
d8b1f78296
[asan] enable asan_allocator2 by default on Linux. Will enable it on other platforms and remove the old one later, after additional testing. The new allocator is much faster and uses less memory
...
llvm-svn: 172531
2013-01-15 13:57:39 +00:00
Dmitry Vyukov
0d46b2b95e
asan: fix the constant for new allocator cache
...
llvm-svn: 172526
2013-01-15 10:45:18 +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
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
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
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
f22982bf0a
asan/tsan: move blocking mutex from asan to sanitizer_common
...
llvm-svn: 172380
2013-01-14 07:51:39 +00:00
Dmitry Vyukov
a40a805f30
asan: fix FIXME on windows
...
llvm-svn: 172226
2013-01-11 17:57:24 +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
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
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
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
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
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
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
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
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
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
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
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
Kostya Serebryany
3cc719fdf9
[asan] asan_allocator2: better memory stats
...
llvm-svn: 170888
2012-12-21 12:26:31 +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
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
Richard Relph
27cfe1c1b5
Clean up some warnings that become errors. Seen in Xcode.
...
llvm-svn: 170843
2012-12-21 05:17:13 +00:00
Alexey Samsonov
19e8b7ecba
[ASan] remove duplicate entry in shadow byte legend
...
llvm-svn: 170701
2012-12-20 15:19:10 +00:00
Kostya Serebryany
c0d8ca5537
[asan] asan_allocator2: implement memalign
...
llvm-svn: 170697
2012-12-20 14:35:06 +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
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
Kostya Serebryany
ab8d33184d
[asan] asan_allocator2: make all remaining tests pass.
...
llvm-svn: 170680
2012-12-20 08:53:41 +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
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
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
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
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
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
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
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
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
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
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
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
eec22a628b
[asan] fix the Android build (pread64 interceptor again)
...
llvm-svn: 170098
2012-12-13 05:27:08 +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
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
Alexander Potapenko
602a09fa52
[ASan] Fixed a compiler warning.
...
llvm-svn: 169972
2012-12-12 12:32:57 +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
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
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
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
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
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
Kostya Serebryany
86975ce3fb
[asan] drop the extension from asan tests (as the extension may be different)
...
llvm-svn: 169392
2012-12-05 17:56:54 +00:00
Kostya Serebryany
1a6f4d4ba6
[asan] undo the debug printf
...
llvm-svn: 169381
2012-12-05 13:39:29 +00:00
Kostya Serebryany
571232b8cf
[tsan] get rid of *allocator64* files, moving everything to *allocator* files. This will help with the 32-bit allocator implementation and testing
...
llvm-svn: 169368
2012-12-05 10:09:15 +00:00
Alexander Potapenko
0dcd6d9468
[ASan] Do not build the interceptors that use ObjC blocks if the compiler does not support blocks.
...
Need to define MISSING_BLOCKS_SUPPORT in this case at buildtime.
Patch by Jack Howarth <howarth@bromo.med.uc.edu>
llvm-svn: 169206
2012-12-04 02:41:47 +00:00
Alexey Samsonov
45b6edbd1d
ASan: add new interface functions - __asan_(un)poison_stack_memory. Calls to these functions are inserted by the instrumentation pass in use-after-scope mode
...
llvm-svn: 169201
2012-12-04 01:38:15 +00:00
Kostya Serebryany
214b715061
[asan] two more bits for __sparc__
...
llvm-svn: 169141
2012-12-03 18:39:21 +00:00
Kostya Serebryany
a960b2c6da
[asan] EXPECT_EQ => ASSERT_EQ around pthread_create/pthread_join calls
...
llvm-svn: 169121
2012-12-03 11:37:03 +00:00
Kostya Serebryany
d5aafcf618
[asan] in asan tests, check all return values of pthread_create/pthread_join. Also add the ASAN_AVOID_EXPENSIVE_TESTS macro to guard the test that creates too many threads
...
llvm-svn: 169118
2012-12-03 09:43:56 +00:00
Kostya Serebryany
436462046a
[asan] make asan_test.cc more gcc-friendly
...
llvm-svn: 168992
2012-11-30 10:41:42 +00:00
Kostya Serebryany
6a786e66cf
[asan] simplify break_optimization in tests (Jakub Jelinek)
...
llvm-svn: 168990
2012-11-30 09:52:44 +00:00
Alexey Samsonov
b90501d7da
[ASan] use brand new -fsanitize= values for init-order/use-after-return ASan output tests
...
llvm-svn: 168951
2012-11-29 22:56:01 +00:00
Kostya Serebryany
dde9dcc24b
[asan] disable BuiltinLongJmpTest on Android
...
llvm-svn: 168872
2012-11-29 12:18:48 +00:00
Kostya Serebryany
e73a480970
[asan] enable BuiltinLongJmpTest
...
llvm-svn: 168863
2012-11-29 09:02:14 +00:00
Kostya Serebryany
df5f3028e2
[asan] add DISABLED_BuiltinLongJmpTest
...
llvm-svn: 168793
2012-11-28 15:01:23 +00:00
Kostya Serebryany
19e34c23c5
[asan] fix Android build by not calling GetPageSizeCached in a test (no need for the page size anyway)
...
llvm-svn: 168585
2012-11-26 11:23:30 +00:00
Kostya Serebryany
df198db1aa
[asan/tsan] get rid of kPageSize completely in favor of GetPageSizeCached(). This makes the code friendly to more platforms
...
llvm-svn: 168537
2012-11-24 05:03:11 +00:00
Kostya Serebryany
f22c697f58
[asan] get rid of some of the uses of kPageSize. The intent is to get rid of it completely to support platforms with multiple possible page sizes.
...
llvm-svn: 168517
2012-11-23 15:38:49 +00:00
Alexey Samsonov
1a05424ee0
[ASan] move swapcontext_test to Linux-specific tests
...
llvm-svn: 168513
2012-11-23 11:20:54 +00:00
Alexey Samsonov
aac36b345a
[ASan] intercept swapcontext on Linux only
...
llvm-svn: 168509
2012-11-23 10:14:44 +00:00
Alexey Samsonov
0d7755ccb5
[ASan] Add interceptor for swapcontext to fight with false positives in some of its use cases.
...
llvm-svn: 168508
2012-11-23 09:46:34 +00:00
Kostya Serebryany
734f1eb5f4
[asan/tsan] do not use __WORDSIZE macro, as it is glibc-private thing. Instead, define our own SANITIZER_WORDSIZE
...
llvm-svn: 168424
2012-11-21 12:38:58 +00:00
Kostya Serebryany
6db8ad43df
[asan] pop the two internal functions from the stack trace produced by _Unwind_Backtrace (Peter Bergner)
...
llvm-svn: 168369
2012-11-20 15:15:44 +00:00
Kostya Serebryany
46de580003
[asan] more support for powerpc, patch by Peter Bergner
...
llvm-svn: 168356
2012-11-20 07:00:42 +00:00
Alexey Samsonov
27a22688b9
[ASan] use raw Exit() to kill the program in case ASan finds an error while reporting the error in the same thread
...
llvm-svn: 168308
2012-11-19 11:22:22 +00:00
Alexey Samsonov
06b22c1513
[ASan] change interface of GetAccumulatedStats() function to prevent Clang from inserting memcpy() call into runtime.
...
llvm-svn: 168305
2012-11-19 10:25:17 +00:00
Dmitry Vyukov
4ee90c231a
asan: sync with gcc r193553
...
llvm-svn: 168151
2012-11-16 11:26:05 +00:00
Alexander Potapenko
bcc00a4174
[ASan] Revert r168040 and r168043 and take a cleaner solution suggested by Kostya: return the known frame name for fake stack instead of looking it up.
...
llvm-svn: 168046
2012-11-15 15:24:42 +00:00
Alexander Potapenko
93dcc8d2bd
[ASan] Minor fix: return to the last byte of the fake stack if we've raced by.
...
llvm-svn: 168043
2012-11-15 14:59:19 +00:00
Alexander Potapenko
b34db9e883
[ASan] Poison the leftmost shadow byte with a special value so that we can find
...
the beginning of the fake frame when reporting an use-after-return error.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=126
llvm-svn: 168040
2012-11-15 13:40:44 +00:00
Alexey Samsonov
2906117857
[ASan] now we don't need llvm_obj_root to access llvm-symbolizer tool
...
llvm-svn: 167823
2012-11-13 07:55:16 +00:00
Alexey Samsonov
c835b9e4a3
[ASan] test blacklist functionality for global-init-order checker (r167725)
...
llvm-svn: 167727
2012-11-12 14:03:00 +00:00
Alexander Potapenko
9448581d9e
[ASan] Remove llvm-symbolizer from compiler-rt/utils/
...
This is the first (1/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.
llvm-svn: 167722
2012-11-12 11:32:42 +00:00
Alexander Potapenko
5066c5d9b7
[ASan] Fix the golden stack for use-after-free.cc.
...
The change has been caused by the switch to llvm-symbolizer, that prints inlined stack frames.
This should fix PR 14251
llvm-svn: 167721
2012-11-12 11:27:24 +00:00
Alexander Potapenko
4b8e32de12
Add a possible underscore before the wrappers to the output expectations for Darwin
...
llvm-svn: 167610
2012-11-09 11:55:33 +00:00
Alexey Samsonov
37119db20a
[ASan] avoid including <new> header in ASan runtime
...
llvm-svn: 167579
2012-11-08 13:31:19 +00:00
Richard Smith
77930919ad
Update compiler-rt tests to match flag renaming/deprecation in Clang.
...
llvm-svn: 167434
2012-11-06 02:31:42 +00:00
Alexey Samsonov
0c8b755839
Flag -ccc-clang-cxx was removed in r166986, remove it from compiler-rt lit configs
...
llvm-svn: 167010
2012-10-30 10:06:42 +00:00
Alexey Samsonov
23b9199776
[ASan] don't run hacky test for __asan_get_free_bytes() on 32-bits
...
llvm-svn: 166771
2012-10-26 12:10:24 +00:00
Alexander Potapenko
99843d3a29
In the dynamic runtime on Mac OS, do not call internal_strdup() before __asan_init().
...
This may result in a crash at startup.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=123 .
llvm-svn: 166768
2012-10-26 11:31:14 +00:00
Alexander Potapenko
1eef2b813c
[ASan] Rename ReplaceCFAllocator to MaybeReplaceCFAllocator.
...
Replace the allocator only if the replace_cfallocator flag is set (in some cases it wasn't checked)
llvm-svn: 166550
2012-10-24 09:35:23 +00:00
Alexander Potapenko
faa9c86fd0
[ASan] Use internal_memmove() in both static and dynamic runtime libraries if asan_inited != 0.
...
llvm-svn: 166549
2012-10-24 09:19:16 +00:00
Alexey Samsonov
cea6239219
[ASan] Due to data races, ASan malloc stats are inaccurate, which may cause certain ASan interface functions returning negative values (casted to unsigned). Return a reasonable value if such a case is detected.
...
llvm-svn: 166548
2012-10-24 09:19:11 +00:00
Alexey Samsonov
555d1c5ab8
[ASan] add comment to blacklist file to test behavior introduced in r166283
...
llvm-svn: 166284
2012-10-19 15:26:48 +00:00
Alexey Samsonov
521309294f
[ASan] instrumented asan unit tests should depend on blacklist file
...
llvm-svn: 166282
2012-10-19 15:18:14 +00:00
Evgeniy Stepanov
ad18287e56
[asan] Disable new/delete interceptors on Android and make them visible elsewhere.
...
llvm-svn: 166180
2012-10-18 15:22:08 +00:00
Chandler Carruth
580916eacb
Re-enable this test now that r166172 has hacked around the terrible
...
limitations of the pass manager stack in the pass manager builder.
llvm-svn: 166173
2012-10-18 08:06:28 +00:00
Alexey Samsonov
5f1a7589ad
[ASan] unit tests: Move main() to a separate file. Fix lint
...
llvm-svn: 166104
2012-10-17 14:04:57 +00:00
Kostya Serebryany
9ced62d195
[asan] added a test for a bug in asan at -O0 introduced by r165936 (making asan a FunctionPass). The test is not actually enabled for -O0 yet (since it fails)
...
llvm-svn: 166103
2012-10-17 13:42:04 +00:00
Alexey Samsonov
7b52cb9e6d
[ASan] Fix strchr/index tests for users who have 'char* strchr(char*,int)' instead of 'char* strchr(const char*, int)'
...
llvm-svn: 166101
2012-10-17 13:39:09 +00:00
Alexey Samsonov
4230a4a05a
[ASan] don't use attribute no_address_safety_analysis if it's unknown to compiler
...
llvm-svn: 166099
2012-10-17 13:19:59 +00:00
Kostya Serebryany
05a3b01d4f
[asan] fix gcc warnings while building asan-rt
...
llvm-svn: 166093
2012-10-17 08:50:53 +00:00
Alexander Potapenko
e3e80d607f
Do not call ReplaceCFAllocator() before __CFInitialize(), otherwise crashes are possible on 10.8.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=122
llvm-svn: 166029
2012-10-16 16:58:10 +00:00
Alexander Potapenko
5109e3ef88
Commit a leftover file from r166026: Add MACOS_VERSION_MOUNTAIN_LION.
...
llvm-svn: 166028
2012-10-16 16:48:51 +00:00
Alexander Potapenko
4a78e1002d
Add MACOS_VERSION_MOUNTAIN_LION.
...
llvm-svn: 166026
2012-10-16 16:24:49 +00:00
Alexander Potapenko
7b03290c43
Implement internal_memmove.
...
Use internal_memmove() and internal_memcpy() in the memcpy() and memmove() wrappers
when building the dynamic runtime (OS X only), to work around a bug in resolver functions wrapping.
See also http://code.google.com/p/address-sanitizer/issues/detail?id=116
llvm-svn: 165939
2012-10-15 15:34:41 +00:00
Kostya Serebryany
ee112b5d7f
[asan] fix more tests
...
llvm-svn: 165934
2012-10-15 13:30:38 +00:00
Kostya Serebryany
16205cd4fa
[asan] change the asan output slightly to avoid user confusion: a) add ':' after 'AddressSanitizer' and b) changed 'crashed' to 'SEGV'
...
llvm-svn: 165932
2012-10-15 13:04:58 +00:00
Alexey Samsonov
83ecabe6e6
[Sanitizer] Remove unneeded returns after UNIMPLEMENTED macro
...
llvm-svn: 165493
2012-10-09 08:51:08 +00:00
Alexey Samsonov
480477c0e1
[ASan] use llvm-symbolizer for ASan lit-style tests on Mac
...
llvm-svn: 165391
2012-10-08 13:11:18 +00:00
Alexander Potapenko
b4db79fc7d
If !asan_inited, call internal versions of libc functions where available.
...
This is to remove unnecessary #if directives.
llvm-svn: 165307
2012-10-05 12:11:06 +00:00
Alexander Potapenko
d2f6b97417
Avoid calling __asan_init from memcpy(), memmove(), memset() during libSystem initialization.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=117 .
llvm-svn: 165227
2012-10-04 13:41:28 +00:00
Kostya Serebryany
cb13fff13d
[asan] properly report mmap failure
...
llvm-svn: 165214
2012-10-04 07:21:09 +00:00
Alexander Potapenko
0f0a50da56
Set ASAN_NEEDS_SEGV=0 on Android only.
...
llvm-svn: 165120
2012-10-03 15:09:17 +00:00
Alexander Potapenko
77c0ac2336
Do not patch the instruction address when symbolizing the reports.
...
Instead, print the correct address at runtime.
llvm-svn: 165018
2012-10-02 15:42:24 +00:00
Alexey Samsonov
78c340d205
[ASan] Change __asan_set_on_error_callback to weak overridable __asan_on_error, so that ASan would call the latter even if it finds the error early (i.e. during module initialization)
...
llvm-svn: 165008
2012-10-02 14:06:39 +00:00
Alexey Samsonov
298e237d7e
[ASan] Add extern C for __asan_symbolize on Windows
...
llvm-svn: 165003
2012-10-02 12:35:42 +00:00
Alexey Samsonov
e29c6731aa
[Sanitizer/ASan] Simplify the code that prints and symbolizes stack traces. Fall back to module+offset if user-provided symbolizer failed. Use weak function __asan_symbolize instead of __asan_set_symbolize_callback in ASan interface, so that we're able to symbolize reports for errors that happen before the main() is called, for example, during module initialization.
...
llvm-svn: 165000
2012-10-02 12:11:17 +00:00
Alexey Samsonov
c3f61d8eec
[ASan] Fix unit test headers. Add an option to change substitute asan_test_config.h file
...
llvm-svn: 164821
2012-09-28 12:24:23 +00:00
Alexey Samsonov
2d9899b2ce
[ASan] use llvm-symbolizer (in offline mode) in ASan output tests on Linux
...
llvm-svn: 164819
2012-09-28 11:05:41 +00:00
Evgeniy Stepanov
9792396a06
[asan] Change defaults for Android target.
...
This way building without -DASAN_* in CFLAGS produces working binaries.
llvm-svn: 164816
2012-09-28 10:07:53 +00:00
Alexander Potapenko
3f6a5c1b2d
Fixed a number of gpylint warnings, added binary names filtering (useful for Chrome), minor fixes.
...
llvm-svn: 164695
2012-09-26 13:16:42 +00:00
Alexander Potapenko
59cc8776c4
Encapsulate the main loop into a class to allow reusing it.
...
llvm-svn: 164694
2012-09-26 12:12:41 +00:00
Alexander Potapenko
fa2a964540
Set --use-symbol-table=true as Alexey has already resolved the FIXME.
...
llvm-svn: 164693
2012-09-26 11:36:14 +00:00
Alexey Samsonov
a555b3faf4
[ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state.
...
llvm-svn: 164486
2012-09-24 11:43:40 +00:00
Alexey Samsonov
ea2fb08545
[ASan] make asan_symbolize script work if there is no llvm-symbolizer available
...
llvm-svn: 164214
2012-09-19 11:43:41 +00:00
Alexey Samsonov
52565d5491
[ASan] fix offline python symbolizer script to use llvm-symbolizer if possible
...
llvm-svn: 164209
2012-09-19 08:49:53 +00:00
Alexey Samsonov
11b9e97cd9
[ASan] cleanup: fix headers and lint warnings
...
llvm-svn: 164205
2012-09-19 07:07:46 +00:00
Alexander Potapenko
431ea19327
Intercept signal() and sigaction() within the dynamic runtime on Mac.
...
Add a test that ensures that ASan does not allow to override the signal handlers.
llvm-svn: 164118
2012-09-18 12:49:51 +00:00
Alexey Samsonov
8661465edd
[ASan] Move printing descriptions of heap addresses in error report from allocator internals to asan_report.cc.
...
llvm-svn: 164112
2012-09-18 07:38:10 +00:00
Alexey Samsonov
3869b4b35a
[ASan] increase sleep time if ASan finds two bugs simultaneously to make sure full error report is printed
...
llvm-svn: 164018
2012-09-17 08:02:19 +00:00
Evgeniy Stepanov
6c0850afa4
Remove some debugging code.
...
llvm-svn: 163881
2012-09-14 08:57:50 +00:00
Kostya Serebryany
45d849c4bd
[asan] add asan option log_path=PATH to let users redirect asan reports to a file PATH.PID instead of stderr
...
llvm-svn: 163872
2012-09-14 04:35:14 +00:00
Alexander Potapenko
f3a96894a6
Give more accurate malloc statistics to malloc_zone_statistics().
...
Fix a warning in macros instantiation.
llvm-svn: 163716
2012-09-12 15:29:50 +00:00
Alexey Samsonov
4787d0fbef
[ASan] more macro/casting magic to suppress warnings
...
llvm-svn: 163706
2012-09-12 14:10:14 +00:00
Alexey Samsonov
26d7a06da3
[ASan] fix compiler warnings for unit test on Android
...
llvm-svn: 163704
2012-09-12 12:07:36 +00:00
Alexey Samsonov
a81d268acd
[ASan] fix interception macro for Android build
...
llvm-svn: 163692
2012-09-12 09:42:23 +00:00
Alexander Potapenko
814451909a
Initial support for malloc_zone_statistics. All counters are set to zero now.
...
This is required to overcome a crash in mstats() (http://code.google.com/p/address-sanitizer/issues/detail?id=109 )
llvm-svn: 163690
2012-09-12 09:38:51 +00:00
Alexey Samsonov
694633e19b
[Sanitizer] first effort to start building ASan runtime with -Werror in CMake build
...
llvm-svn: 163686
2012-09-12 07:38:47 +00:00
Evgeniy Stepanov
1a8f8fa6c0
CMake build rules for ASan Android runtime and tests.
...
llvm-svn: 163613
2012-09-11 11:55:45 +00:00
Alexey Samsonov
eeec3c11b5
[compiler-rt] Install support for CMake build of compiler-rt
...
llvm-svn: 163607
2012-09-11 10:26:54 +00:00
Alexey Samsonov
5c6b93bc33
[Sanitizer] Get rid of dependency between sanitizer_common and asan/tsan runtimes: implement tool-specific Die and CheckFailed functions via callbacks
...
llvm-svn: 163603
2012-09-11 09:44:48 +00:00
Chandler Carruth
b156b56a28
Revert r163411 based on review discussion.
...
In code review, it looked like these warnings do not actually fire with
modern Clang or GCC. However, the pragma is flat out rejected by GCC in
many configurations (-Werror) so it ended up causing more problems than
it fixed.
Daniel agreed with reverting this, but I think didn't have time to get
to it.
llvm-svn: 163583
2012-09-11 01:13:51 +00:00
Alexander Potapenko
67192d41ee
Allow to call strchr() from __asan_init().
...
Fixes PR13794.
llvm-svn: 163493
2012-09-10 08:35:12 +00:00
Daniel Dunbar
9d098bc09a
[asan] Use a relative include path instead of requiring build system involvement.
...
llvm-svn: 163414
2012-09-07 19:57:32 +00:00
Daniel Dunbar
44b3474b0e
build: Teach Makefile build system about asan/dynamic subdir.
...
llvm-svn: 163413
2012-09-07 19:57:28 +00:00
Daniel Dunbar
04ab17b0cd
[asan] Suppress some bogus -Winvalid-noreturn diagnostics.
...
llvm-svn: 163411
2012-09-07 19:57:20 +00:00
Alexander Potapenko
38c3f9ef2f
Remove the infinite recursion check for now, as we don't have __thread on Mac, and TSD is an overkill.
...
llvm-svn: 163393
2012-09-07 15:50:19 +00:00
Alexander Potapenko
c5adb8a700
Two minor changes:
...
-- exit from infinite recursion in CHECK()
-- print a verbose message if mapping of the shadow memory has failed.
llvm-svn: 163391
2012-09-07 15:34:40 +00:00
Evgeniy Stepanov
6e6817a823
[asan] Raise quarantine size a bit with ASAN_LOW_MEMORY.
...
Our tests expect that a 16M block will fit in the quarantine.
llvm-svn: 163384
2012-09-07 12:13:52 +00:00
Alexey Samsonov
f42e860c51
[ASan] hack initialization-bug test so that it stably passes on both Linux and Mac: make the bug appear independent of the translation unit order
...
llvm-svn: 163381
2012-09-07 09:24:29 +00:00
Alexey Samsonov
0f5f1d5bfa
[ASan] add Linux-specific test for initialization order that checks that we find a bug independently of translation units order
...
llvm-svn: 163379
2012-09-07 09:04:31 +00:00
Alexander Potapenko
35bc23ce58
Fix two compiler warnings: must use at least one argument for "..." in a variadic macros, signed vs. unsigned comparison.
...
llvm-svn: 163314
2012-09-06 13:31:13 +00:00
Evgeniy Stepanov
65fb0a5425
[asan] Use __ANDROID__ guard in asan_test.
...
llvm-svn: 163313
2012-09-06 12:50:28 +00:00
Alexander Potapenko
3ecf916c33
Use the return value of dladdr() to avoid Clang warning.
...
llvm-svn: 163311
2012-09-06 12:18:45 +00:00
Kostya Serebryany
f9caa28ccf
[asan] increase max stack size to 256 (+test)
...
llvm-svn: 163308
2012-09-06 10:57:03 +00:00
Alexey Samsonov
36853a7a3b
[ASan] actually remove old makefile
...
llvm-svn: 163300
2012-09-06 09:30:09 +00:00
Alexey Samsonov
ac87a5bddc
[ASan] Nuke output_tests/ in favor of lit_tests/. Stop using Makefile.old.
...
llvm-svn: 163294
2012-09-06 06:39:02 +00:00
Kostya Serebryany
ae350f66d4
[asan] increase the maximal size of malloc/free stack
...
llvm-svn: 163291
2012-09-06 04:46:47 +00:00
Alexey Samsonov
2947b84743
[ASan] Hack ASan lit config to allow running lit on tests manually
...
llvm-svn: 163209
2012-09-05 10:41:25 +00:00
Kostya Serebryany
4d45b9b784
[asan] added tests for asan-initialization-order, patch by Reid Watson
...
llvm-svn: 163207
2012-09-05 09:07:02 +00:00
Alexey Samsonov
d83ccd067d
[ASan] hoist more compile flags to SANITIZER_COMMON_CFLAGS var and add the rest of flags/defs from old Makefile to CMake
...
llvm-svn: 163204
2012-09-05 09:00:03 +00:00
Alexey Samsonov
ab2c76711d
[ASan] Add CMake support for building ASan benchmarks
...
llvm-svn: 163201
2012-09-05 08:07:18 +00:00
Alexey Samsonov
c402cb62fd
[ASan] Add print_full_thread_history runtime option (on by default) that prints all full thread creation paths for threads involved in ASan error report
...
llvm-svn: 163200
2012-09-05 07:37:15 +00:00
Alexey Samsonov
de827cb42b
[Sanitizer] Remove lint checkers from our old makefiles in favor of buildbot
...
llvm-svn: 162981
2012-08-31 08:10:28 +00:00
Alexey Samsonov
c3a8119a41
Whitespace/lint
...
llvm-svn: 162909
2012-08-30 14:22:21 +00:00
Alexey Samsonov
608a4b5def
[ASan] fix flakiness of Linux-specific clone_test: waitpid should better be provided with __WCLONE option, otherwise it didn't wait for the subprocess, returned -1, and we went crushing the subprocess stack
...
llvm-svn: 162842
2012-08-29 15:48:14 +00:00
Alexander Potapenko
5a9b616d6b
For invalid pointers passed to free_common check whether they are actually skewed to hold an additional CFAllocatorRef.
...
If so, fix the pointer and pass it to asan_free.
See http://code.google.com/p/address-sanitizer/issues/detail?id=70 for more background.
llvm-svn: 162839
2012-08-29 12:36:24 +00:00
Kostya Serebryany
e4d9c7b940
[asan] fix asan's Makefile.old -- our build bot still uses it (hopefully, will soon migrate to cmake completely)
...
llvm-svn: 162831
2012-08-29 08:06:27 +00:00
Chandler Carruth
1aa4fef601
Relocate the external headers provided by ASan and the common sanitizer
...
library.
These headers are intended to be available to user code when built with
AddressSanitizer (or one of the other sanitizer's in the future) to
interface with the runtime library. As such, they form stable external
C interfaces, and the headers shouldn't be located within the
implementation.
I've pulled them out into what seem like fairly obvious locations and
names, but I'm wide open to further bikeshedding of these names and
locations.
I've updated the code and the build system to cope with the new
locations, both CMake and Makefile. Please let me know if this breaks
anyone's build.
The eventual goal is to install these headers along side the Clang
builtin headers when we build the ASan runtime and install it. My
current thinking is to locate them at:
<prefix>/lib/clang/X.Y/include/sanitizer/common_interface_defs.h
<prefix>/lib/clang/X.Y/include/sanitizer/asan_interface.h
<prefix>/lib/clang/X.Y/include/sanitizer/...
But maybe others have different suggestions?
Fixing the style of the #include between these headers at least unblocks
experimentation with installing them as they now should work when
installed in these locations.
llvm-svn: 162822
2012-08-29 02:27:54 +00:00
Chandler Carruth
c1c9d5818f
Some flag cleanup for the sanitizer runtimes.
...
This hoists most of the CFLAGS into a common variable. It also adds
detection for -Wno-c99-extensions and uses it to silence a pile of
warnings.
Finally, it switches to the proper flag -rdynamic.
With this, the cmake build is warning free on my bootstrap Linux build.
llvm-svn: 162809
2012-08-29 00:13:11 +00:00
Kostya Serebryany
66a37f3aef
[asan] one more fix for windows build
...
llvm-svn: 162762
2012-08-28 15:25:07 +00:00
Kostya Serebryany
27dcb2379f
[asan] fix Windows build
...
llvm-svn: 162758
2012-08-28 14:14:30 +00:00
Kostya Serebryany
7575968aa4
[asan] actually move StackTrace to sanitizer_common
...
llvm-svn: 162757
2012-08-28 14:11:57 +00:00
Kostya Serebryany
a57b4e823a
[asan] even more refactoring to move StackTrace to sanitizer_common
...
llvm-svn: 162754
2012-08-28 13:49:49 +00:00
Kostya Serebryany
ee92877f17
[asan] more refactoring to move StackTrace to sanitizer_common
...
llvm-svn: 162752
2012-08-28 13:25:55 +00:00
Alexey Samsonov
50e8a6a7df
[ASan] CMake build: share more compile flags between instrumented and non-instrumented tests
...
llvm-svn: 162750
2012-08-28 12:38:17 +00:00
Kostya Serebryany
6b0d775229
[asan] some renaming before we move StackTrace into sanitizer_common
...
llvm-svn: 162747
2012-08-28 11:54:30 +00:00
Kostya Serebryany
bb6f165952
[asan] get rid of AsanPrintf in favor of Printf from sanitizer_common
...
llvm-svn: 162746
2012-08-28 11:34:40 +00:00
Kostya Serebryany
4bfe954d14
[asan] improve SetErrorReportCallbackTest to actually catch missing functionality in __asan_set_error_report_callback
...
llvm-svn: 162745
2012-08-28 11:21:01 +00:00