Alexey Samsonov
2874f70250
[ASan] move all lit_tests under TestCases
...
llvm-svn: 183395
2013-06-06 09:23:34 +00:00
Alexey Samsonov
b42b2f5c69
[ASan] Add a few tests for use-after-scope mode
...
llvm-svn: 183391
2013-06-06 08:30:26 +00:00
Alexey Samsonov
7a75e16c27
[ASan] One more fix for realloc: check that reallocated chunk is valid before calling memcpy
...
llvm-svn: 183390
2013-06-06 08:25:31 +00:00
Alexey Samsonov
87a59e5652
[ASan] make free_hook_realloc test more robust
...
llvm-svn: 183387
2013-06-06 07:58:00 +00:00
Evgeniy Stepanov
863746eb1a
[sanitizer] Fix windows build.
...
llvm-svn: 183225
2013-06-04 14:06:16 +00:00
Evgeniy Stepanov
56050e8f69
[sanitizer] Fix __sanitizer_unaligned_* to work with unaligned data types.
...
llvm-svn: 183224
2013-06-04 13:49:10 +00:00
Evgeniy Stepanov
53c8c13bf1
[msan] Implement __sanitizer_unaligned_*.
...
llvm-svn: 183221
2013-06-04 13:08:36 +00:00
Alexey Samsonov
8f5138a23f
Call __asan_free_hook() before marking the chunk quarantinned
...
Summary:
With this change, the user may safely call __asan_get_ownership()
from malloc/free hooks and assume it would return "true". If there is a
realloc/free race, free hook might be called twice, but I think it's acceptable,
as it's a data race and would later be reported anyway.
This change also fixes a bug when failing realloc incorrectly marked the
original memory as "quarantinned".
Reviewers: timurrrr, kcc, samsonov
Reviewed By: samsonov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D913
llvm-svn: 183220
2013-06-04 12:19:31 +00:00
Sergey Matveev
b256ac7584
[asan] Fix invalid thread registry access when checking if LSan is disabled.
...
llvm-svn: 183218
2013-06-04 10:39:24 +00:00
Timur Iskhodzhanov
baf90ccfac
Fix ALIGNED misuse in asan_thread.cc (built on all platforms); also, add a comment to the ALIGNED macro describing the correct usage
...
llvm-svn: 183214
2013-06-04 08:25:17 +00:00
Kostya Serebryany
c1aa0e8f69
[asan] ASan Linux MIPS32 support (compiler-rt part), patch by Jyun-Yan Y
...
llvm-svn: 183105
2013-06-03 14:49:25 +00:00
Sergey Matveev
17ee1abfa7
[lsan] Add __lsan_disable() and __lsan_enable().
...
Objects allocated after a call to __lsan_disable() will be treated as
live memory. Also add a ScopedDisabler.
llvm-svn: 183099
2013-06-03 11:21:34 +00:00
Sergey Matveev
3786ae5c54
[sanitizer] Fix kThreadDescriptorSize for glibc <= 2.11.
...
Address issue reported by Greg Fitzgerald.
llvm-svn: 183098
2013-06-03 10:20:23 +00:00
Alexander Potapenko
41cd6102e9
[ASan] Do not buffer stdin in asan_symbolize.py
...
llvm-svn: 183006
2013-05-31 14:55:06 +00:00
Sergey Matveev
1a566ced91
[lsan] Added a dummy unittest to suppress LIT warnings.
...
llvm-svn: 183004
2013-05-31 14:15:54 +00:00
Sergey Matveev
5494e0bec3
[lsan] Run the leak detection tests under both ASan and LSan.
...
Change the LSan lit test logic. Now "check-lsan" tests the leak
checking functionality in both standalone LSan and ASan.
llvm-svn: 183000
2013-05-31 13:13:55 +00:00
Evgeniy Stepanov
4717d2d494
[msan] Fix gcc build of msan runtime.
...
llvm-svn: 182999
2013-05-31 13:04:07 +00:00
Evgeniy Stepanov
96284becf4
[msan] Handle mixed track-origins and keep-going settings (compiler-rt part).
...
Before this change, each module defined a weak_odr global __msan_track_origins
with a value of 1 if origin tracking is enabled, 0 if disabled. If there are
modules with different values, any of them may win. If 0 wins, and there is at
least one module with 1, the program will most likely crash.
With this change, __msan_track_origins is only emitted if origin tracking is
on. Then runtime library detects if there is at least one module with origin
tracking, and enables runtime support for it.
llvm-svn: 182996
2013-05-31 12:04:08 +00:00
Sergey Matveev
53c24fe0e6
[sanitizer] Fix r182994 - update test.
...
llvm-svn: 182995
2013-05-31 11:33:21 +00:00
Sergey Matveev
69f11803ec
[lsan] Use the fast version of GetBlockBegin for leak checking in LSan and ASan.
...
llvm-svn: 182994
2013-05-31 11:13:45 +00:00
Evgeniy Stepanov
1cf5ef5018
[sanitizer] Fix wrong size of addrinfo::ai_addrlen.
...
Add compile time tests for sizes and offsets of all sanitizer-posix types.
llvm-svn: 182993
2013-05-31 10:46:51 +00:00
Kostya Serebryany
3a7c6d689d
[asan] workaround for the quemu bug in proc maps ( http://code.google.com/p/address-sanitizer/issues/detail?id=160 )
...
llvm-svn: 182922
2013-05-30 11:00:08 +00:00
Alexey Samsonov
2a6cc67225
Fix #if guards in sanitizer_common code
...
llvm-svn: 182918
2013-05-30 09:16:04 +00:00
Kostya Serebryany
831a1d7cec
[sanitizer] introduce LargeMmapAllocator::GetBlockBeginFastSingleThreaded, required for LeakSanitizer to work faster. Also fix lint.
...
llvm-svn: 182917
2013-05-30 08:43:30 +00:00
Alexander Potapenko
a8b41762e4
[ASan] Minor cleanup: remove a couple of unused variables.
...
llvm-svn: 182915
2013-05-30 07:30:07 +00:00
Timur Iskhodzhanov
013da5cb37
Replaced 'bool .* = 0;' with '... = false;'
...
llvm-svn: 182868
2013-05-29 17:26:25 +00:00
Sergey Matveev
6a0c722c23
[asan] Fix r182858.
...
llvm-svn: 182862
2013-05-29 15:31:52 +00:00
Sergey Matveev
4161813a50
[asan] Fix r182854: run the unpoison_tls test only on Linux.
...
llvm-svn: 182858
2013-05-29 14:37:04 +00:00
Timur Iskhodzhanov
cc61eefd4b
Fix MSVC W3 compiler warnings
...
llvm-svn: 182857
2013-05-29 14:11:44 +00:00
Sergey Matveev
09886cd17a
[asan] Make ASan report the correct thread address ranges to LSan.
...
This CL enables thread support in LSan when used on top of ASan.
llvm-svn: 182854
2013-05-29 13:09:44 +00:00
Sergey Matveev
89bcec8117
[sanitizer] Change the way GetThreadStackAndTls() obtains the thread descriptor address.
...
Instead of using arch_prctl(ARCH_GET_FS), read the address from the
tread descriptor itself. This lets us avoid sandboxing issues. Also,
GetThreadStackAndTls() can now be implemented on i386.
llvm-svn: 182853
2013-05-29 13:07:42 +00:00
Evgeniy Stepanov
677003140c
[sanitizer] Fix getaddrinfo interceptor to use the actual returned sockaddr size.
...
llvm-svn: 182852
2013-05-29 12:33:31 +00:00
Peter Collingbourne
112e5ba281
[nolibc] Unweak SymbolizerPrepareForSandboxing and move it to libc-independent part.
...
Fixes the Go build.
Differential Revision: http://llvm-reviews.chandlerc.com/D877
llvm-svn: 182851
2013-05-29 12:11:43 +00:00
Timur Iskhodzhanov
6ba477aa05
Fix MSVC warnings at the -W2 level
...
llvm-svn: 182848
2013-05-29 12:03:49 +00:00
Evgeniy Stepanov
a4bf67e461
[sanitizer] Fix Mac build.
...
llvm-svn: 182845
2013-05-29 11:55:27 +00:00
Evgeniy Stepanov
fc708db4c1
[sanitizer] Intercept getpeername.
...
llvm-svn: 182844
2013-05-29 11:49:25 +00:00
Evgeniy Stepanov
a4d08c4e87
[sanitizer] Move TSan and MSan recvmsg interceptors to common.
...
llvm-svn: 182843
2013-05-29 11:30:00 +00:00
Dmitry Vyukov
2b997d2914
tsan: match "race" suppressions against "race on vptr" reports
...
llvm-svn: 182842
2013-05-29 11:23:54 +00:00
Peter Collingbourne
93aa8dfb78
[nolibc] Now that we have a custom allocator, remove dummy allocator
...
definitions from test.
llvm-svn: 182841
2013-05-29 10:52:59 +00:00
Alexey Samsonov
25ad5a6735
[sanitizer] Use raw check in internal allocator to prevent self-deadlocks. Try to fix Windows build.
...
llvm-svn: 182840
2013-05-29 10:41:53 +00:00
Sergey Matveev
e615432313
[lsan] Convert the remaining LSan tests to output tests.
...
llvm-svn: 182839
2013-05-29 10:12:37 +00:00
Evgeniy Stepanov
f28217ad0e
[sanitizer] modf/modff/modfl interceptors.
...
llvm-svn: 182838
2013-05-29 10:03:11 +00:00
Alexey Samsonov
75289297af
Exclude sanitizer_nolibc_test from TSan test run. Fix lint warnings
...
llvm-svn: 182837
2013-05-29 09:40:07 +00:00
Alexey Samsonov
c30e2d6b3a
Make InternalAlloc/InternalFree in sanitizer runtimes libc-free by switching to a custom allocator.
...
llvm-svn: 182836
2013-05-29 09:15:39 +00:00
Evgeniy Stepanov
08f662845d
[sanitizer] Share TSan accept & accept4 interceptors with other sanitizers.
...
llvm-svn: 182835
2013-05-29 09:09:58 +00:00
Evgeniy Stepanov
40d7ed5d1e
[sanitizer] Improve getaddrinfo interceptor.
...
llvm-svn: 182775
2013-05-28 14:34:37 +00:00
Evgeniy Stepanov
dd0780f81c
[msan] Change report header to be more alike to ASan and TSan.
...
llvm-svn: 182774
2013-05-28 14:27:30 +00:00
Peter Collingbourne
a7887bf8be
[nolibc] Add a test case for Linux/x86_64.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D873
llvm-svn: 182770
2013-05-28 12:37:34 +00:00
Peter Collingbourne
fb1a9f17e3
[nolibc] Make SymbolizerPrepareForSandboxing weak and optional.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D872
llvm-svn: 182765
2013-05-28 11:05:05 +00:00
Peter Collingbourne
5b2669049a
[nolibc] Make AddressInfo::Clear a weak function.
...
llvm-svn: 182743
2013-05-27 21:00:36 +00:00
Peter Collingbourne
123473d243
Use an address-of operator here to silence an MSVC warning.
...
llvm-svn: 182740
2013-05-27 16:02:19 +00:00
Sergey Matveev
39e8a6d87e
[lsan] Begin converting LSan tests to output tests.
...
In this CL all old tests are removed and one LIT test is added.
llvm-svn: 182730
2013-05-27 11:41:46 +00:00
Sergey Matveev
9cda3df8bd
[sanitizer] Move FindThreadByOSIdLocked from lsan to sanitizer_common.
...
llvm-svn: 182728
2013-05-27 10:35:51 +00:00
Alexey Samsonov
9c2bcf8c15
Improve support for compiler-rt tests in CMake build.
...
Now compiler-rt tests run correctly if compiler-rt is checked out into
arbitrary directory (not necessarily projects/compiler-rt).
Patch by Greg Fitzgerald!
llvm-svn: 182726
2013-05-27 09:35:24 +00:00
Nick Kledzik
23bbd617e4
<rdar://problem/12512722> Use arm divide instruction if available
...
llvm-svn: 182665
2013-05-24 19:38:11 +00:00
Sergey Matveev
e45a0677a6
[lsan] Allow the ignored TLS range to be empty.
...
llvm-svn: 182657
2013-05-24 18:07:53 +00:00
Sergey Matveev
37dff38495
[lsan] Minor adjustments to LSan messages.
...
llvm-svn: 182648
2013-05-24 15:36:30 +00:00
Sergey Matveev
c7715a228a
[lsan] Prettify LSan reports and add a summary.
...
llvm-svn: 182646
2013-05-24 14:49:13 +00:00
Sergey Matveev
bc880f3a54
[lsan] Add exitcode flag. Kill the process if leaks are found.
...
llvm-svn: 182641
2013-05-24 13:16:02 +00:00
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