Alexey Samsonov
646ec67e25
Disable init-order checking before destructors are run.
...
We don't want to report initialization-order bugs when a destructor of a global
variable accesses dynamically initialized global from another
(not necessarily initialized) module. We do this by intercepting __cxa_atexit and
registrering our own callback that unpoisons shadow for all dynamically initialized
global variables.
llvm-svn: 182637
2013-05-24 11:46:56 +00:00
Bill Wendling
b7e7a38929
Don't override 'mode' and cleanup some variable names.
...
llvm-svn: 182599
2013-05-23 18:18:31 +00:00
Bill Wendling
a600457cde
Add 'mode' parameter when using 'O_CREAT'. Thanks to Evgeniy for pointing this out.
...
llvm-svn: 182598
2013-05-23 18:08:22 +00:00
Sergey Matveev
a4a01975d5
[lsan] Add lit test support.
...
"check-lsan" now runs both the tests from lib/lsan/tests and any lit
tests found under lib/lsan/lit_tests.
llvm-svn: 182583
2013-05-23 12:58:56 +00:00
Alexander Potapenko
22e92fa954
[TSan] Try to fix the Go-TSan build.
...
llvm-svn: 182582
2013-05-23 12:54:35 +00:00
Evgeniy Stepanov
bfbd37e6e7
[tsan] Remove -Wgnu from Makefile.old.
...
llvm-svn: 182580
2013-05-23 11:57:47 +00:00
Alexander Potapenko
6535f510a3
[ASan] Introduce SymbolizerPrepareForSandboxing(), which is a no-op on every platform except Linux (because we don't support sandboxing anywhere else yet)
...
On Linux we pre-cache the value of readlink("/proc/self/exe"), so that it can be later used when the sandbox has been turned on.
llvm-svn: 182579
2013-05-23 11:53:36 +00:00
Evgeniy Stepanov
a343d1d881
[msan] Fix line >80 chars.
...
llvm-svn: 182578
2013-05-23 11:51:47 +00:00
Evgeniy Stepanov
5415c9c352
[sanitizer] Fix Windows build.
...
llvm-svn: 182576
2013-05-23 11:41:58 +00:00
Timur Iskhodzhanov
e05f9ba956
[ASan] Rename a atomic_compare_exchange_strong parameter to avoid a compiler warning
...
llvm-svn: 182575
2013-05-23 11:40:51 +00:00
Evgeniy Stepanov
b978627cb8
[sanitizer] Intercept getsockopt.
...
llvm-svn: 182574
2013-05-23 11:38:08 +00:00
Evgeniy Stepanov
ab25369d04
[sanitizer] Interceptors for gethostbyname and friends.
...
llvm-svn: 182573
2013-05-23 11:10:23 +00:00
Sergey Matveev
bb12f840b5
[lsan] Ensure lsan is initialized when interceptors are called.
...
Also remove unnecessary ifdefs.
llvm-svn: 182571
2013-05-23 10:24:44 +00:00
Alexander Potapenko
fd7d9f45dd
[ASan] Rename __asan_preinit to __local_asan_preinit to avoid warnings from the linker which is trying to export all the __asan_* symbols
...
llvm-svn: 182567
2013-05-23 09:15:20 +00:00
Bill Wendling
353fbd3516
Performance improvement.
...
Using fwrite and fread was very *very* slow. The resulting code was multiple
times slower than GCC's implementation of gcov. Replace the fwrite/fread system
with an mmap() version.
If the `.gcda' file doesn't exist, we (re)allocate a buffer that we write
into. That gets written to the `.gcda' file in one chunk. If the `.gcda' file
already exists, we simply mmap() the file, modify the mapped data, and use
msync() to write the contents out to disk. It's much easier than implementing
our own buffering scheme, and we don't have to use fwrite's and fread's
buffering.
For those who are numbers-oriented, here are some timings:
GCC Verison
-----------
`.gcda' files don't exist: 23s
`.gcda' files do exist: 14s
LLVM Version (before this change)
---------------------------------
`.gcda' files don't exist: 28s
`.gcda' files do exist: 28s
LLVM Version (with this change)
-------------------------------
`.gcda' files don't exist: 18s
`.gcda' files do exist: 4s
It's a win-win-win-win-lose-win-win scenario!
<rdar://problem/13466086>
llvm-svn: 182563
2013-05-23 07:18:59 +00:00
Evgeniy Stepanov
d23422f025
[sanitizer] Fix Mac build one more time.
...
llvm-svn: 182481
2013-05-22 15:21:04 +00:00
Evgeniy Stepanov
093e499e27
[sanitizer] Fix Android build.
...
llvm-svn: 182479
2013-05-22 14:26:52 +00:00
Alexey Samsonov
58df72e0d2
Effectively revert r182453 - atomic.c may not be compiled if host compiler doesn't understand _Atomic
...
llvm-svn: 182478
2013-05-22 14:22:04 +00:00
Kostya Serebryany
6ca6ba2f2c
[asan] fix the reported PCs for powerpc64
...
llvm-svn: 182477
2013-05-22 14:21:34 +00:00
Evgeniy Stepanov
97aea34b54
[msan] Intercept getsockname.
...
llvm-svn: 182475
2013-05-22 13:46:22 +00:00
Evgeniy Stepanov
a8ea8a03fd
[sanitizer] Fix Android build.
...
llvm-svn: 182473
2013-05-22 13:38:02 +00:00
Alexey Samsonov
49eb5700e2
Revert r182465 and add lsan-common library to makefile-based build
...
llvm-svn: 182470
2013-05-22 13:20:37 +00:00
Evgeniy Stepanov
02c9c8c9f7
[sanitizer] Fix Mac build.
...
llvm-svn: 182469
2013-05-22 13:07:23 +00:00
Evgeniy Stepanov
bfd2122b20
[msan] getaddrinfo & nested interceptor support.
...
Multiple connected changes:
- Ignore reads from nested interceptors.
- Check shadow on reads from common interceptors.
- getaddrinfo interceptor.
llvm-svn: 182466
2013-05-22 12:50:26 +00:00
Alexey Samsonov
155dd46e04
[ASan] Temporary remove leak checking from ASan, while we don't have makefile-based build for LSan
...
llvm-svn: 182465
2013-05-22 12:44:57 +00:00
Kostya Serebryany
15fd53fa39
[asan] enhance stack-overflow.cc test: check that the location frame is properly symbolized
...
llvm-svn: 182463
2013-05-22 11:00:56 +00:00
Kostya Serebryany
b93ae15205
[asan] attempting to fix the debian bot (on ubuntu the test builds; on debian it complains that _SC_PAGESIZE is unknown)
...
llvm-svn: 182462
2013-05-22 10:38:51 +00:00
Kostya Serebryany
62debd6d6a
[asan] fix dlclose-test to work with non-4K pages. Properly disable interface_symbols_linux on non-x86
...
llvm-svn: 182461
2013-05-22 10:20:10 +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
Alexey Samsonov
57cbb6c6cc
Add atomic.c to CMake build of compiler-rt to match r182420
...
llvm-svn: 182453
2013-05-22 06:46:07 +00:00
Nick Kledzik
69e25c45e4
<rdar://problem/13806954> enable __atomic_* functions for Darwin
...
llvm-svn: 182435
2013-05-21 23:02:04 +00:00
Daniel Dunbar
eaa153bdad
Add atomic.c back to the builtins module sources lists (for Makefile build).
...
llvm-svn: 182420
2013-05-21 20:40:36 +00:00
Sergey Matveev
20ccf95f80
[lsan] Invoke leak detection with atexit().
...
Keeps it consistent between ASan and LSan.
llvm-svn: 182399
2013-05-21 17:56:45 +00:00
Sergey Matveev
17f5705d3c
[asan] Do not invoke LSan hooks unless CAN_SANITIZE_LEAKS.
...
llvm-svn: 182389
2013-05-21 15:35:34 +00:00
Sergey Matveev
8c235f40d7
[asan] LSan hooks in asan_rtl.
...
llvm-svn: 182384
2013-05-21 14:15:35 +00:00
Sergey Matveev
620744556a
[lsan] Change CMakeLists to build the common LSan module for ASan.
...
Also, define CAN_SANITIZE_LEAKS.
llvm-svn: 182383
2013-05-21 14:12:11 +00:00
Alexey Samsonov
b99085b0b8
[MSan] Add empty default blacklist for MSan
...
llvm-svn: 182382
2013-05-21 13:55:56 +00:00
Alexey Samsonov
e838135b6c
[ASan] create default (empty) ASan blacklist file in resource directory
...
llvm-svn: 182380
2013-05-21 13:48:27 +00:00
Sergey Matveev
7159b2a382
[asan] LSan hooks in asan_allocator2.cc
...
llvm-svn: 182379
2013-05-21 13:46:41 +00:00
Sergey Matveev
65dd62abe5
[asan] LSan hooks in asan_thread.cc
...
llvm-svn: 182378
2013-05-21 13:40:13 +00:00
Sergey Matveev
aa0b45a094
[lsan] LSan in LD_PRELOAD library form.
...
llvm-svn: 182376
2013-05-21 12:49:33 +00:00
Alexey Samsonov
73565f7f5d
[Sanitizer] Print verbose warning if symbolizer can't read /proc/self/exe for some reason
...
llvm-svn: 182374
2013-05-21 12:22:36 +00:00
Peter Collingbourne
c787d42f40
[nolibc] Move symbolizer to RTSanitizerCommonLibc, and make it optional using a weak symbol.
...
llvm-svn: 182372
2013-05-21 12:08:37 +00:00
Peter Collingbourne
fa8aa4105c
[nolibc] Move stoptheworld to RTSanitizerCommonLibc.
...
llvm-svn: 182369
2013-05-21 11:38:39 +00:00
Peter Collingbourne
8575195772
[nolibc] Move libc-dependent sanitizer_posix.cc code to sanitizer_posix_libcdep.cc.
...
llvm-svn: 182366
2013-05-21 10:27:07 +00:00
Alexey Samsonov
3677b18388
[ASan] Mark init-order test as XFAIL on Darwin
...
llvm-svn: 182365
2013-05-21 10:11:17 +00:00
Alexey Samsonov
af456d0c40
[ASan] Don't run fast unwinder tests on 32-bit Linux as fast unwinder may be unexpectedly smart on some hosts
...
llvm-svn: 182363
2013-05-21 09:35:48 +00:00
Evgeniy Stepanov
4059d778d1
[sanitizer] Enable pthread_getschedparam interceptor on Android.
...
llvm-svn: 182361
2013-05-21 09:01:23 +00:00
Alexey Samsonov
1c26f007ed
[ASan] Mark some tests as working only on x86_64 and i386 arches
...
llvm-svn: 182360
2013-05-21 09:01:13 +00:00
Evgeniy Stepanov
1d2f22825d
[msan] Replace GetArgv hack with something that is slightly better.
...
llvm-svn: 182359
2013-05-21 08:56:22 +00:00