Dmitry Vyukov
6f4b34bcf4
asan/tsan: move strcasecmp() interceptor to sanitizer_common
...
llvm-svn: 178010
2013-03-26 12:40:23 +00:00
Alexey Samsonov
f1311dfce1
[ASan] fix-up for r177634 on Windows.
...
llvm-svn: 177711
2013-03-22 07:48:23 +00:00
Alexey Samsonov
54afba8b62
[ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ASan-specific AsanThreadRegistry.
...
llvm-svn: 177634
2013-03-21 11:23:41 +00:00
Alexey Samsonov
cf025cb2e6
[ASan] Move GetCurrentThread/SetCurrentThread from AsanThreadRegistry class into plain functions: they don't actually use registry
...
llvm-svn: 177501
2013-03-20 09:23:28 +00:00
Evgeniy Stepanov
9a8f0f55d5
[asan] s/ASAN_POSIX/SANITIZER_POSIX/
...
llvm-svn: 177407
2013-03-19 15:26:41 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Alexander Potapenko
f1c48eb509
[ASan] Add the memcmp_strict flag (1 by default) that controls the behavior of accessibility checks in memcmp.
...
1: memcmp(p1, p2, n) always checks n bytes
0: memcmp checks up to n bytes depending on whether the memory contents differ.
llvm-svn: 176256
2013-02-28 14:09:30 +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
Alexander Potapenko
8dbcb98c52
[ASan] Revert the incorrect macro on Linux.
...
llvm-svn: 175745
2013-02-21 15:15:43 +00:00
Alexander Potapenko
e8ba1c851a
[ASan] Refactoring: nuke the redundant function declarations in asan_intercepted_functions.h
...
that had been used on OS X only.
The INTERCEPTOR() macro on OS X is now responsible for declaring the wrapped function, the wrapper and the
pair of pointers to them in __DATA,__interposition section. Thus adding an interceptor requires editing a single file now.
llvm-svn: 175740
2013-02-21 14:41:16 +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
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
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
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
01671c33ff
[sanitizer] lint
...
llvm-svn: 172817
2013-01-18 13:12:56 +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
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
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
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
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
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
Kostya Serebryany
baf583c443
[asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to allow using the slow CFI-based unwinder
...
llvm-svn: 170117
2012-12-13 09:34: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
Alexander Potapenko
af5a108ea8
[ASan] Typo fix in memcpy() and memmove() interceptors: ASAN_WRITE_RANGE and ASAN_READ_RANGE were swapped.
...
This has been spotted by Anna Zaks (ganna@apple.com )
llvm-svn: 169736
2012-12-10 16:02:13 +00:00
Alexey Samsonov
fa94fa52ad
ASan: intercept prctl on Linux only
...
llvm-svn: 169616
2012-12-07 17:54:38 +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
1a6f4d4ba6
[asan] undo the debug printf
...
llvm-svn: 169381
2012-12-05 13:39:29 +00:00
Kostya Serebryany
571232b8cf
[tsan] get rid of *allocator64* files, moving everything to *allocator* files. This will help with the 32-bit allocator implementation and testing
...
llvm-svn: 169368
2012-12-05 10:09:15 +00:00
Alexey Samsonov
0d7755ccb5
[ASan] Add interceptor for swapcontext to fight with false positives in some of its use cases.
...
llvm-svn: 168508
2012-11-23 09:46:34 +00:00
Alexander Potapenko
99843d3a29
In the dynamic runtime on Mac OS, do not call internal_strdup() before __asan_init().
...
This may result in a crash at startup.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=123 .
llvm-svn: 166768
2012-10-26 11:31:14 +00:00
Alexander Potapenko
faa9c86fd0
[ASan] Use internal_memmove() in both static and dynamic runtime libraries if asan_inited != 0.
...
llvm-svn: 166549
2012-10-24 09:19:16 +00:00
Alexander Potapenko
7b03290c43
Implement internal_memmove.
...
Use internal_memmove() and internal_memcpy() in the memcpy() and memmove() wrappers
when building the dynamic runtime (OS X only), to work around a bug in resolver functions wrapping.
See also http://code.google.com/p/address-sanitizer/issues/detail?id=116
llvm-svn: 165939
2012-10-15 15:34:41 +00:00
Alexander Potapenko
b4db79fc7d
If !asan_inited, call internal versions of libc functions where available.
...
This is to remove unnecessary #if directives.
llvm-svn: 165307
2012-10-05 12:11:06 +00:00
Alexander Potapenko
d2f6b97417
Avoid calling __asan_init from memcpy(), memmove(), memset() during libSystem initialization.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=117 .
llvm-svn: 165227
2012-10-04 13:41:28 +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
Alexander Potapenko
67192d41ee
Allow to call strchr() from __asan_init().
...
Fixes PR13794.
llvm-svn: 163493
2012-09-10 08:35:12 +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
Alexander Potapenko
5f487de8a3
Fix lint warnings.
...
llvm-svn: 162092
2012-08-17 10:08:51 +00:00
Alexander Potapenko
c62210e3ff
Commit the source and CMake changes that will allow to build ASan runtime
...
as a shared library on Mac OS. This will provide an alternative to
mach_override.
llvm-svn: 162091
2012-08-17 09:00:08 +00:00
Alexander Potapenko
f6344ffe39
Introduce asan_intercepted_functions.h which contains the declarations wrapped functions and their wrappers.
...
Those declarations are going to be shared between asan_interceptors.cc and the dynamic runtime library on Mac OS.
llvm-svn: 161952
2012-08-15 15:24:48 +00:00
Alexander Potapenko
81a1ec8ea6
Do not attempt to intercept mlock and friends on Windows.
...
llvm-svn: 161939
2012-08-15 09:46:45 +00:00
Alexander Potapenko
785f8bc4ec
Use the common interception machinery for mlock/munlock/mlockall/munlockall.
...
llvm-svn: 161938
2012-08-15 09:22:57 +00:00
Alexey Samsonov
c0ff933d8b
[ASan] Move error reporting code away from file with interceptors
...
llvm-svn: 161570
2012-08-09 08:32:33 +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
cc7ea4269a
[ASan] cleanup interceptors code - prefer ASAN_INTERCEPT_FUNCTION_NAME macro to _WIN32, __APPLE__ etc.
...
llvm-svn: 161109
2012-08-01 11:17:00 +00:00
Kostya Serebryany
4c38790f70
[asan] ensure that asan_init is called in str[n]cmp. Bug found by Nick Kralevich (thanks)
...
llvm-svn: 160853
2012-07-27 07:09:49 +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
34efb8e9b9
[ASan] Use common flags parsing machinery.
...
llvm-svn: 159933
2012-07-09 14:36:04 +00:00
Alexey Samsonov
70386aaffa
[ASan] cleanup: trailing semicolons, trailing colons in enums
...
llvm-svn: 159338
2012-06-28 08:27:24 +00:00
Alexey Samsonov
156958dd0c
[Sanitizer] move all the rest re-implementations of libc functions from ASan runtime to common sanitizer runtime
...
llvm-svn: 158519
2012-06-15 13:09:52 +00:00
Alexey Samsonov
3efd6fc26c
[Sanitizer] Use DEFINE_REAL macro in TSan runtime to call libc implementations of functions. Move strchr to sanitizer_libc.
...
llvm-svn: 158517
2012-06-15 12:24:07 +00:00
Alexey Samsonov
96ef49a71e
[Sanitizer] Move internal_memcmp to common sanitizer libc
...
llvm-svn: 158450
2012-06-14 14:04:54 +00:00
Alexey Samsonov
59036d2c06
[Sanitizer] add internal_memset and internal_strrchr to sanitizer_common/
...
llvm-svn: 158202
2012-06-08 14:11:12 +00:00
Alexey Samsonov
99d58521c5
[ASan] allow calls to memmove during rtl initialization
...
llvm-svn: 158201
2012-06-08 14:04:04 +00:00
Alexey Samsonov
f26b842ca8
[ASan] add interceptor for strncat
...
llvm-svn: 158198
2012-06-08 13:27:46 +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
51ae983718
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
...
llvm-svn: 158065
2012-06-06 13:11:29 +00:00
Alexey Samsonov
ee07290628
[Sanitizer] Move more functions/constants to sanitizer_common.
...
llvm-svn: 158056
2012-06-06 09:26:25 +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
485d3dc363
Remove file-type tags for .cc files in ASan run-time library
...
llvm-svn: 157927
2012-06-04 13:50:10 +00:00
Alexey Samsonov
90f9630c80
[Sanitizer]: move internal_strcmp to sanitizer_common
...
llvm-svn: 157926
2012-06-04 13:27:49 +00:00
Alexey Samsonov
06f2cd38c1
[Sanitizer] Move internal_strncpy to sanitizer_libc (and make its behavior conforming to manual)
...
llvm-svn: 157922
2012-06-04 10:30:16 +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
Meador Inge
6fef6e6466
Adding back a right parenthesis that was dropped in r157388.
...
llvm-svn: 157406
2012-05-24 18:16:39 +00:00
Dmitry Vyukov
7fb7330469
asan/tsan: weak interceptors
...
The idea isthat asan/tsan can survive if user intercepts the same functions. At the same time user has an ability to call back into asan/tsan runtime. See the following tests for examples:
asan/output_tests/interception_failure_test-linux.cc
asan/output_tests/interception_test-linux.cc
asan/output_tests/interception_malloc_test-linux.cc
llvm-svn: 157388
2012-05-24 13:54:31 +00:00
Alexander Potapenko
ec316e5940
Partially revert r154390 ( http://llvm.org/viewvc/llvm-project?view=rev&revision=154390 )
...
Until we work out the solution for http://code.google.com/p/address-sanitizer/issues/detail?id=65 we'd better not allow
the clients to override AddressSanitizer's signal handler.
The second part of r154390 (removing the sighandler-related tests) is not reverted, because those tests were broken
and didn't test anything.
llvm-svn: 154803
2012-04-16 08:33:01 +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
Alexey Samsonov
6a19d5d209
[ASan] move replacements for new/delete to separate file
...
llvm-svn: 154167
2012-04-06 08:21:08 +00:00
Alexey Samsonov
61a331d594
[ASan] use correct C-version of strchr on Windows
...
llvm-svn: 154006
2012-04-04 11:36:47 +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
b33c87bbb9
[ASan] interceptors for atoi/atol/atoll
...
llvm-svn: 153637
2012-03-29 08:04:35 +00:00
Alexey Samsonov
0a4f8dc0cb
[ASan] add interceptor for strtol
...
llvm-svn: 153444
2012-03-26 16:42:22 +00:00
Alexey Samsonov
1fd5dbc140
[ASan] use macro to define if we should intercept signal/sigaction
...
llvm-svn: 153430
2012-03-26 09:07:29 +00:00
Alexey Samsonov
f71cb8d307
[ASan] revert r153378
...
llvm-svn: 153379
2012-03-24 10:12:58 +00:00
Alexey Samsonov
01da1055d3
[ASan] simplify ASAN_INTERCEPT_* definitions
...
llvm-svn: 153378
2012-03-24 09:47:56 +00:00
Alexey Samsonov
78481835ae
[ASan] use ASAN_INTERCEPT_STRNLEN instead of defined(__APPLE__)
...
llvm-svn: 153377
2012-03-24 09:10:50 +00:00
Alexey Samsonov
c8efe828a9
[ASan] add interceptor for strtoll
...
llvm-svn: 153376
2012-03-24 08:39:14 +00:00
Alexey Samsonov
b8a047261c
[asan] one more try to remove pthread.h from asan_interceptors.cc
...
llvm-svn: 153188
2012-03-21 15:02:39 +00:00
Alexey Samsonov
9113f3e000
[asan] add missing declarations from string.h and remove this header
...
llvm-svn: 153187
2012-03-21 14:33:15 +00:00
Alexey Samsonov
abbcccc187
[asan] use extern declaraions of libc functions on Win and on Mac
...
llvm-svn: 153186
2012-03-21 14:22:28 +00:00
Alexey Samsonov
ef50dfd6aa
[asan]: remove signal.h system header from interceptors
...
llvm-svn: 153183
2012-03-21 13:44:39 +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
Alexander Potapenko
1159250518
s/Printf/Report for libc interceptors (need this to debug the potential double interception)
...
llvm-svn: 153175
2012-03-21 09:33:05 +00:00
Alexey Samsonov
1479418407
[ASan] get rid of setjmp.h header in interceptors
...
llvm-svn: 153085
2012-03-20 11:40:09 +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
af32a84b24
[asan] added an assert in InitializeAsanInterceptors (it should be run just once)
...
llvm-svn: 152945
2012-03-16 21:02:13 +00:00
Kostya Serebryany
54a3cac5c5
[asan] fix unwinding inside libc intercepors (asan issue #46 )
...
llvm-svn: 152768
2012-03-15 01:36:00 +00:00
Kostya Serebryany
fd2037162e
[asan] performance optimization: make sure the check for poisoned shadow inside inteceptors is inlined
...
llvm-svn: 152767
2012-03-15 01:18:06 +00:00
Timur Iskhodzhanov
cf526ff278
[ASan/Win] Fix wrong memmove,memcpy,memset interceptor definitons
...
llvm-svn: 152622
2012-03-13 10:42:34 +00:00
Timur Iskhodzhanov
2f48b870f3
[ASan] Add back the support for /MT; intercept statically-linked functions
...
llvm-svn: 152557
2012-03-12 11:45:09 +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
Timur Iskhodzhanov
0f9c9a5332
[ASan] Intercept CreateThread on Windows
...
llvm-svn: 151366
2012-02-24 15:28:43 +00:00
Timur Iskhodzhanov
36d297d27f
[ASan] Intercept functions on Windows - first version
...
llvm-svn: 151161
2012-02-22 13:59:49 +00:00
Alexey Samsonov
a5b3130e86
AddressSanitizer: get rid of limits.h, use constants for fixed size integral types instead.
...
llvm-svn: 151159
2012-02-22 12:54:04 +00:00
Evgeniy Stepanov
abaf196be3
[asan] Remove mentions of pthread*_t from interceptors.
...
Some platforms do not define pthread_t in stdlib.h.
llvm-svn: 151158
2012-02-22 12:31:25 +00:00
Alexey Samsonov
0d0b406aba
AddressSanitizer: use custom strtol/atoll functions
...
llvm-svn: 150812
2012-02-17 16:15:09 +00:00
Alexey Samsonov
fbb50f19ad
AddressSanitizer: revert r150683 - we can't get rid of headers that easily
...
llvm-svn: 150699
2012-02-16 17:00:45 +00:00
Alexey Samsonov
ca37969c24
AddressSanitizer: don't include pthread.h and signal.h in interceptors on Mac
...
llvm-svn: 150683
2012-02-16 11:26:52 +00:00
Alexey Samsonov
1e7e2370aa
AddressSanitizer: don't include pthread.h in asan_interceptors.cc on Linux
...
llvm-svn: 150573
2012-02-15 09:14:26 +00:00
Timur Iskhodzhanov
d2a9075de0
[ASan] Define an internal implementation of strchr to make stack OOB tests pass on Windows
...
llvm-svn: 150499
2012-02-14 19:33:04 +00:00
Evgeniy Stepanov
b25d0d2318
[asan] Return type of index() is char*.
...
This is important for Android, where we can't keep system headers
from leaking into asan_interceptors.cc.
llvm-svn: 150374
2012-02-13 12:12:32 +00:00
Evgeniy Stepanov
da7522b551
[asan] Disable signal&sigaction interceptors on Android.
...
llvm-svn: 150373
2012-02-13 12:04:36 +00:00
Timur Iskhodzhanov
7ce3e5bb8e
[asan] The first version of the RTL for Windows, reviewed at http://codereview.appspot.com/5647052
...
llvm-svn: 150185
2012-02-09 17:20:14 +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
Alexey Samsonov
8489f2a564
AddressSanitizer: start factoring out interception machinery
...
llvm-svn: 150083
2012-02-08 19:52:01 +00:00
Alexey Samsonov
e725478e2f
AddressSanitizer: replace all "real_X" calls with "REAL(X)"
...
llvm-svn: 150073
2012-02-08 13:45:31 +00:00
Alexey Samsonov
23e3b90319
AddressSanitizer: Replace __attribute__ with macro (for Win compatibility). Patch by timurrrr@google.com
...
llvm-svn: 149686
2012-02-03 08:37:19 +00:00
Alexey Samsonov
15965f9c3d
AddressSanitizer: Add macro for definition/declaration of interceptors
...
llvm-svn: 149602
2012-02-02 10:39:40 +00:00
Alexander Potapenko
c97434ecaf
Disable wrapping memcpy() on Mac OS Lion, where it
...
actually falls back to memmove.
In this case we still need to initialize real_memcpy, so we set it to
real_memmove
We check for MACOS_VERSION_SNOW_LEOPARD, because currently only Snow
Leopard and Lion are supported.
llvm-svn: 149492
2012-02-01 10:07:52 +00:00
Alexey Samsonov
2dcef2d2a8
AddressSanitizer: Enforce default visibility for all libc interceptors
...
llvm-svn: 149247
2012-01-30 13:42:44 +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
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
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
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
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
2d3a67b73b
AddressSanitizer: create AsanThreadSummary together with AsanThread (in parent thread)
...
llvm-svn: 148286
2012-01-17 06:35:31 +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
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
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
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
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
Kostya Serebryany
ba41e8d2c5
[asan]: fix mac build
...
llvm-svn: 147792
2012-01-09 19:35:11 +00:00
Kostya Serebryany
9fd01e5ea5
[asan] refactoring: move all interceptors to a single file
...
llvm-svn: 147784
2012-01-09 18:53:15 +00:00
Kostya Serebryany
6c4bd806fa
[asan] use custom libc-free getenv; a bit of refactoring around mmap calls
...
llvm-svn: 147326
2011-12-28 22:58:01 +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
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
92ebcadfe4
[asan] cleanup memset/memmove/memcpy interceptors and enable them on Mac. Patch by samsonov@google.com
...
llvm-svn: 145826
2011-12-05 18:56:29 +00:00
Kostya Serebryany
2d27cdf621
[asan] minimize the use of STL. One bit is still left.
...
llvm-svn: 145691
2011-12-02 18:42:04 +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