Alexey Samsonov
a7f35c06dc
[ASan] Enable fake stack test on Mac and Android, as no-instrumentation tests are now fixed
...
llvm-svn: 190856
2013-09-17 08:40:32 +00:00
Alexey Samsonov
676c109c24
[ASan] Link tests with -pie if ASan runtime uses zero-base shadow
...
llvm-svn: 190853
2013-09-17 07:50:12 +00:00
Kostya Serebryany
2f5c2be6bd
[asan] further speedup use-after-return: simplify deallocation of fake frames. ~ 20% speedup.
...
llvm-svn: 190852
2013-09-17 07:42:54 +00:00
Alexey Samsonov
f71c88910c
[ASan] Don't link with pthread on Android
...
llvm-svn: 190794
2013-09-16 16:51:49 +00:00
Alexey Samsonov
036a5bef2d
[ASan] Split ASan unit tests into two different binaries:
...
(1) instrumented, i.e. compiled and linked with -fsanitize=address
(2) not instrumented, compiled w/o -fsanitize=address and linked with ASan runtime statically.
llvm-svn: 190788
2013-09-16 15:50:53 +00:00
Alexey Samsonov
70c93d3b1c
[ASan] Temporary disable UAR unit test on Android due to https://code.google.com/p/address-sanitizer/issues/detail?id=222
...
llvm-svn: 190667
2013-09-13 08:07:21 +00:00
Kostya Serebryany
9583b87077
[asan] don't record the class_id in FakeFrame (scratching the last bits of performance)
...
llvm-svn: 190666
2013-09-13 07:50:44 +00:00
Kostya Serebryany
7638aa135e
[asan] a bit of performance improvement in fake stack, generalized one test, fixed android build of another test
...
llvm-svn: 190606
2013-09-12 14:41:10 +00:00
Alexander Potapenko
9caa10d0c7
[ASan] Do not build asan_fake_stack_test.cc on OSX until https://code.google.com/p/address-sanitizer/issues/detail?id=222 is fixed.
...
llvm-svn: 190597
2013-09-12 09:46:56 +00:00
Kostya Serebryany
729c8dc65b
[asan] fully re-implement the FakeStack (use-after-return) to make it faster and async-signal-safe. The implementation is not yet complete (see FIXMEs) but the existing tests pass.
...
llvm-svn: 190588
2013-09-12 07:11:58 +00:00
Kostya Serebryany
8fc35ca008
[asan] refactor the use-after-return API so that the size class is computed at compile time instead of at run-time. compiler-rt part
...
llvm-svn: 190406
2013-09-10 13:16:26 +00:00
Alexey Samsonov
071cc9e89d
[ASan] turn on leak checking for ASan tests and fix a few discovered leaks
...
llvm-svn: 190274
2013-09-08 13:23:29 +00:00
Alexey Samsonov
6985f3f67b
Fix compiler warning introduced in r190022
...
llvm-svn: 190137
2013-09-06 11:08:12 +00:00
Alexey Samsonov
16516b9b00
Migrate ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS to new spelling - ATTRIBUTE_NO_SANITIZE_ADDRESS
...
llvm-svn: 190136
2013-09-06 11:07:33 +00:00
Kostya Serebryany
e009ef4ac1
[asan] make calloc crash instead of returning 0 on overflow (controlled by the allocator_may_return_null flag)
...
llvm-svn: 190128
2013-09-06 09:51:50 +00:00
Kostya Serebryany
ada5a7b7ef
[sanitizer] make the allocator crash instead of returning 0 on huge size (controlled by the allocator_may_return_null flag)
...
llvm-svn: 190127
2013-09-06 09:25:11 +00:00
Reid Kleckner
0071525492
asan: Add a wcslen interceptor mirroring strlen
...
Tested on Linux, since I can't build the tests on Windows yet.
llvm-svn: 190022
2013-09-05 01:13:49 +00:00
Kostya Serebryany
fab9336413
[asan]: fix a CHECK failure in use-after-return mode; enable and fix stack-use-after-return.cc; add a test for UAR mode in asan_noinst_test
...
llvm-svn: 189457
2013-08-28 08:59:23 +00:00
Alexey Samsonov
79d79da0e1
[ASan] Fix leaks in ASan tests found by LSan
...
llvm-svn: 186577
2013-07-18 12:59:52 +00:00
Kostya Serebryany
e71982d589
[asan] fix the bug with memalign and malloc_usable_size ( http://code.google.com/p/address-sanitizer/issues/detail?id=193 ); also fix lint
...
llvm-svn: 183647
2013-06-10 10:46:27 +00:00
Alexey Samsonov
e674320ade
[ASan] make pthread_getschedparam test more robust
...
llvm-svn: 183411
2013-06-06 14:08:40 +00:00
Alexey Samsonov
8f5138a23f
Call __asan_free_hook() before marking the chunk quarantinned
...
Summary:
With this change, the user may safely call __asan_get_ownership()
from malloc/free hooks and assume it would return "true". If there is a
realloc/free race, free hook might be called twice, but I think it's acceptable,
as it's a data race and would later be reported anyway.
This change also fixes a bug when failing realloc incorrectly marked the
original memory as "quarantinned".
Reviewers: timurrrr, kcc, samsonov
Reviewed By: samsonov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D913
llvm-svn: 183220
2013-06-04 12:19:31 +00:00
Kostya Serebryany
8410a867eb
[asan] workaround for asan bug 189 (swapcontext followed by throw gets OOM kill). Also, disable swapcontext_test on non-x86. Fix lint
...
llvm-svn: 182456
2013-05-22 08:54:30 +00:00
Evgeniy Stepanov
970be35808
[sanitizer] Intercept pthread_getschedparam.
...
llvm-svn: 182353
2013-05-21 08:12:08 +00:00
Timur Iskhodzhanov
67c918a424
Fix realloc'ing freed/invalid pointers
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=187 for the details
llvm-svn: 182255
2013-05-20 13:05:58 +00:00
Kostya Serebryany
b7ca536888
[asan] fix ShadowGapTest on PowerPC64
...
llvm-svn: 181991
2013-05-16 07:54:28 +00:00
Kostya Serebryany
2b824f3575
[asan] disable BuiltinLongJmpTest on PowerPC
...
llvm-svn: 181890
2013-05-15 15:01:14 +00:00
Kostya Serebryany
2b42716213
[asan] fix powerpc build and one test; fix lint
...
llvm-svn: 181881
2013-05-15 12:36:29 +00:00
Sergey Matveev
ffe38d267c
Quick fix for ASan test build on Android.
...
llvm-svn: 181429
2013-05-08 14:11:12 +00:00
Alexander Potapenko
15aa1cd1ac
[ASan] Disable AddressSanitizer.AllocDeallocMismatch on Darwin.
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=131 .
llvm-svn: 180093
2013-04-23 12:14:55 +00:00
Kostya Serebryany
eef8bd4355
[asan] nuke the old unused allocator code
...
llvm-svn: 178758
2013-04-04 11:32:49 +00:00
Kostya Serebryany
667a34a120
[asan] Change the way we report the alloca frame on stack-buff-overflow.
...
Before: the function name was stored by the compiler as a constant string
and the run-time was printing it.
Now: the PC is stored instead and the run-time prints the full symbolized frame.
This adds a couple of instructions into every function with non-empty stack frame,
but also reduces the binary size because we store less strings (I saw 2% size reduction).
This change bumps the asan ABI version to v3.
compiler-rt part, llvm part will follow.
Example of report (now):
==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8
READ of size 1 at 0x7fffa77cf1c5 thread T0
#0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20
#1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24
#2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28
#3 0x41f194 in Frame3(int) stack-oob-frames.cc:32
#4 0x41eee0 in main stack-oob-frames.cc:38
#5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
#6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c)
Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame
#0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12 <<<<<<<<<<<<<< this is new
This frame has 6 object(s):
[32, 36) 'frame.addr'
[96, 104) 'a.addr'
[160, 168) 'b.addr'
[224, 232) 'c.addr'
[288, 292) 's'
[352, 360) 'd'
llvm-svn: 177723
2013-03-22 10:36:24 +00:00
Alexey Samsonov
a5eb3cb721
[ASan] Fix an error on invalid deallocation in ASan allocator. When ASan checks if memory freed by user was indeed previously allocated, it first does an atomic write to presumed location of chunk header. This is wrong, as if the free is invalid, we may overwrite some valuable data (like other fields of the chunk header). Fix this by using atomic_compare_exchange instead.
...
llvm-svn: 177710
2013-03-22 07:40:34 +00:00
Kostya Serebryany
9138f75d0a
[asan] make the __asan_get_heap_size more robust
...
llvm-svn: 177270
2013-03-18 10:52:25 +00:00
Evgeniy Stepanov
6488b2b257
[asan] Switch to allocator2 on Android.
...
llvm-svn: 177263
2013-03-18 09:22:58 +00:00
Kostya Serebryany
d332d42372
[asan] remove one redundant malloc stress test, unify the usage of ASAN_LOW_MEMORY macro in tests, slightly reduce test memory usage (all to make 32-bit runs consume less RAM)
...
llvm-svn: 177069
2013-03-14 13:16:09 +00:00
Evgeniy Stepanov
f5d8c90f57
[asan] Revert r176255, r176264.
...
New allocator has 1.5x memory overhead of the old one.
llvm-svn: 176340
2013-03-01 09:33:05 +00:00
Evgeniy Stepanov
3305b177e6
[asan] Lower memory usage in LargeMallocTest on Android.
...
llvm-svn: 176264
2013-02-28 15:54:58 +00:00
Kostya Serebryany
8ee2a5adc7
[asan] if calloc returns a freshly-mmaped memory, don't clear it with memset. Speeds up calloc-intensive code
...
llvm-svn: 176185
2013-02-27 13:38:19 +00:00
Kostya Serebryany
8caf654731
[asan] fix the output for range accesses (memset, etc); improve the tests; more strict checking in memcmp
...
llvm-svn: 176078
2013-02-26 07:25:18 +00:00
Kostya Serebryany
ab5be26af5
[asan] speedup by more than 2x handling of the small memset/memcpy/etc calls
...
llvm-svn: 175728
2013-02-21 07:07:39 +00:00
Alexey Samsonov
7dc2b2f07d
[ASan] revert part of r175631 that looks like accidental commit
...
llvm-svn: 175655
2013-02-20 19:55:47 +00:00
Alexander Potapenko
70b01558f1
[ASan] Delete asan/dynamic dir and temporarily move the interposers declarations to asan_intercepted_functions.h
...
Now that we have only one dependency on asan_intercepted_functions.h, we can unite that code with the interceptors declarations in asan_interceptors.cc and get rid of asan_intercepted_functions.h
llvm-svn: 175631
2013-02-20 15:46:02 +00:00
Kostya Serebryany
96401c9da9
[asan] don't run the long double test if long double is the same as double
...
llvm-svn: 175514
2013-02-19 13:43:44 +00:00
Kostya Serebryany
9f298da9bd
[asan] instrument memory accesses with unusual sizes
...
This patch makes asan instrument memory accesses with unusual sizes (e.g. 5 bytes or 10 bytes), e.g. long double or
packed structures.
Instrumentation is done with two 1-byte checks
(first and last bytes) and if the error is found
__asan_report_load_n(addr, real_size) or
__asan_report_store_n(addr, real_size)
is called.
asan-rt part
Also fix lint.
llvm-svn: 175508
2013-02-19 11:30:25 +00:00
Kostya Serebryany
dd0ab08b6e
[asan] use short path for sanitizer_common/tests/sanitizer_test_utils.h, add -I sanitizer_common/tests to asan/tests/CMakeLists.txt
...
llvm-svn: 175142
2013-02-14 08:12:26 +00:00
Alexander Potapenko
dc91edad59
[ASan] Enable alloc_dealloc_mismatch by default on Darwin.
...
Enable AddressSanitizer.AllocDeallocMismatch tests.
llvm-svn: 174628
2013-02-07 15:55:21 +00:00
Alexey Samsonov
2e50809961
[ASan] remove debug output from the test
...
llvm-svn: 174188
2013-02-01 16:06:25 +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
Alexey Samsonov
322d7fbd9d
ASan: fix lint
...
llvm-svn: 173795
2013-01-29 12:08:12 +00:00