Kostya Serebryany
b4c2c5c8a6
[asan] print a short one-line report summary after the full report. Currently, works only if symbolization happens in-process.
...
llvm-svn: 174501
2013-02-06 12:36:49 +00:00
Alexander Potapenko
34157fc33f
[ASan] Delete the code related to static runtime on OS X.
...
Nuke lib/interception/mach_override.
llvm-svn: 174383
2013-02-05 15:57:12 +00:00
Evgeniy Stepanov
36017454ac
[asan] Fix Win/Mac build.
...
llvm-svn: 174376
2013-02-05 15:02:12 +00:00
Evgeniy Stepanov
1bc7298c44
[asan] Fix nonsensical reports of partial right OOB.
...
In case of partial right OOB, ASan was reporting
X is located 0 bytes to the right of [A, B)
where X was actually inside [A, B).
With this change, ASan will report B as the error address in such case.
llvm-svn: 174373
2013-02-05 14:32:03 +00:00
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