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