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
709d0dac81
[asan] restructure read/pread/pread64 tests
...
llvm-svn: 172723
2013-01-17 14:58:29 +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
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
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
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
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
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
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
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
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
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
Kostya Serebryany
c0d8ca5537
[asan] asan_allocator2: implement memalign
...
llvm-svn: 170697
2012-12-20 14:35:06 +00:00
Kostya Serebryany
8627af3779
[asan] add memalign tests
...
llvm-svn: 170687
2012-12-20 12:11:52 +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
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
Alexey Samsonov
65c14f5314
[ASan] more macro for conditional interception of pread functions
...
llvm-svn: 170112
2012-12-13 08:10:23 +00:00
Alexander Potapenko
d27e4861bf
[ASan] Fix test expectations for strcat/strncat.
...
llvm-svn: 169987
2012-12-12 16:10:46 +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
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
3ba26fe553
[asan] make ThreadNamesTest more flexible
...
llvm-svn: 169822
2012-12-11 06:23:10 +00:00
Kostya Serebryany
40bac5b01f
[asan] fix lint, remove debug prints
...
llvm-svn: 169620
2012-12-07 18:07:52 +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
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
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
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
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
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
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
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
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
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
Kostya Serebryany
ee112b5d7f
[asan] fix more tests
...
llvm-svn: 165934
2012-10-15 13:30:38 +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
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
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
Evgeniy Stepanov
6c0850afa4
Remove some debugging code.
...
llvm-svn: 163881
2012-09-14 08:57:50 +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
26d7a06da3
[ASan] fix compiler warnings for unit test on Android
...
llvm-svn: 163704
2012-09-12 12:07:36 +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
Evgeniy Stepanov
65fb0a5425
[asan] Use __ANDROID__ guard in asan_test.
...
llvm-svn: 163313
2012-09-06 12:50:28 +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
c3a8119a41
Whitespace/lint
...
llvm-svn: 162909
2012-08-30 14:22:21 +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
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
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
Kostya Serebryany
ad855e9438
[asan] better diagnostics for mmap failure
...
llvm-svn: 161874
2012-08-14 15:18:40 +00:00
Alexey Samsonov
f87ff74075
[ASan] Add __asan_set_on_error_callback() interface function that allows user to set a callback to be called right when ASan detects an error
...
llvm-svn: 161754
2012-08-13 11:23:40 +00:00
Alexey Samsonov
fb844c7eff
[ASan] CMake support for building ASan runtime as a universal binary on Mac
...
llvm-svn: 161665
2012-08-10 14:45:52 +00:00
Alexey Samsonov
59c33c0c9a
[ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command)
...
llvm-svn: 161406
2012-08-07 08:59:15 +00:00
Alexander Potapenko
33824c54f6
Make strcat() and strncat() more standard-compliant (check for invalid parameters even if zero bytes is copied, more accurate overlap check)
...
Fix the tests that were relying on the incorrect behavior.
llvm-svn: 161167
2012-08-02 10:25:46 +00:00
Alexey Samsonov
5062359502
cmake for compiler-rt: add a function to set output dirs for compiler runtimes equal to directory used by Clang driver. Use it for ASan runtime. Also, make sure that ASan unit tests depend on the ASan runtime.
...
llvm-svn: 160721
2012-07-25 11:15:00 +00:00
Kostya Serebryany
bb0ade6daa
[asan] don't return from a never-return function. fix a test that had a chain of bugs instead of just one
...
llvm-svn: 160719
2012-07-25 10:56:09 +00:00
Alexey Samsonov
96b9393f2d
[ASan] Support for cmake build of ASan unittests in 32-bit LLVM build. Currently, to run ASan unit tests both for 32- and 64 bits one has to maintain two distinct LLVM builds. In a bright future, we'd like to use a single build for this
...
llvm-svn: 160666
2012-07-24 08:26:19 +00:00
Alexander Potapenko
51e6488b31
Intercept CFAllocator for each thread in the program.
...
Test that child threads use the ASan allocator, that allocated memory can be passed to another thread and deallocated on it.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=81
llvm-svn: 160630
2012-07-23 14:07:58 +00:00
Alexey Samsonov
37d5134f38
[ASan] minor fixes to silence cmake build warnings
...
llvm-svn: 160624
2012-07-23 09:11:58 +00:00
Alexander Potapenko
7f3e84c9fd
For wild addresses in the shadow or shadow gap areas print an error message instead of crashing on a check.
...
Add AddressSanitizer.MemsetWildAddressTest that makes sure a proper error message is printed.
llvm-svn: 160620
2012-07-23 08:22:27 +00:00
Alexey Samsonov
c37ac17629
[ASan] cmake unit tests: explicitly add necessary linker flags when linking unit tests with asan runtime
...
llvm-svn: 159420
2012-06-29 11:29:39 +00:00
Alexey Samsonov
548b7b5b0e
[ASan] cmake-based unit tests: merge instrumented and non-instrumented files into one test binary
...
llvm-svn: 159419
2012-06-29 10:23:31 +00:00
Alexey Samsonov
6b03aa1bf7
[ASan] fix the build - erase second main as we link all test sources together
...
llvm-svn: 159348
2012-06-28 13:44:27 +00:00
Alexey Samsonov
3fe0d4d9aa
[ASan] silence various warnings in cmake build of asan unit tests
...
llvm-svn: 159347
2012-06-28 13:12:07 +00:00
Alexey Samsonov
b4edab5a6b
[ASan] cmake support for running asan unit tests on Mac
...
llvm-svn: 159345
2012-06-28 12:19:52 +00:00
Alexey Samsonov
ecf5436e9c
[ASan] update cmake rules so that ASan unit tests can include googletest (and, hence, llvm) headers when they are built by fresh Clang
...
llvm-svn: 159343
2012-06-28 09:32:19 +00:00
Chandler Carruth
9aaf156f30
Add support for building the ASan instrumentation unit tests with the
...
just-built Clang binary, and linking them against the just-built ASan
runtime.
This is *very* brittle. I expect it will require tweaking, and I've
pro-actively disabled it on non-Unix builds and on cross-builds.
It is also currently missing dependency edges on GoogleTest header files
and a few other corner cases, but those can be fixed. This is the major
milestone of a mini-bootstrap-like build of the unittest.
llvm-svn: 159255
2012-06-27 09:01:24 +00:00
Kostya Serebryany
c639b3943a
[asan] update the cmake file for asan
...
llvm-svn: 159143
2012-06-25 15:38:37 +00:00
Kostya Serebryany
9ed4f506bb
[asan] move tests from asan_interface_test.cc to asan_noinst_test.cc. Now all these tests do not require instrumentation and work directly with asan rt
...
llvm-svn: 159135
2012-06-25 14:23:07 +00:00
Chandler Carruth
9359efa986
Cleanup the handling of CFLAGS even more in the cmake build for ASan.
...
Add the initial support for building ASan tests.
The first change here is to try to get the CFLAGS to more closely match
those used by the old Makefile. There are probably still goofs here,
ASan folks, your review would be appreciated.
The second big change is to add support for building both
instrumentation based an non-instrumentation based unittests for ASan.
They are built a bit differently from how the old makefiles managed
things. Specifically, there are two binaries, one for the
non-instrumented case, and one for the instrumented case.
Also, the instrumented unit tests rely on the host compiler supporting
AddressSanitizer's intrumentation pass. This is kind-of gross, but
I don't know of a better way yet. I've mailed llvmdev to discuss this
issue.
One big caveat is that the detection logic currently doesn't work. I've
commented it out temporarily as I'd like to get feedback from the ASan
developers, etc.
llvm-svn: 159134
2012-06-25 12:57:43 +00:00
Alexander Potapenko
245f4ae59a
Small lint fix.
...
llvm-svn: 158922
2012-06-21 16:40:59 +00:00
Alexander Potapenko
70feed27ea
Add a test for issue 81 -- AddressSanitizerMac.DISABLED_CFAllocatorDefaultDoubleFree_ChildPhread
...
llvm-svn: 158921
2012-06-21 16:08:11 +00:00
Alexander Potapenko
15b4cafd2c
Enable AddressSanitizerMac.CFAllocatorDefaultDoubleFree and AddressSanitizerMac.CFAllocatorMallocDoubleFree, which now work fine.
...
llvm-svn: 158886
2012-06-21 01:04:30 +00:00
Alexander Potapenko
f9f2fbacb3
Actually intercept free() to ensure that the deallocations caused by other functions directly calling it are routed to our allocator.
...
For the allocations that do not belong to any malloc zone check whether they're padded with a pointer to ASan's CFAllocator. If so, free the original (unpadded) pointer.
This should fix AddressSanitizerMac.NSURLDeallocation and issue 70.
llvm-svn: 158863
2012-06-20 22:29:09 +00:00
Alexander Potapenko
50e788b724
Add a test for NSURL deallocation (issue 70)
...
llvm-svn: 158843
2012-06-20 20:28:39 +00:00
Alexey Samsonov
f26b842ca8
[ASan] add interceptor for strncat
...
llvm-svn: 158198
2012-06-08 13:27:46 +00:00
Alexey Samsonov
7fca5ccdae
[ASan] fix GetFreeBytesTest interface test on 32-bit Linux - delete some assumptions about the behavior of allocator in test code
...
llvm-svn: 158047
2012-06-06 06:02:05 +00:00
Alexey Samsonov
485d3dc363
Remove file-type tags for .cc files in ASan run-time library
...
llvm-svn: 157927
2012-06-04 13:50:10 +00:00
Kostya Serebryany
1d35d155fd
[asan] more renaming
...
llvm-svn: 157747
2012-05-31 15:02:07 +00:00
Kostya Serebryany
8d03204204
[asan] more renaming
...
llvm-svn: 157746
2012-05-31 14:35:53 +00:00
Kostya Serebryany
4fa4ac1290
[asan] fix one test on 32-bit Mac 10.7; enable another test on Mac
...
llvm-svn: 157237
2012-05-22 07:44:30 +00:00
Kostya Serebryany
c5bf3ad922
[asan] fix asan issue #66 (correctly report type of the bug)
...
llvm-svn: 155344
2012-04-23 10:08:16 +00:00
Kostya Serebryany
d45a71c2bc
[asan] test for issue #66
...
llvm-svn: 155127
2012-04-19 14:53:51 +00:00
Alexander Potapenko
bc42d44112
Change the way ASan interacts with custom signal handlers.
...
From now on we allow the clients to override signal handlers set by ASan, but print a warning in such a case.
Remove the tests for signal() and sigaction(), because they made little sense even without this change.
llvm-svn: 154390
2012-04-10 11:00:26 +00:00
Timur Iskhodzhanov
36a7cc6292
Use 'typename' instead of 'class' in template<> definitions supporting POD types
...
llvm-svn: 154314
2012-04-09 11:50:27 +00:00
Alexander Potapenko
4f1d3e8eaa
Make sure NSObjects are allocated in a way that is visible to ASan.
...
llvm-svn: 153762
2012-03-30 17:31:15 +00:00
Alexey Samsonov
b33c87bbb9
[ASan] interceptors for atoi/atol/atoll
...
llvm-svn: 153637
2012-03-29 08:04:35 +00:00
Kostya Serebryany
b0414e0eff
[asan] fix lint
...
llvm-svn: 153601
2012-03-28 21:03:34 +00:00
Kostya Serebryany
48c157c25a
[asan] add racy double-free test
...
llvm-svn: 153586
2012-03-28 18:30:10 +00:00
Alexey Samsonov
0a4f8dc0cb
[ASan] add interceptor for strtol
...
llvm-svn: 153444
2012-03-26 16:42:22 +00:00
Alexey Samsonov
c8efe828a9
[ASan] add interceptor for strtoll
...
llvm-svn: 153376
2012-03-24 08:39:14 +00:00
Timur Iskhodzhanov
99cc6235bc
[ASan/tests] Make 'noinline' and a bunch of other stuff portable
...
llvm-svn: 153333
2012-03-23 13:10:59 +00:00
Timur Iskhodzhanov
f392910965
[ASan] replace '#if ... or ...' with '#if ... || ...'
...
llvm-svn: 153332
2012-03-23 12:21:47 +00:00
Kostya Serebryany
3f56851f5c
[asan] extend the test for long double bug
...
llvm-svn: 153190
2012-03-21 15:29:28 +00:00
Kostya Serebryany
74a908bb85
[asan] disable GetOwnershipStressTest on non-linux
...
llvm-svn: 152953
2012-03-16 22:15:22 +00:00
Kostya Serebryany
b0f9354168
[asan] use O(log(N)) algorithm instead of O(N) in __asan_get_ownership
...
llvm-svn: 152467
2012-03-10 01:30:01 +00:00
Kostya Serebryany
8aff411add
[asan] add a (disabled) stress test for __asan_get_ownership
...
llvm-svn: 152362
2012-03-09 01:48:18 +00:00
Evgeniy Stepanov
f485c3ccbd
[asan] Add a negative test for memcpy of long double.
...
llvm-svn: 151888
2012-03-02 10:42:10 +00:00
Alexander Potapenko
7e07f56811
Introduce __asan_set_error_report_callback() to allow the client program post-process the error reports.
...
If the callback is set, Report() and Printf() print the reports into a buffer (together with stderr), which is then passed to the client.
llvm-svn: 151528
2012-02-27 14:06:48 +00:00
Evgeniy Stepanov
d84e16e6a3
Replace some #ifdef(s) with plain if(s).
...
llvm-svn: 151526
2012-02-27 13:07:29 +00:00
Alexey Samsonov
8e7bfceb98
AddressSanitizer: fix lint
...
llvm-svn: 150802
2012-02-17 08:31:10 +00:00
Evgeniy Stepanov
5d47e9164c
[asan] Allocator tweaks for low memory systems.
...
llvm-svn: 150689
2012-02-16 13:35:11 +00:00
Kostya Serebryany
fcd535ba6c
[asan] implement __asan_set_death_callback
...
llvm-svn: 150414
2012-02-13 21:24:29 +00:00
Evgeniy Stepanov
450c123218
[asan] Add a missing return.
...
It is technically reachable on Android, where pthread_exit is not
marked noreturn.
llvm-svn: 150381
2012-02-13 12:36:44 +00:00
Alexey Samsonov
b30df37ebf
AddressSanitizer: move output tests to a separate directory
...
llvm-svn: 150367
2012-02-13 08:50:21 +00:00
Alexey Samsonov
f9affd3a0c
AddressSanitizer: Use FileCheck instead of grep for pure C output tests
...
llvm-svn: 150366
2012-02-13 08:27:10 +00:00
Kostya Serebryany
0394da7bea
[asan] unpoison the stack before every noreturn call. Fixes asan issue 37. rt part
...
llvm-svn: 150101
2012-02-08 21:33:27 +00:00
Kostya Serebryany
9716914b2d
[asan] better warning messages for double-free bugs (provide allocation/deallocation stack traces)
...
llvm-svn: 150027
2012-02-08 00:42:29 +00:00
Kostya Serebryany
b5eb5a7a05
[asan] make sure the AsanThread object is destroyed if pthread_exit is called
...
llvm-svn: 149940
2012-02-07 00:27:15 +00:00
Alexander Potapenko
f504602a0f
Disables testing memcpy() on Mac OS 10.7,
...
where memcpy() in fact aliases memmove() and thus calling it with
overlapping parameters is not an error.
llvm-svn: 149491
2012-02-01 09:47:40 +00:00
Kostya Serebryany
ad1fccdb1c
[asan] tests should not require the asan-rt to be built with debug info
...
llvm-svn: 149330
2012-01-31 01:56:58 +00:00
Kostya Serebryany
bca91defcb
[asan] new run-time flag: sleep_before_dying (asan Issue #31 )
...
llvm-svn: 149306
2012-01-31 00:52:18 +00:00
Kostya Serebryany
9aca3b0d2f
[asan] re-enable the test for ObjC initialization bug
...
llvm-svn: 149302
2012-01-30 23:55:46 +00:00
Kostya Serebryany
39ba3f724f
[asan] fix issue 35: don't let the optimizer to optimize the test code away.
...
llvm-svn: 149296
2012-01-30 23:23:26 +00:00
Kostya Serebryany
cf2c65aa8e
[asan] add a test for __attribute__ no_address_safety_analysis
...
llvm-svn: 149278
2012-01-30 21:34:59 +00:00
Alexander Potapenko
fabfcd8bea
Darwin-specific templates for the output tests.
...
These should fix the output tests on Mac.
llvm-svn: 149068
2012-01-26 17:40:18 +00:00
Alexander Potapenko
1f397fb87f
Tune asan_symbolize.py to symbolize 64-bit binaries correctly.
...
Add the DEBUG flag to test_output.sh
llvm-svn: 148798
2012-01-24 10:44:44 +00:00
Kostya Serebryany
f9418f9679
[asan] test that -fno-optimize-sibling-calls helps to get sane stack traces
...
llvm-svn: 148714
2012-01-23 18:44:34 +00:00
Alexander Potapenko
046ecc06be
Wrap CFStringCreateCopy to prevent copying constant CF strings.
...
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=10
llvm-svn: 148696
2012-01-23 10:09:54 +00:00
Alexander Potapenko
f9392011c8
Add a test for CFStringCreateCopy.
...
Normally this function should not create copies of constant strings, but it does when the default CFAllocator
is replaced (e.g. under AddressSanitizer)
This test is related to http://code.google.com/p/address-sanitizer/issues/detail?id=10
llvm-svn: 148695
2012-01-23 10:06:14 +00:00
Alexey Samsonov
0ac73fc9f8
AddressSanitizer: return false instead of true for __asan_get_ownership(NULL)
...
llvm-svn: 148394
2012-01-18 15:26:55 +00:00
Kostya Serebryany
5767f0f113
[asan] workaround for bug http://llvm.org/bugs/show_bug.cgi?id=11763 . Do not bark on memcpy(a, a, size).
...
llvm-svn: 148318
2012-01-17 18:43:52 +00:00
Alexey Samsonov
67d508d083
Revert commit 148304
...
llvm-svn: 148305
2012-01-17 14:01:15 +00:00
Alexey Samsonov
1e310295d0
AddressSanitizer: from this patch, ASan allocator returns false for __asan_get_ownership(NULL) and produce error reports for malloc_usable_size(NULL) and __asan_get_allocated_size(NULL)
...
llvm-svn: 148304
2012-01-17 13:31:54 +00:00
Alexey Samsonov
209c514a1d
AddressSanitizer: add support for malloc_usable_size() function
...
llvm-svn: 148287
2012-01-17 06:39:10 +00:00
Alexey Samsonov
50bf956f29
AddressSanitizer: fix recently introduced lint errors and broken test on Mac.
...
llvm-svn: 148235
2012-01-16 12:38:09 +00:00
Evgeniy Stepanov
2227207c83
Disable posix_memalign test on Android.
...
llvm-svn: 148234
2012-01-16 12:19:51 +00:00
Kostya Serebryany
cc1d7893d6
[asan] remove objdump-based tests in favour of much simpler LLVM-ish tests
...
llvm-svn: 147514
2012-01-04 02:08:46 +00:00
Kostya Serebryany
76eca5e53a
[asan] enable memset/memcpy/memmove interceptors in asan-rt (in addition to those in the compiler module)
...
llvm-svn: 147319
2011-12-28 19:55:30 +00:00
Kostya Serebryany
e4a84c4f1f
[asan] better message for parameter overlap bugs
...
llvm-svn: 147317
2011-12-28 19:24:31 +00:00
Kostya Serebryany
50bc2a71b2
[asan] interceptor for strcat. Patch by samsonov@google.com
...
llvm-svn: 147316
2011-12-28 19:08:49 +00:00
Kostya Serebryany
6579e355c0
[asan] interceptor for memcmp. Patch by samsonov@google.com
...
llvm-svn: 147315
2011-12-28 18:56:42 +00:00
Kostya Serebryany
809632e28e
[asan] interceptors for strcasecmp and strncasecmp. patch by samsonov@google.com
...
llvm-svn: 147304
2011-12-28 02:24:50 +00:00
Kostya Serebryany
5469986da0
[asan] remove the test for cfree. 'man cfree' says: 'This function should never be used.' and this function is not found on many OSes we support.
...
llvm-svn: 147301
2011-12-27 23:42:55 +00:00
Kostya Serebryany
db32f967b9
[asan] rely on __has_feature(address_sanitizer) instead of the ADDRESS_SANITIZER macro
...
llvm-svn: 147297
2011-12-27 21:57:12 +00:00
Kostya Serebryany
1b82c281f3
[asan] make sure frame pointers are not omitted when running asan output tests
...
llvm-svn: 147293
2011-12-27 19:52:54 +00:00
Kostya Serebryany
7ce9686921
[asan] added a test to check that a global-buffer-overflow mentioned the module name; revert incorrect change in the test runner
...
llvm-svn: 146701
2011-12-15 22:57:32 +00:00
Kostya Serebryany
9366d42e91
[asan] fix a bug (issue 19) where dlclose and the following mmap caused a false positive. run-time part.
...
llvm-svn: 146687
2011-12-15 21:55:34 +00:00
Kostya Serebryany
e8a7d2aef8
[asan] regression test for asan issue 19, currently fails.
...
llvm-svn: 146681
2011-12-15 20:38:14 +00:00
Kostya Serebryany
e85da73553
[asan] fix the test runner to detect build breakages; add a test for -pie
...
llvm-svn: 146528
2011-12-14 00:05:22 +00:00
Kostya Serebryany
d47a91ad2a
[asan] canonicalise the output for double-free and wrong-free. fixes asan issue 18
...
llvm-svn: 146501
2011-12-13 19:16:36 +00:00
Kostya Serebryany
7487a0ae1f
[asan] fix output test to not require debug symbols in asan run-time
...
llvm-svn: 146212
2011-12-09 00:18:21 +00:00
Kostya Serebryany
7c01c1af19
[asan] better test for use-after-return mode
...
llvm-svn: 146203
2011-12-08 23:30:48 +00:00
Kostya Serebryany
f0d799a6bc
[asan] fix the error message for 16-byte accesses (it previously printed 'unknown-crash')
...
llvm-svn: 146075
2011-12-07 21:30:20 +00:00
Kostya Serebryany
8b815e1a08
[asan] GCD tests on Mac: prevent optimization and enable. Patch by glider@google.com
...
llvm-svn: 145953
2011-12-06 19:10:48 +00:00
Kostya Serebryany
ab7940f6e1
[asan]: test a pure C file with -faddress-sanitizer; lint fixes
...
llvm-svn: 145848
2011-12-05 20:44:30 +00:00
Kostya Serebryany
0e069e2aa9
[asan] add the test for bug 11468
...
llvm-svn: 145839
2011-12-05 19:20:57 +00:00
Kostya Serebryany
49a182fa12
[asan] always collect malloc statstics (removed FLAG_stats)
...
llvm-svn: 145838
2011-12-05 19:17:53 +00:00
Kostya Serebryany
26c5df4733
[asan] micro-benchmark for use-after-return fake stack
...
llvm-svn: 145739
2011-12-03 01:44:48 +00:00
Kostya Serebryany
f318e29102
test asan at -O0
...
llvm-svn: 145532
2011-11-30 22:27:30 +00:00
Kostya Serebryany
019b76f5fd
AddressSanitizer run-time library. Not yet integrated with the compiler-rt build system, but can be built using the old makefile. See details in README.txt
...
llvm-svn: 145463
2011-11-30 01:07:02 +00:00