Alexey Samsonov
aac36b345a
[ASan] intercept swapcontext on Linux only
...
llvm-svn: 168509
2012-11-23 10:14:44 +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
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
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
4a78e1002d
Add MACOS_VERSION_MOUNTAIN_LION.
...
llvm-svn: 166026
2012-10-16 16:24:49 +00:00
Alexey Samsonov
4787d0fbef
[ASan] more macro/casting magic to suppress warnings
...
llvm-svn: 163706
2012-09-12 14:10:14 +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
ee92877f17
[asan] more refactoring to move StackTrace to sanitizer_common
...
llvm-svn: 162752
2012-08-28 13:25:55 +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
Alexander Potapenko
fefc1e989c
If the program is linked to a dynamic ASan runtime which is not present in DYLD_INSERT_LIBRARIES
...
(which, in turn, is required for our interceptors to take effect), re-exec the program with
DYLD_INSERT_LIBRARIES set.
llvm-svn: 162547
2012-08-24 09:22:05 +00:00
Alexander Potapenko
2ebe619340
Re-implement the wrappers for libdispatch functions using blocks where appropriate
...
(kudos to Anna Zaks for a good example).
This simplifies the code much and lets us not implement internal parts of libdispatch.
All ASan tests from t32 and t64 should pass with the dylib runtime now.
llvm-svn: 162439
2012-08-23 09:34:40 +00:00
Kostya Serebryany
6b745b5281
[asan] fix lint
...
llvm-svn: 162258
2012-08-21 06:43:44 +00:00
Alexander Potapenko
02e6f03236
Dynamic interceptors for dispatch_async and dispatch_after.
...
llvm-svn: 162202
2012-08-20 11:59:26 +00:00
Alexander Potapenko
1233d558dc
Minor refactoring: reduce code duplication by introducing a macro for dispatch_sync_f, dispatch_async_f, dispatch_barrier_async_f bodies.
...
llvm-svn: 162199
2012-08-20 09:25:10 +00:00
Alexander Potapenko
20f9fcc285
Move the prototype of __CFInitialize to asan_mac.h so that asan_malloc_mac.cc may use it in the dynamic library mode.
...
llvm-svn: 161945
2012-08-15 12:23:36 +00:00
Alexey Samsonov
36d2dff143
[ASan] fix cmake build warning
...
llvm-svn: 160957
2012-07-30 10:18:31 +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
34efb8e9b9
[ASan] Use common flags parsing machinery.
...
llvm-svn: 159933
2012-07-09 14:36:04 +00:00
Alexander Potapenko
89f9270366
A portable way to check whether __CFInitialize has been called: compare kCFAllocatorSystemDefault._base._cfisa to 0.
...
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 on both Lion and Snow Leopard.
llvm-svn: 159821
2012-07-06 13:04:12 +00:00
Alexander Potapenko
d2ff0b087a
Do not check for __CFRuntimeClassTableSize on non-10.6 systems, where this symbol is private.
...
This change may cause http://code.google.com/p/address-sanitizer/issues/detail?id=87 to re-appear on Lion.
llvm-svn: 159819
2012-07-06 11:58:54 +00:00
Alexander Potapenko
25b567dd0d
Fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 by making sure we replace the default CFAllocator only after __CFInitialize has been called.
...
llvm-svn: 159749
2012-07-05 14:46:56 +00:00
Alexey Samsonov
70386aaffa
[ASan] cleanup: trailing semicolons, trailing colons in enums
...
llvm-svn: 159338
2012-06-28 08:27:24 +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
Alexey Samsonov
c70d1086f6
[Sanitizer] move rest of mmap routines to common sanitizer runtime
...
llvm-svn: 158452
2012-06-14 14:42:58 +00:00
Alexey Samsonov
0c53a38abb
[Sanitizer] move portable GetEnv to common sanitizer runtime
...
llvm-svn: 158451
2012-06-14 14:07:21 +00:00
Alexey Samsonov
52f946611f
[ASan] don't include deleted header
...
llvm-svn: 158448
2012-06-14 13:15:45 +00:00
Alexey Samsonov
4b1f1031e6
[Sanitizer] factor out GetThreadStackTopAndBottom from ASan runtime to common.
...
llvm-svn: 158140
2012-06-07 07:13:46 +00:00
Alexey Samsonov
28a9895ee0
[Sanitizer] __asan::AsanProcMaps -> __sanitizer::ProcessMaps.
...
llvm-svn: 158139
2012-06-07 06:15:12 +00:00
Alexey Samsonov
40d5b772e5
[Sanitizer] Switch to common mmap/munmap routines in ASan run-time.
...
llvm-svn: 158078
2012-06-06 16:15:07 +00:00
Kostya Serebryany
79437fe376
[asan] make tid u32 instead of int
...
llvm-svn: 158074
2012-06-06 15:06:58 +00:00
Alexey Samsonov
d44cb4cb8a
[ASan] match type of arguments to format string on Mac.
...
llvm-svn: 158068
2012-06-06 13:44:19 +00:00
Alexey Samsonov
c4b201308b
[ASan] Use __sanitizer::Die() in ASan runtime.
...
llvm-svn: 158051
2012-06-06 07:02:44 +00:00
Alexey Samsonov
8602c65719
[Sanitizer] remove using namespace __sanitizer lines
...
llvm-svn: 157999
2012-06-05 14:05:09 +00:00
Alexey Samsonov
7ac77d6b29
[Sanitizer] add sanitizer_posix.cc. Move more various functions into sanitizer_libc: sscanf, munmap, memchr
...
llvm-svn: 157994
2012-06-05 09:49:25 +00:00
Alexey Samsonov
9354688dc5
[ASan] s/size_t/uptr in asan_mac.cc
...
llvm-svn: 157993
2012-06-05 09:13:33 +00:00
Alexey Samsonov
1b12eda7ec
[ASan] use internal_{close,read,write} in ASan runtime.
...
llvm-svn: 157991
2012-06-05 08:48:10 +00:00
Alexey Samsonov
f5e2dc3c3d
[ASan] use internal_open from sanitizer_libc in ASan runtime
...
llvm-svn: 157986
2012-06-05 07:25:47 +00:00
Alexey Samsonov
2c5fc3bb11
Created files sanitizer_linux.cc and sanitizer_mac.cc for platform-specific implementations of common functions. Turned asan_mmap into __sanitizer::internal_mmap.
...
llvm-svn: 157930
2012-06-04 14:27:50 +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
Evgeniy Stepanov
8152e22073
Move AsanShadowRangeIsAvailable() from mac to posix.
...
llvm-svn: 157326
2012-05-23 15:21:50 +00:00
Alexey Samsonov
7ec936a4f4
[ASan] remove dispatch.h header once again - it's not present on Leopard, and we don't want to break the build of compiler-rt there. See https://trac.macports.org/ticket/33362
...
llvm-svn: 154326
2012-04-09 16:45:18 +00:00
Alexander Potapenko
c6eb6a8287
Add internal_memset and replace the uses of REAL(memset) with it where the performance allows.
...
llvm-svn: 153641
2012-03-29 12:20:47 +00:00
Alexey Samsonov
8ada45553d
[asan]: substitute extern decls with system header in asan_mac.cc
...
llvm-svn: 153182
2012-03-21 13:00:04 +00:00
Alexey Samsonov
9ce04b0c36
[asan] merge mac-specific interceptors into one function
...
llvm-svn: 153180
2012-03-21 12:42:00 +00:00
Alexey Samsonov
5f7048b396
[asan]: remove asan_mac.h
...
llvm-svn: 153179
2012-03-21 12:29:54 +00:00
Alexey Samsonov
1d4145380e
[asan]: start removing os-specific asan_mac.h - move inclusion of mac system header to asan_mac.cc
...
llvm-svn: 153178
2012-03-21 12:03:44 +00:00
Alexey Samsonov
c298b3674f
[ASan]: remove GetMacosVersion from asan_mac.h header
...
llvm-svn: 153084
2012-03-20 10:54:40 +00:00
Kostya Serebryany
e059c124a8
[asan] one more -Wnull-conversion fix
...
llvm-svn: 152773
2012-03-15 04:26:00 +00:00
Alexey Samsonov
278c25f241
AddressSanitizer: simplify IntervalsAreSeparate function
...
llvm-svn: 150569
2012-02-15 08:27:34 +00:00