Alexey Samsonov
2dcef2d2a8
AddressSanitizer: Enforce default visibility for all libc interceptors
...
llvm-svn: 149247
2012-01-30 13:42:44 +00:00
Alexander Potapenko
81ebb0aafb
Add a mask for "cmpb $imm, (%rdi)" on x86_64
...
llvm-svn: 149245
2012-01-30 12:49:00 +00:00
Anton Korobeynikov
28037ceacf
Proper divmod implementation
...
llvm-svn: 149242
2012-01-30 10:21:51 +00:00
Anton Korobeynikov
b047b04c4c
Provide aeabi_mem* functions.
...
llvm-svn: 149241
2012-01-30 10:21:23 +00:00
Alexander Potapenko
f519564d7c
Make compiler-rt/trunk/lib/asan compileable with Visual Studio 2008 on Windows.
...
Patch by Timur Iskhodzhanov (timurrrr@google.com )
To test:
$ cl /c *.c*
in the asan directory.
The code fails to link if you omit the "/c" part but that's one of the
next steps,
as well as a few TODO's I've put into the Windows-specific code.
llvm-svn: 149130
2012-01-27 15:15:04 +00:00
Alexander Potapenko
13d95d5e5a
Make compiler-rt/trunk/lib/asan compileable with g++.
...
Patch by Timur Iskhodzhanov (timurrrr@google.com )
The double-extern thing is
http://llvm.org/bugs/show_bug.cgi?id=11869
And the #include <string[s].h> are only needed on Mac (see comments in
the original code)
and also including them might make strchr/index conflict with the g++
system headers (which don't follow the man pages, ouch!)
llvm-svn: 149129
2012-01-27 10:52:37 +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
02a71626e3
More accurate atos execution which depends on the file type (EXECUTE, DYLIB) of the binary.
...
More Linux-like output on Mac (to match more output tests).
llvm-svn: 149064
2012-01-26 17:06:50 +00:00
Alexander Potapenko
98f0c713d9
Fix a bug in AsanProcMaps on Mac: on 64 bits the program was trying to read twice as many segment load commands as the binary actually contained.
...
llvm-svn: 149063
2012-01-26 17:01:20 +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
586ade114b
[asan] use internal_strcmp before asan_init is done. *may* fix asan issue #30
...
llvm-svn: 148726
2012-01-23 21:20:05 +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
Evgeniy Stepanov
3f6840745c
Make the Android TSD workaround more reliable.
...
By scanning the thread list backwards.
llvm-svn: 148476
2012-01-19 13:57:45 +00:00
Evgeniy Stepanov
d296ad4e16
Workaround the self-cleaning TSD on Android.
...
llvm-svn: 148475
2012-01-19 13:37:31 +00:00
Alexander Potapenko
62b0d70e56
Remove a debugging Report() call.
...
llvm-svn: 148474
2012-01-19 13:34:15 +00:00
Alexander Potapenko
3825e9770b
Minor fixes of the AsanProcMaps code on Mac:
...
-- make the load command scan linear (instead of quadratic)
-- do not create a nested AsanProcMaps instance for each address lookup
-- more comments
llvm-svn: 148472
2012-01-19 12:44:06 +00:00
Evgeniy Stepanov
84c44a8b8b
EHABI-based stack trace on ARM.
...
The change removes the unused FLAG_fast_unwind, and forces EHABI-based unwind
on ARM, and fast (FP-based) unwind everywhere else.
llvm-svn: 148468
2012-01-19 11:34:18 +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
Alexander Potapenko
38da9a04f5
Delete sysinfo/* and all references to it.
...
llvm-svn: 148386
2012-01-18 11:42:30 +00:00
Alexander Potapenko
4257386879
Implement AsanProcMaps for Mac OS. The code from sysinfo/ is not needed anymore and should be cleaned up.
...
llvm-svn: 148385
2012-01-18 11:16:05 +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
Kostya Serebryany
86d4492627
[asan] fix ReadFileToBuffer to correctly handle files from /proc/ (asan issue 27)
...
llvm-svn: 148311
2012-01-17 18:00:07 +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
Alexander Potapenko
2b2e0721d7
Define the bounds of the branch allocator memory space for 32-bit apps.
...
llvm-svn: 148303
2012-01-17 09:38: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
2d3a67b73b
AddressSanitizer: create AsanThreadSummary together with AsanThread (in parent thread)
...
llvm-svn: 148286
2012-01-17 06:35:31 +00:00
Evgeniy Stepanov
1b65b17bf5
[asan] Implement GetObjectNameAndOffset on ARM.
...
llvm-svn: 148236
2012-01-16 12:45:07 +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
Alexander Potapenko
bd53f597de
This patch adds two methods, __asan_allocate_island and __asan_deallocate_island
...
and switches our interceptors to using them instead of the default
vm_allocate-based approach used by mach_override_ptr.
To simplify the code, a fixed memory mapping is used for the allocation pool --
note that we can't mmap an arbitrary chunk of memory, because the shadow memory hasn't been mapped yet
(for the reasons discussed in http://code.google.com/p/address-sanitizer/issues/detail?id=24 , we cannot map the shadow earlier)
The patch drops the program startup time from several second to half a second,
which speeds up the execution of ASan tests noticeably.
Because of the virtual memory size occupied by the programs it's hard
to speed up the shutdown time, which would've also helped the tests.
llvm-svn: 148116
2012-01-13 16:13:58 +00:00
Alexander Potapenko
9301db4baa
Add __asan_mach_override_ptr_custom, which allows to inject a custom memory allocator into mach_override_ptr().
...
llvm-svn: 148115
2012-01-13 15:31:37 +00:00
Alexander Potapenko
553c208d22
This patch moves the code reading /proc/self/environ into AsanGetEnv
...
in asan_linux.cc, because /proc is unavailable on Mac.
Instead the Mac version of AsanGetEnv iterates over the array of
environment variables obtained from _NSGetEnviron()
llvm-svn: 148114
2012-01-13 12:59:48 +00:00
Anton Korobeynikov
48cfd55c5d
Add some basic mingw support.
...
Patch by Ruben Van Boxem!
llvm-svn: 148048
2012-01-12 21:13:48 +00:00
Evgeniy Stepanov
837fe5bcc9
Call asan_init from .preinit_array.
...
Protected by an #ifdef, disabled by default.
llvm-svn: 147932
2012-01-11 08:17:19 +00:00
Alexey Samsonov
5d5fa5115a
Test commit. Minor cleanup in AsanThread
...
llvm-svn: 147930
2012-01-11 08:07:51 +00:00
Kostya Serebryany
41cdb8614c
[asan] remove OS-dependent headers from asan_internal.h
...
llvm-svn: 147919
2012-01-11 02:39:16 +00:00
Kostya Serebryany
0c8fa7b8ed
[asan] remove OS-dependent includes from asan_interceptors.h
...
llvm-svn: 147916
2012-01-11 02:32:40 +00:00
Kostya Serebryany
1dd51b53b2
[asan] move TSD code into asan_posix.cc
...
llvm-svn: 147913
2012-01-11 02:21:06 +00:00
Kostya Serebryany
332923be32
[asan] get rid of the scary TSD destructor code. Now, we store the leaky AsanThreadSummary in TSD and never remove it from there.
...
llvm-svn: 147910
2012-01-11 02:03:16 +00:00
Kostya Serebryany
258d7b4182
[asan] hopefully fix the build on MacOS 10.6 (the code did work on 10.7, where I tested it)
...
llvm-svn: 147896
2012-01-10 23:36:59 +00:00
Kostya Serebryany
a82f0d4950
[asan] move OS-dependent code away from asan_lock.h
...
llvm-svn: 147878
2012-01-10 21:24:40 +00:00
Kostya Serebryany
edb4a8a128
[asan] don't include unistd.h in the headers
...
llvm-svn: 147811
2012-01-09 23:11:26 +00:00
Kostya Serebryany
3a55cfacf1
[asan] temporary reinstate string.h/strings.h. Removal of those caused a Mac build failulre which I failed to observe before the commit
...
llvm-svn: 147810
2012-01-09 22:45:05 +00:00
Kostya Serebryany
d9cb2f13b3
[asan] don't include string.h and strings.h
...
llvm-svn: 147809
2012-01-09 22:36:51 +00:00
Kostya Serebryany
65518014e2
[asan] don't use strstr/strncat from libc, use our own versions instead
...
llvm-svn: 147807
2012-01-09 22:20:49 +00:00
Kostya Serebryany
3ab81d1f26
[asan] fix mac build once more
...
llvm-svn: 147796
2012-01-09 19:50:06 +00:00
Kostya Serebryany
3e559e87a4
[asan]: fix typo from previous commit
...
llvm-svn: 147793
2012-01-09 19:41:15 +00:00