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
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
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
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
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
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
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
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
Evgeniy Stepanov
4059d778d1
[sanitizer] Enable pthread_getschedparam interceptor on Android.
...
llvm-svn: 182361
2013-05-21 09:01:23 +00:00
Evgeniy Stepanov
970be35808
[sanitizer] Intercept pthread_getschedparam.
...
llvm-svn: 182353
2013-05-21 08:12:08 +00:00
Kostya Serebryany
b1333fe831
[sanitizer] fix asan on the platforms where the page size is not a compile-time constant (or at least where EXEC_PAGESIZE may not be trustworthy), e.g. powerpc64.
...
llvm-svn: 182351
2013-05-21 06:15:50 +00:00
Peter Collingbourne
b69b8a4a8f
[nolibc] Move GetPageSize to the individual platforms.
...
GetPageSize wraps sysconf(_SC_PAGESIZE) on POSIX platforms, but
sysconf resides in libc. To make this libc-independent on Linux,
move the wrapper to sanitizer_mac.cc and return the Linux-specific
constant EXEC_PAGESIZE in the sanitizer_linux.cc implementation.
llvm-svn: 182303
2013-05-20 17:05:29 +00:00
Peter Collingbourne
0c8df4e1d8
[nolibc] Move libc-dependent sanitizer_linux.cc code to sanitizer_linux_libcdep.cc.
...
llvm-svn: 182292
2013-05-20 15:57:44 +00:00
Peter Collingbourne
d5169edc36
[nolibc] Make GetArgsAndEnv libc-independent.
...
__libc_stack_end is made into a weak symbol if possible. If libc is
not linked, read args and environment from /proc.
llvm-svn: 182276
2013-05-20 14:25:32 +00:00
Alexander Potapenko
a15d49cc1f
[libsanitizer] Introduce INTERCEPTOR_WITH_SUFFIX which is to be used for appending the __DARWIN_ALIAS() version suffixes to function names on Darwin.
...
This should fix asan/lit_tests/wait.cc under ASan.
llvm-svn: 182259
2013-05-20 13:32:35 +00:00
Sergey Matveev
48c1d1acad
[lsan] Tests for LeakSanitizer.
...
llvm-svn: 182250
2013-05-20 11:09:27 +00:00
Kostya Serebryany
3469375e4f
[sanitizer] factor out ByteMap from SizeClassAllocator32 so that it can be later replaced with a more memory-efficient implementation on 64-bit.
...
llvm-svn: 182234
2013-05-20 07:29:21 +00:00
Richard Smith
73241096f7
Avoid rebuilding the RTSanitizerCommon objects when building clang_rt.san.
...
llvm-svn: 182218
2013-05-19 19:53:01 +00:00
David Blaikie
97c3018aac
Fix the UBSan CMake build broken in r182118
...
llvm-svn: 182177
2013-05-17 23:57:24 +00:00
Peter Collingbourne
ffaf2eac4d
[nolibc] Move all platforms to internal_getpid.
...
Before, we had an unused internal_getpid function for Linux, and a
platform-independent GetPid function. To make the naming conventions
consistent for syscall-like functions, the GetPid syscall wrapper
in sanitizer_posix.cc is moved to sanitizer_mac.cc, and GetPid is
renamed to internal_getpid, bringing the Linux variant into use.
llvm-svn: 182132
2013-05-17 16:56:53 +00:00
Peter Collingbourne
6d4a7d3723
[nolibc] Begin moving sanitizer_common's libc-dependent code to a separate library
...
Introduce a new object library, RTSanitizerCommonLibc, which will contain
the subset of sanitizer_common with libc dependencies. RTSanitizerCommon
contains the remainder of sanitizer_common, and is intended to have no
libc dependencies. Begin moving code to RTSanitizerCommonLibc, starting
with sanitizer_common.cc, whose libc-dependent portion is moved to
sanitizer_common_libcdep.cc, the first member of the new library.
This split affects the CMake build only. The makefile build continues
to produce the full sanitizer_common library.
llvm-svn: 182118
2013-05-17 16:17:19 +00:00
Evgeniy Stepanov
bec53faad0
[sanitizer] Fix build with Android NDK r8e.
...
llvm-svn: 182110
2013-05-17 15:22:32 +00:00
Evgeniy Stepanov
44ff0eb4b9
[sanitizer] Fix gcc build.
...
llvm-svn: 182094
2013-05-17 13:30:48 +00:00
Evgeniy Stepanov
ff6728f2f8
[msan] Unpoison dlpi_name in dl_iterate_phdr interceptor.
...
llvm-svn: 182093
2013-05-17 12:51:13 +00:00
Dmitry Vyukov
69c544d857
tsan: comment out debug output in test
...
llvm-svn: 182087
2013-05-17 11:54:37 +00:00
Kostya Serebryany
21cbaee6a9
[sanitizer] fix gcc build
...
llvm-svn: 182006
2013-05-16 13:24:31 +00:00
Kostya Serebryany
aaf7275677
[asan] symbolize when possible, even if ASAN_SYMBOLIZER_PATH is not provided. On Linux this will use dl_iterate_phdr instead of /proc/self/maps, even if the symbolizer is not installed
...
llvm-svn: 182005
2013-05-16 13:04:29 +00:00
Sergey Matveev
efb6172cb3
[sanitizer] Fix the region overflow condition in SanitizerAllocator64::PopulateFreeList().
...
llvm-svn: 182002
2013-05-16 12:58:34 +00:00
Kostya Serebryany
19eb46f4ca
[sanitizer] fix a gcc warning
...
llvm-svn: 181992
2013-05-16 08:03:26 +00:00
Kostya Serebryany
a551aaa944
[sanitizer] fix the GetBlockBegin overflow bug while preserving the performance optimization (use 32-bit division when possible). Improve the benchmarks that checks for performance of GetBlockBegin/GetMetaData
...
llvm-svn: 181989
2013-05-16 07:11:16 +00:00
Kostya Serebryany
ad9971d793
[sanitizer] added a test for a bug in allocator discovered by Sergey Matveev (uint32 overflow in GetBlockBegin)
...
llvm-svn: 181984
2013-05-16 05:22:50 +00:00
Kostya Serebryany
2b42716213
[asan] fix powerpc build and one test; fix lint
...
llvm-svn: 181881
2013-05-15 12:36:29 +00:00
Sergey Matveev
2387687788
[sanitizer] Fix Android build.
...
llvm-svn: 181796
2013-05-14 15:22:39 +00:00
Sergey Matveev
61101ba419
[sanitizer] Fixed a bug in GetListOfModules.
...
llvm-svn: 181793
2013-05-14 14:48:58 +00:00
Sergey Matveev
4b603e5c50
[sanitizer] Filtering in GetListOfModules.
...
llvm-svn: 181791
2013-05-14 14:04:06 +00:00
Sergey Matveev
af05543c86
[sanitizer] LibraryNameIs in sanitizer_linux
...
llvm-svn: 181787
2013-05-14 13:24:46 +00:00
Sergey Matveev
14b56186ab
[sanitizer] Minor fixes in sanitizer_common tests.
...
llvm-svn: 181786
2013-05-14 13:19:33 +00:00
Kostya Serebryany
9d987e34f7
[tsan] fix gcc build with -Wall
...
llvm-svn: 181763
2013-05-14 08:26:55 +00:00
Sergey Matveev
d9da20f56f
[sanitizer] Generic sorting in sanitizer_common.
...
llvm-svn: 181698
2013-05-13 11:58:48 +00:00
Sergey Matveev
37432e815e
[sanitizer] Fix StopTheWorld build on non-Android ARM.
...
Original patch by Abdoulaye Walsimou Gaye.
llvm-svn: 181697
2013-05-13 10:35:20 +00:00
Peter Collingbourne
53caf563a9
Try to fix Windows build too
...
llvm-svn: 181457
2013-05-08 18:15:01 +00:00
Peter Collingbourne
8e110ce57c
Try to fix the mac buildbots
...
llvm-svn: 181440
2013-05-08 15:07:12 +00:00
Peter Collingbourne
6f4be19b57
[nolibc] Change internal syscall API to remove reliance on libc's errno.
...
This change moves to a model where the error value of a system call is
potentially contained in the return value itself rather than being
implicit in errno. The helper function internal_iserror can be used
to extract the error value from a return value. On platforms other
than Linux/x86_64 this still uses errno, but other platforms are free
to port their error handling to this new model.
Differential Revision: http://llvm-reviews.chandlerc.com/D756
llvm-svn: 181436
2013-05-08 14:43:49 +00:00
Sergey Matveev
0d8cc4a2d2
[sanitizer] Fix build breakage in Go TSan.
...
llvm-svn: 181428
2013-05-08 13:59:30 +00:00
Sergey Matveev
af179b8d63
[sanitizer] Move GetStackTrace from ASan to sanitizer_common.
...
llvm-svn: 181424
2013-05-08 12:45:55 +00:00
Sergey Matveev
3704453368
[sanitizer] Fixed InitTlsSize for Android.
...
llvm-svn: 181330
2013-05-07 16:29:26 +00:00
Sergey Matveev
88d0c664ef
[sanitizer] Fixed includes in sanitizer_linux.cc for Android.
...
llvm-svn: 181327
2013-05-07 15:38:53 +00:00
Sergey Matveev
954c6ef10f
[sanitizer] Move GetThreadStackAndTls from TSan to sanitizer_common.
...
Move this function to sanitizer_common because LSan uses it too. Also, fix a bug
where the TLS range reported for main thread was off by the size of the thread
descriptor from libc (TSan doesn't care much, but for LSan it's critical).
llvm-svn: 181322
2013-05-07 14:41:43 +00:00
Evgeniy Stepanov
517118e6b4
[sanitizer] Sanitizer __internal_*stat interface.
...
With this change, __internal_*stat always expect a "struct stat *" argument.
This avoids stat/stat64 caller-side confusion (sanitizer_common tests already
made this mistake), and allows the use of __internal_fstat() as a drop-in
replacement for libc's fstat().
llvm-svn: 181311
2013-05-07 12:47:04 +00:00
Sergey Matveev
0c8ed9ce44
[asan] Common flags in ASan.
...
Some flags that are common to ASan/MSan/TSan/LSan have been moved to
sanitizer_common.
llvm-svn: 181193
2013-05-06 11:27:58 +00:00
Dmitry Vyukov
93b2cba03b
asan: fix windows build
...
llvm-svn: 180788
2013-04-30 13:30:29 +00:00
Dmitry Vyukov
e8fa45a02c
asan/tsan: fix printf(), on the second pass it prints garbage and crashes on random pointer dereference
...
llvm-svn: 180784
2013-04-30 12:27:48 +00:00
Dmitry Vyukov
639ba01fc3
asna/tsan/msan: fix wait() interceptors to allow NULL arguments
...
llvm-svn: 180703
2013-04-29 09:04:24 +00:00
Sergey Matveev
b2151b8200
Revert r180599 "[sanitizer] Clear LD_PRELOAD when forking an external symbolizer."
...
llvm-svn: 180602
2013-04-26 13:01:40 +00:00
Sergey Matveev
3c8fbe1013
[sanitizer] Clear LD_PRELOAD when forking an external symbolizer.
...
llvm-svn: 180599
2013-04-26 11:35:05 +00:00
Dmitry Vyukov
beaf786151
tsan: disable getpwuid_r() and glob64() interceptors under tsan, because they cause interceptor recursion if user intercepts fopen()
...
llvm-svn: 180182
2013-04-24 11:06:05 +00:00
Evgeniy Stepanov
44b75efab4
[sanitizer] Intercept inet_pton and inet_ntop.
...
llvm-svn: 180107
2013-04-23 14:05:15 +00:00
Alexey Samsonov
f36c5a8431
Revert r180082 and add a test for SetEnv function
...
llvm-svn: 180098
2013-04-23 12:49:12 +00:00
Evgeniy Stepanov
3076ba0a08
[sanitizer] Intercept getgrnam{_r}, getgrgid{_r}.
...
llvm-svn: 180091
2013-04-23 12:01:20 +00:00
Evgeniy Stepanov
0cd7cf8217
[msan] Allow clock_getres(, 0).
...
llvm-svn: 180090
2013-04-23 11:48:31 +00:00
Alexey Samsonov
e7540e3561
[Sanitizer] Delete unused function
...
llvm-svn: 180082
2013-04-23 08:18:09 +00:00
Evgeniy Stepanov
1a2262e1c9
[sanitizer] Fix lint.
...
llvm-svn: 180012
2013-04-22 13:28:26 +00:00
Alexey Samsonov
1a6cfb46e5
[Sanitizer] Rework r176802: share code between Printf and Report and simplify it a bit
...
llvm-svn: 179755
2013-04-18 13:18:23 +00:00
Alexey Samsonov
d1efa5ef96
[Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link
...
llvm-svn: 179754
2013-04-18 12:46:33 +00:00
Andy Gibbs
f6edda8c30
Wrap macro invocations in braces to supress 'suggest braces around empty body in an ‘if’ statement' warning.
...
llvm-svn: 179597
2013-04-16 15:18:55 +00:00
Evgeniy Stepanov
9b59a39f42
[sanitizer] Implement wait4 and waitpid syscall hooks.
...
llvm-svn: 179592
2013-04-16 13:06:20 +00:00
Evgeniy Stepanov
9fb82357dc
[sanitizer] More syscall handler placeholders.
...
This time it's the full list scavenged from syscalls.h
Fixed return value type.
llvm-svn: 179378
2013-04-12 14:06:40 +00:00
Timur Iskhodzhanov
664ec5d7a8
Finally drop the 'static' from INLINE and ALWAYS_INLINE
...
The ALWAYS_INLINE doesn't have static on POSIX anyways since r178341; the INLINE is only used in .h files, so shouldn't have been 'static' in the first place
llvm-svn: 179371
2013-04-12 09:37:20 +00:00
Evgeniy Stepanov
f5523116e9
[sanitizer] Syscall hooks.
...
Pre- and post- hooks for linux syscalls. Not wired into anything, but exposed
through public interface.
llvm-svn: 179288
2013-04-11 14:37:04 +00:00
Alexander Potapenko
227e22de5a
[ASan] Do not check the shadow of NULL argument in the time() interceptor.
...
Add a test for time().
llvm-svn: 179177
2013-04-10 15:13:00 +00:00
Evgeniy Stepanov
460067823b
[sanitizer] Interceptors for wait*.
...
llvm-svn: 179096
2013-04-09 14:34:59 +00:00
Evgeniy Stepanov
69967c2835
[msan] Intercept glob() with tests.
...
llvm-svn: 179091
2013-04-09 11:35:13 +00:00
Alexey Samsonov
7ad129277e
[Sanitizer] fix TSan tests: remove global ctor from sanitizer_common, run load_shared_lib test only in lit
...
llvm-svn: 179090
2013-04-09 07:46:20 +00:00
Kostya Serebryany
9d28efc1ad
[asan] relax Linux/zero-base-shadow.cc to make it pass on newer Ubuntu; fix lint
...
llvm-svn: 179088
2013-04-09 07:08:05 +00:00
Chandler Carruth
2b3c00eec7
Revert r179012: "[msan] Intercept glob()."
...
This was committed without tests and contains obvious bugs. That's not
acceptable. It broke address sanitizer for most programs using glob(3).
llvm-svn: 179054
2013-04-08 20:59:44 +00:00
Alexander Potapenko
32efd25b93
[libsymbolized] If we can't find an address in the list of shared libraries, try to reload it.
...
Add a regression test for the case where such behavior helps TSan:
1. race is reported in the main module
2. new shared library is loaded
3. race is reported in the shared library
llvm-svn: 179032
2013-04-08 17:46:34 +00:00
Evgeniy Stepanov
8cd707a1a6
[msan] Intercept glob().
...
llvm-svn: 179012
2013-04-08 09:03:00 +00:00
Evgeniy Stepanov
e20c780aaf
[tsan] Fix build.
...
llvm-svn: 179008
2013-04-08 08:46:25 +00:00
Kostya Serebryany
e6459977b8
[sanitizer] Fix boundary condition in LargeMmapAllocator::GetBlockBegin. Patch by Sergey Matveev
...
llvm-svn: 179007
2013-04-08 08:43:22 +00:00
Evgeniy Stepanov
7ba7207f1d
[msan] Intercept time().
...
llvm-svn: 179002
2013-04-08 08:25:22 +00:00
Kostya Serebryany
5b4267f7e7
[sanitizer] found a bug by code inspection: CHECK(a=b) instead of CHECK(a==b). Was puzzled why lint did not catch it. Turns out this check was disabled for asan source. fix all cases and enable the check
...
llvm-svn: 178872
2013-04-05 14:40:25 +00:00
Alexey Samsonov
2a4668557f
[Sanitizer] enquote the module name when passing it to external symbolizer
...
llvm-svn: 178864
2013-04-05 11:54:23 +00:00
Alexey Samsonov
46b8665ea4
Remove InternalAlloc/InternalFree calls from StopTheWorld. Patch by Sergey Matveev.
...
llvm-svn: 178855
2013-04-05 07:41:21 +00:00
Alexey Samsonov
734aab4066
[Sanitizer] Use a common mutex to prevent mixing reports from different sanitizers. This fixes PR15516
...
llvm-svn: 178853
2013-04-05 07:30:29 +00:00
Evgeniy Stepanov
24b2169e07
[sanitizer] Android lacks ucontext_t definition.
...
llvm-svn: 178756
2013-04-04 09:21:48 +00:00
Evgeniy Stepanov
7b0e132551
[sanitizer] Use ucontext_t instead of "struct ucontext".
...
Fixes Mac build.
llvm-svn: 178755
2013-04-04 09:03:56 +00:00
Evgeniy Stepanov
1f8b3538b4
[msan] Unpoison siginfo_t and ucontext_t in signal handlers.
...
Add wrappers for all user signal handlers to unpoison the handler's arguments.
llvm-svn: 178754
2013-04-04 08:22:52 +00:00
Kostya Serebryany
c3525ce6ac
[sanitizer] while doing fast unwinding make sure that the frame pointer is aligned; fix lint
...
llvm-svn: 178747
2013-04-04 06:52:40 +00:00
Alexey Samsonov
87c2a87b50
[Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.
...
llvm-svn: 178640
2013-04-03 13:22:54 +00:00
Alexey Samsonov
60adc1781e
[Sanitizer] Be more careful with arch-specific defines in StopTheWorld code
...
llvm-svn: 178630
2013-04-03 08:26:03 +00:00
Alexey Samsonov
a0e28a7aaa
[Sanitizer] Kill the remainders of platform defines in favor of SANITIZER_ defines
...
llvm-svn: 178627
2013-04-03 07:24:35 +00:00
Alexey Samsonov
8d18cc3096
[Sanitizer] Fix StopTheWorld includes on Android. Patch by Sergey Matveev.
...
llvm-svn: 178625
2013-04-03 07:06:10 +00:00
Evgeniy Stepanov
f8213b4eb3
[sanitizer] More interceptors.
...
getpwnam, getpwuid, getpwnam_r, getpwuid_r, clock_getres, clock_gettime,
clock_settime, getitimer, setitimer, sigaction (MSan).
llvm-svn: 178465
2013-04-01 14:47:21 +00:00
Alexander Potapenko
1d021bff28
[libsanitizer] Run the callback on a separate stack in StopTheWorld.
...
Currently the callback runs on the caller's stack. If this stack
contains values that have gone out of scope, and we are not super careful, those
values can propagate into global variables (the libc sigaction() in particular
has a side effect that can lead to this). This has caused false negatives in
leak checking code.
Changes: map a separate stack space for the tracer thread. Also, move some
globals into local scope (they had no business being global anyway).
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178464
2013-04-01 14:38:56 +00:00
Alexander Potapenko
401bed0b9a
[libsanitizer] Added data() and capacity() getters to InternalVector.
...
Same interface as in STL. Needed for LSan.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178463
2013-04-01 13:55:34 +00:00
Alexander Potapenko
9cc2e436bb
[libsanitizer] Add register dumping support to SuspendedThreadsList.
...
An interface for obtaining register contexts from suspended threads. Tailored
for LSan use.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178461
2013-04-01 13:36:42 +00:00
Kostya Serebryany
91952cda76
[tsan] restore performance critical inlining in tsan: remove static from ALWAYS_INLINE, use ALWAYS_INLINE USED for critical functions.
...
llvm-svn: 178341
2013-03-29 09:44:16 +00:00
Alexey Samsonov
703a9870a2
[Sanitizer] Follow-up for r178238 - replace DCHECKs with regular CHECKs
...
llvm-svn: 178336
2013-03-29 08:03:01 +00:00
Timur Iskhodzhanov
e3164e9647
Add "static" to the Windows ALWAYS_INLINE macro (similar to what we do on POSIX)
...
llvm-svn: 178296
2013-03-28 22:07:28 +00:00
Timur Iskhodzhanov
a6788325cf
Make all the ALWAYS_INLINE users Windows-friendly; also, avoid ALWAYS_INLINE INLINE combinations
...
llvm-svn: 178266
2013-03-28 18:52:40 +00:00
Alexey Samsonov
cfe56d47da
[Sanitizer] Minor enhancements in InternalVector container
...
llvm-svn: 178238
2013-03-28 15:37:11 +00:00
Alexey Samsonov
e586170e86
Fix unmatching ASan runtime flag for init-order checking exposed by r178158. Add a test for r178158.
...
llvm-svn: 178229
2013-03-28 09:11:20 +00:00
Dmitry Vyukov
fd3f5ec0cb
tsan: better flag parsing: do not confuse flag that is a part of another flag
...
(e.g. suppressions and print_suppressions)
llvm-svn: 178158
2013-03-27 17:59:13 +00:00
Dmitry Vyukov
9f08fe5065
tsan: fix lint warning
...
llvm-svn: 178157
2013-03-27 17:57:58 +00:00
Alexander Potapenko
29310ba077
[libsanitizer] Fix the Win build.
...
llvm-svn: 178012
2013-03-26 13:02:11 +00:00
Dmitry Vyukov
6f4b34bcf4
asan/tsan: move strcasecmp() interceptor to sanitizer_common
...
llvm-svn: 178010
2013-03-26 12:40:23 +00:00
Dmitry Vyukov
f3bc56bb6b
asan/tsan: change SANITIZER_GO to more general SANITIZER_SUPPORTS_WEAK_HOOKS
...
llvm-svn: 178009
2013-03-26 12:07:04 +00:00
Alexander Potapenko
f8109dd0f8
[libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add
...
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178000
2013-03-26 10:34:37 +00:00
Alexey Samsonov
7ef76c1cd8
[Sanitizer] Disable atomic_test on Android, where it crashes Clang.
...
llvm-svn: 177998
2013-03-26 08:55:38 +00:00
Timur Iskhodzhanov
2dee3dd61c
Add a GetTid() implementation for Windows
...
llvm-svn: 177927
2013-03-25 22:04:29 +00:00
Dmitry Vyukov
7886253fee
asan/tsan: add Printf/Report hook
...
The hook can be overriden in frontend to print to e.g. a file.
llvm-svn: 177864
2013-03-25 12:58:09 +00:00
Alexey Samsonov
acfb82e611
[Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.
...
llvm-svn: 177860
2013-03-25 10:31:49 +00:00
Dmitry Vyukov
510ad11800
tsan: add SetEnv() function that can be used in frontends
...
llvm-svn: 177857
2013-03-25 09:56:45 +00:00
Alexey Samsonov
a208c397bf
[Sanitizer] First effort to implement atomic_compare_exchange for 1-byte vars on Windows
...
llvm-svn: 177854
2013-03-25 09:23:30 +00:00
Alexey Samsonov
c6fd019c77
[Sanitizer] Add basic test for atomic_compare_exchange implementation
...
llvm-svn: 177851
2013-03-25 08:48:16 +00:00
Dmitry Vyukov
78693730a4
tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
...
llvm-svn: 177627
2013-03-21 06:24:31 +00:00
Richard Smith
e86b7b0bb9
Split ubsan runtime into three pieces (compiler-rt part):
...
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other
sanitizer runtime is present.
* libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on
a C++ ABI library, and is always linked in.
* libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a
C++ ABI library, and is only linked in when linking a C++ binary.
The Darwin ubsan runtime is unchanged.
For more details, see Clang change r177605.
llvm-svn: 177606
2013-03-20 23:49:17 +00:00
Dmitry Vyukov
b6eace8a2f
tsan: add internal_unlink() function
...
llvm-svn: 177510
2013-03-20 10:28:36 +00:00
Dmitry Vyukov
31056968fc
asan/tsan: reduce per-thread memory allocator caches
...
256 blocks (which is 512 in reallity) seems to be too big cache,
reducing the size reduces memory consumption but does not degrade performance.
llvm-svn: 177502
2013-03-20 09:26:46 +00:00
Evgeniy Stepanov
52b2d13245
[sanitizer] Enable prctl interceptor on Android.
...
llvm-svn: 177497
2013-03-20 07:35:52 +00:00
Evgeniy Stepanov
95eaa21637
[sanitizer] More renamed macros.
...
llvm-svn: 177401
2013-03-19 14:54:17 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov
d3b56605f1
[sanitizer] Move ASan platform macros to sanitizer_common and rename them appropriately.
...
llvm-svn: 177397
2013-03-19 13:54:41 +00:00
Dmitry Vyukov
082afc8346
tsan: fix build
...
llvm-svn: 177395
2013-03-19 13:34:12 +00:00
Dmitry Vyukov
4ecfa696e0
tsan: flush dead thread info earlier (when another thread is finished rather than new thread is created)
...
llvm-svn: 177394
2013-03-19 12:25:48 +00:00
Dmitry Vyukov
29f335ae80
tsan: symbolizer "flush caches" functinality
...
llvm-svn: 177388
2013-03-19 10:23:17 +00:00
Evgeniy Stepanov
6d02c1c598
[sanitizer] Avoid use of uintptr_t.
...
llvm-svn: 177384
2013-03-19 09:39:15 +00:00
Evgeniy Stepanov
b4a218db34
[sanitizer] Don't adjust the size of the user-allocated stack.
...
Moved this code to sanitizer_common.
llvm-svn: 177383
2013-03-19 09:30:52 +00:00
Dmitry Vyukov
49e462fab2
tsan: fix clang -Wall build
...
Clang does not like classes with virtual functions but w/o virtual dtor.
Go does not like libstdc++ (operator delete).
llvm-svn: 177267
2013-03-18 10:10:15 +00:00
Dmitry Vyukov
50160030e1
tsan: fix Go build
...
llvm-svn: 177260
2013-03-18 08:52:46 +00:00
Dmitry Vyukov
6f7ca81cce
tsan: fix huge stack frames
...
llvm-svn: 177255
2013-03-18 08:09:42 +00:00
Dmitry Vyukov
0f2c7ea5d0
tsan: fix lint warnings
...
llvm-svn: 177251
2013-03-18 07:58:20 +00:00
Alexey Samsonov
f9dbbda5bc
[Sanitizer] Get rid of global mutexes in StopTheWorld implementation
...
llvm-svn: 177246
2013-03-18 06:27:13 +00:00
Alexey Samsonov
e25c72958a
[Sanitizer] Rely on template argument deduction in sanitizer_allocator_test
...
llvm-svn: 177245
2013-03-18 06:07:44 +00:00
Alexander Potapenko
845b575370
[libsanitizer] StopTheWorld in sanitizer_common
...
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.
Linux implementation provided.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177156
2013-03-15 14:37:21 +00:00
Alexey Samsonov
3a6b6b9d55
[Sanitizer] Don't intercept frexpf and frexpl on Windows. Add frexp declaration to asan_intercepted_functions.h
...
llvm-svn: 177155
2013-03-15 14:02:21 +00:00
Alexey Samsonov
e4385c4b98
[Sanitizer] Don't link tests with -lpthread on Android.
...
llvm-svn: 177151
2013-03-15 12:54:01 +00:00
Kostya Serebryany
96a7620f3a
[sanitizer] fix gcc build warnings
...
llvm-svn: 177149
2013-03-15 12:27:52 +00:00
Kostya Serebryany
b941a2fca4
[asan] Add ForEachChunk() to sanitizer allocators. Patch by Sergey Matveev
...
llvm-svn: 177147
2013-03-15 11:39:41 +00:00
Alexey Samsonov
cdd46d9ccc
[Sanitizer] Generalize compile/link flags for sanitizer_common tests on Android and on other platforms.
...
llvm-svn: 177146
2013-03-15 10:39:26 +00:00
Alexey Samsonov
337b0fcf9c
[Sanitizer] Build sanitizer_common tests w/o RTTI. Move ThreadRegistry class members below methods.
...
llvm-svn: 177143
2013-03-15 07:08:52 +00:00
Eric Christopher
d3c993b396
Fix a virtual destructor warning.
...
Patch by Manuel Klimek!
llvm-svn: 177132
2013-03-15 00:20:17 +00:00
Alexey Samsonov
d1999a1ccc
[Sanitizer] Fix compiler warnings and style issues in sanitizer_common tests. Use -Werror=sign-compare when building them.
...
llvm-svn: 177077
2013-03-14 15:15:35 +00:00
Alexey Samsonov
1cb684381a
[Sanitizer] Add generic ThreadRegistry class for sanitizer runtimes. This class holds basic thread bookkeeping logic and allows specific sanitizer runtimes to create thread contexts and mark threads as created/running/joined etc. The class is based on the way we currently store thread contexts in TSan.
...
llvm-svn: 177074
2013-03-14 13:54:30 +00:00
Alexey Samsonov
a097f7b1e3
[Sanitizer] Add default constructor for BlockingMutex
...
llvm-svn: 177072
2013-03-14 13:30:56 +00:00
Evgeniy Stepanov
8d487b4407
[sanitizer] No dirent64 on Android.
...
llvm-svn: 177071
2013-03-14 13:24:03 +00:00
Alexey Samsonov
3d09fdbf21
[Sanitizer] Build sanitizer_common with -fno-rtti
...
llvm-svn: 177070
2013-03-14 13:16:35 +00:00
Kostya Serebryany
d332d42372
[asan] remove one redundant malloc stress test, unify the usage of ASAN_LOW_MEMORY macro in tests, slightly reduce test memory usage (all to make 32-bit runs consume less RAM)
...
llvm-svn: 177069
2013-03-14 13:16:09 +00:00
Alexander Potapenko
34e1171768
[libsanitizer] fixed a bug in ThreadLister tests where we forgot to terminate one thread
...
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177068
2013-03-14 13:15:14 +00:00
Evgeniy Stepanov
740e6ebe71
[msan] Add changes missing from r177065.
...
llvm-svn: 177067
2013-03-14 13:13:49 +00:00
Alexander Potapenko
ac3bbb3ef3
[libsanitizer] Fixed incorrect handling of pre-existing threads in ThreadLister test.
...
Also, extended the test to check that ThreadLister::Reset() works as intended.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177060
2013-03-14 12:06:54 +00:00
Evgeniy Stepanov
231894a902
[sanitizer] Intercept frexp and friends.
...
llvm-svn: 177056
2013-03-14 11:34:39 +00:00
Alexey Samsonov
7d2385419a
[Sanitizer] fix compilation for Windows
...
llvm-svn: 177054
2013-03-14 11:29:06 +00:00
Alexey Samsonov
83e7622df6
[Sanitizer] Write a slightly better implementation of GetEnv() function on Windows
...
llvm-svn: 177051
2013-03-14 11:10:23 +00:00
Evgeniy Stepanov
96f82f8ac3
[sanitizer] Fix lint.
...
llvm-svn: 176943
2013-03-13 10:20:35 +00:00
Evgeniy Stepanov
98f5ea0dba
[msan] Increase stack size as required.
...
Adjust stack size in pthread_attr_t when the app-requested size does not fit MSan TLS.
llvm-svn: 176939
2013-03-13 09:01:40 +00:00
Evgeniy Stepanov
5697b58ec4
[sanitizer] Move GetTlsSize code from TSan to sanitizer_common.
...
llvm-svn: 176938
2013-03-13 08:19:53 +00:00
Evgeniy Stepanov
24aad9c0cb
Break a >80 char line.
...
llvm-svn: 176937
2013-03-13 08:17:39 +00:00
Alexey Samsonov
91f833a413
[Sanitizer] Fixup for r176931 for Mac and Windows
...
llvm-svn: 176935
2013-03-13 07:39:25 +00:00
Alexey Samsonov
d38aceda4e
[Sanitizer] Fix a typo in function name
...
llvm-svn: 176932
2013-03-13 06:55:02 +00:00
Alexey Samsonov
06d3aa4884
[Sanitizer] Change MemoryMappingLayout methods to also report memory protection flags (for future use in leak checker). Patch by Sergey Matveev.
...
llvm-svn: 176931
2013-03-13 06:51:02 +00:00
Kostya Serebryany
138b155042
[sanitizer] use fewer size classes in the allocator to reduce the memory footprint. There is no all-size-fits-all constant here, but this change is positive or neutral on several large apps I've tested
...
llvm-svn: 176855
2013-03-12 08:44:40 +00:00
Kostya Serebryany
ba56c8d4f9
[sanitizer] simplify the allocator's SizeClassMap: do not require an extra template parameter, instead compute it in flight. No functionality change
...
llvm-svn: 176853
2013-03-12 07:01:27 +00:00
Alexey Samsonov
db7d9656bb
[Sanitizer] Implement BlockingMutex::CheckLocked()
...
llvm-svn: 176805
2013-03-11 15:45:20 +00:00
Alexander Potapenko
1f78ad5da4
[ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime.
...
llvm-svn: 176804
2013-03-11 13:36:39 +00:00
Alexander Potapenko
18c916c6c5
[ASan] Try to use a small (512 bytes) stack-local buffer in Report() for short messages, fall back to MmapOrDie() in the case of a failure.
...
This shall eliminate most of the cryptic "ERROR: failed to mmap" messages caused by recursively calling MmapOrDie() from MmapOrDie().
llvm-svn: 176802
2013-03-11 11:47:43 +00:00
Alexander Potapenko
92cc1a6d24
[ASan] don't call strerr from functions that map memory, since this results in malloc().
...
llvm-svn: 176800
2013-03-11 10:21:28 +00:00
Kostya Serebryany
0f5c20b417
[sanitizer] make SizeClassAllocator64::GetBlockBegin more bullet proof (by Sergey Matveev)
...
llvm-svn: 176799
2013-03-11 09:43:12 +00:00
Reid Kleckner
c193da57b8
[msan] pthread_join() returns int, not void*
...
pthread_join() returns an error code, not the result of the
pthread_create() function like I thought.
llvm-svn: 176554
2013-03-06 15:41:35 +00:00
Reid Kleckner
66c26e5e96
[sanitizers] Fix check failure on dealloc from new thread
...
Summary:
Adds a test for this case, which was reduced from a chromium build of
WebKit's DumpRenderTree.
Reviewers: eugenis
CC: glider
Differential Revision: http://llvm-reviews.chandlerc.com/D495
llvm-svn: 176552
2013-03-06 14:54:08 +00:00
Alexey Samsonov
dcb0e72e6f
[Sanitizer] fix signed-unsigned mismatch in test and use correct order of EXPECT_EQ() args
...
llvm-svn: 176479
2013-03-05 12:23:07 +00:00
Alexey Samsonov
434dde9996
[Sanitizer] Add methods back() and pop_back() to InternalVector. Patch by Sergey Matveev
...
llvm-svn: 176478
2013-03-05 11:58:25 +00:00
Evgeniy Stepanov
323771b3f1
[sanitizer] Fix check failure in SizeClassMap::Print.
...
llvm-svn: 176338
2013-03-01 08:49:14 +00:00
Alexey Samsonov
4a3234bec5
[Sanitizer] Relax ThreadLister tests to allow possible pre-existing threads. Do proper mutex destruction. Patch by Sergey Matveev
...
llvm-svn: 176249
2013-02-28 11:33:51 +00:00
Alexey Samsonov
49b86b354a
[Sanitizer] don't include missing header on Android
...
llvm-svn: 176183
2013-02-27 13:03:35 +00:00
Alexey Samsonov
46a36d5019
[UBSan] Use common report decorator to print colorful diagnostics in UBSan, and be more consistent w/ Printf/RawWrite
...
llvm-svn: 176182
2013-02-27 12:58:24 +00:00
Kostya Serebryany
f0b8f989e9
add Linux syscall wrappers and ThreadLister to sanitizer_common
...
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev
llvm-svn: 176179
2013-02-27 11:22:40 +00:00
Kostya Serebryany
c98cddd024
[asan] guard ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS definition with an #ifndef
...
llvm-svn: 176175
2013-02-27 08:28:24 +00:00
Alexey Samsonov
086b940b1e
[Sanitizer] Don't die if external symbolizer is used on Mac, where it's not implemented yet
...
llvm-svn: 176091
2013-02-26 13:40:51 +00:00
Kostya Serebryany
a8cfb900dd
[sanitizer] A low-level vector implementation to be used in leak checking code. Patch by Sergey Matveev
...
llvm-svn: 176089
2013-02-26 13:30:27 +00:00
Kostya Serebryany
459df6f167
[asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
...
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Kostya Serebryany
c8ac15a66b
[asan] use the new attribute syntax (no_address_safety_analysis => no_sanitize_address)
...
llvm-svn: 176077
2013-02-26 07:01:06 +00:00
Alexey Samsonov
54ff0f6388
[Sanitizer] one more fix for signed/unsigned mismatch in comparison
...
llvm-svn: 176020
2013-02-25 14:06:38 +00:00
Alexey Samsonov
b2ac280f96
[Sanitizer] fix signed/unsigned compare warnings in sanitizer_stacktrace_test. Build sanitizer_common tests with -Werror as we use predictable just-built Clang for building them
...
llvm-svn: 176014
2013-02-25 09:00:03 +00:00
Reid Kleckner
e1596856ec
[Sanitizer] Add a test for the fast unwinder
...
Summary:
The test sets up fake x86-style fp+retaddr frames, since that's all the
unwinder works with.
Reviewers: kcc
CC: eugenis
Differential Revision: http://llvm-reviews.chandlerc.com/D445
llvm-svn: 175893
2013-02-22 15:10:16 +00:00
Reid Kleckner
15f2d1f4be
[Sanitizer] Try to fix infinite loop in frame pointer unwinder
...
Using > instead of >= ensures that each frame deref makes progress and
that we eventually terminate.
Issue: https://code.google.com/p/address-sanitizer/issues/detail?id=162
llvm-svn: 175661
2013-02-20 20:29:48 +00:00
Alexander Potapenko
56821acc79
[ASan] Make isoc99_*scanf intercepted on Linux only. Those are unavailable on Darwin.
...
llvm-svn: 175629
2013-02-20 15:27:58 +00:00
Alexey Samsonov
aadd1f2ad6
[Sanitizer] use raw syscall instead of _exit() function on Linux
...
llvm-svn: 175622
2013-02-20 13:54:32 +00:00
Evgeniy Stepanov
ec1d286111
[sanitizer] Fix lint.
...
llvm-svn: 175615
2013-02-20 11:06:07 +00:00
Evgeniy Stepanov
2e50efd484
[sanitizer] Fix FileOps test on Android.
...
llvm-svn: 175515
2013-02-19 15:01:05 +00:00
Evgeniy Stepanov
477e88ee9e
[sanitizer] Slightly lower allocator test memory consumption.
...
This way it fits on a random 1G device.
llvm-svn: 175513
2013-02-19 13:38:27 +00:00
Alexey Samsonov
99b81b4bbe
[Sanitizer] Allow runtime flags be separated by colon as well as space
...
llvm-svn: 175511
2013-02-19 13:03:37 +00:00
Kostya Serebryany
9f298da9bd
[asan] instrument memory accesses with unusual sizes
...
This patch makes asan instrument memory accesses with unusual sizes (e.g. 5 bytes or 10 bytes), e.g. long double or
packed structures.
Instrumentation is done with two 1-byte checks
(first and last bytes) and if the error is found
__asan_report_load_n(addr, real_size) or
__asan_report_store_n(addr, real_size)
is called.
asan-rt part
Also fix lint.
llvm-svn: 175508
2013-02-19 11:30:25 +00:00
Evgeniy Stepanov
adaca58526
[msan] Fix ReExec on linux.
...
execle(argv[0], ...) is wrong, because argv[0] may contain a PATH-resolvable
program name. Execute /proc/self/exe instead.
llvm-svn: 175504
2013-02-19 11:09:29 +00:00
Evgeniy Stepanov
3e2e32c618
[sanitizer] Fix Android build.
...
llvm-svn: 175503
2013-02-19 11:06:41 +00:00
Evgeniy Stepanov
ea61d08185
[sanitizer] Add interceptors for localtime and friends.
...
llvm-svn: 175499
2013-02-19 09:19:16 +00:00
Alexey Samsonov
9211bd33ec
[Sanitizer] Make temporary filename depend on user ID
...
llvm-svn: 175424
2013-02-18 07:17:12 +00:00
Kostya Serebryany
fd61b6f0c8
[asan] make asan work with 7fff8000 offset and prelink
...
When prelink is installed in the system, prelink-ed
libraries map between 0x003000000000 and 0x004000000000 thus occupying the shadow Gap,
so we need so split the address space even further, like this:
|| [0x10007fff8000, 0x7fffffffffff] || HighMem ||
|| [0x02008fff7000, 0x10007fff7fff] || HighShadow ||
|| [0x004000000000, 0x02008fff6fff] || ShadowGap3 ||
|| [0x003000000000, 0x003fffffffff] || MidMem ||
|| [0x00087fff8000, 0x002fffffffff] || ShadowGap2 ||
|| [0x00067fff8000, 0x00087fff7fff] || MidShadow ||
|| [0x00008fff7000, 0x00067fff7fff] || ShadowGap ||
|| [0x00007fff8000, 0x00008fff6fff] || LowShadow ||
|| [0x000000000000, 0x00007fff7fff] || LowMem ||
Do it only if necessary.
Also added a bit of profiling code to make sure that the
mapping code is efficient.
Added a lit test to simulate prelink-ed libraries.
Unfortunately, this test does not work with binutils-gold linker.
If gold is the default linker the test silently passes.
Also replaced
__has_feature(address_sanitizer)
with
__has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
in two places.
Patch partially by Jakub Jelinek.
llvm-svn: 175263
2013-02-15 12:00:24 +00:00
Evgeniy Stepanov
2a25bfe06a
[sanitizer] Get full argv and envp on glibc.
...
/proc/$PID/cmdline is clipped to 4Kb.
Locate argv and envp on the main thread stack.
llvm-svn: 175163
2013-02-14 14:40:03 +00:00
Evgeniy Stepanov
763b2981b4
[sanitizer] Raise argv limit for ReExec.
...
We are still limited by /proc/*/cmdline size (4Kb max on Linux!).
llvm-svn: 175145
2013-02-14 08:22:06 +00:00
Evgeniy Stepanov
71a4ab7141
[sanitizer] Tests for scanf parser in allowGnuMalloc=false mode.
...
llvm-svn: 174971
2013-02-12 14:37:55 +00:00
Evgeniy Stepanov
b5ec3a2d55
[sanitizer] More accurate scanf parsing without GNU extensions.
...
In __isoc99_*scanf we don't have to worry about GNUisms, and can parse
%a accurately.
Patch by Jakub Jelinek.
llvm-svn: 174969
2013-02-12 14:29:34 +00:00
Evgeniy Stepanov
5fa8fb7d91
[sanitizer] Intercept __isoc99_*scanf.
...
llvm-svn: 174960
2013-02-12 11:34:52 +00:00
Evgeniy Stepanov
154faa6ded
[sanitizer] clang-format pass over scanf code.
...
llvm-svn: 174888
2013-02-11 15:22:34 +00:00
Evgeniy Stepanov
455c72d25e
[sanitizer] scanf: don't report stores that did not happen.
...
Respect REAL(scanf) return value and don't report memory stores that
could potentially happen, but did not.
llvm-svn: 174887
2013-02-11 15:16:48 +00:00
Evgeniy Stepanov
5eb25e8d39
[sanitizer] Remove an extra va_copy.
...
llvm-svn: 174883
2013-02-11 14:08:12 +00:00
Evgeniy Stepanov
7e0430fe4f
[sanitizer] Scanf parser improvements.
...
Handle %a in cases when it is unambiguous.
Handle %m.
Patch by Jakub Jelinek.
llvm-svn: 174882
2013-02-11 14:04:24 +00:00
Evgeniy Stepanov
60a8e5b9b7
[sanitizer] Fix lint.
...
llvm-svn: 174708
2013-02-08 12:13:43 +00:00
Timur Iskhodzhanov
167f9e4395
[ASan] Switch Windows to allocator v2, also fixing some build errors
...
llvm-svn: 174707
2013-02-08 12:02:00 +00:00
Timur Iskhodzhanov
659bca56a7
[ASan] Move functions using BitScan/clzl to sanitizer_common
...
llvm-svn: 174706
2013-02-08 11:45:04 +00:00
Evgeniy Stepanov
e6045b4603
[sanitizer] Add 2 random tests for the scanf implementation.
...
llvm-svn: 174705
2013-02-08 11:19:23 +00:00
Evgeniy Stepanov
87c43537df
[sanitizer] Improve scanf interceptor
...
This a rewrite of the scanf parser. The new implementation is pretty close to
the spec, with a few shortcuts taken here and there. It is conservative, i.e.
it gives up parsing if it does not understand some part of the format string,
or runs into an ambiguous % spec. It does not handle some rarely used parts of
the spec, like %n$ - for now.
I'm also moving parser call to after the original *scanf function completes,
so that we can find out the store size of %s directive by the use of strlen()
on the target buffer.
llvm-svn: 174704
2013-02-08 11:17:20 +00:00
Kostya Serebryany
39675fe9c8
[sanitizer] always allocate 16-byte aligned chunks of memory
...
llvm-svn: 174617
2013-02-07 15:04:06 +00:00
Alexander Potapenko
109aa04ea9
[sanitizer_common] Fix lint warnings.
...
llvm-svn: 174616
2013-02-07 14:58:04 +00:00
Alexander Potapenko
07c740e213
[ASan] Fix a compilation warning.
...
llvm-svn: 174604
2013-02-07 12:00:40 +00:00
Alexander Potapenko
f444a49310
[ASan] Implement asan_mz_size(), asan_mz_force_lock() and asan_mz_force_unlock() for allocator2.
...
Switch to allocator2 on Darwin.
llvm-svn: 174603
2013-02-07 11:40:03 +00:00
Kostya Serebryany
7b0b9b3b65
[msan] add strip_path_prefix flag; print error summary; don't crash while printing summary if debug info is missing. The tests will follow later once we establish the lit-like tests for msan.
...
llvm-svn: 174595
2013-02-07 08:04:56 +00:00
Alexander Potapenko
d895ae94f9
Use 64-bit inodes in file operations. ASan is now built with -mmacosx-version-min=10.5, thus the default inode
...
size is 32 bits. However the supported client code is going to target 10.6 and higher, where 64-bit inodes will be used.
llvm-svn: 174507
2013-02-06 14:41:15 +00:00
Kostya Serebryany
4fb340d972
[tsan] print error summary line
...
llvm-svn: 174505
2013-02-06 14:24:00 +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
Dmitry Vyukov
fa67ed47e1
asan/tsan: fix failing CHECK on windows
...
llvm-svn: 174319
2013-02-04 10:42:38 +00:00
Alexey Samsonov
576e270287
[Sanitizer] use proper casting in *stat functions on Mac
...
llvm-svn: 174318
2013-02-04 10:31:39 +00:00
Alexey Samsonov
2c5cbd2b38
[Sanitizer] extend internal libc with stat/fstat/lstat functions
...
llvm-svn: 174316
2013-02-04 10:16:50 +00:00
Dmitry Vyukov
7981ea8baa
asan/tsan: fix compilation errors/bugs on Windows where long is 32-bit even in 64-bit mode
...
llvm-svn: 174312
2013-02-04 08:07:45 +00:00
Alexey Samsonov
4985b8766e
[Sanitizer] use u32 instead of mode_t, which is defined in Darwin headers
...
llvm-svn: 174189
2013-02-01 16:32:18 +00:00
Alexey Samsonov
39313b780d
[Sanitizer] make internal_open have the same interface as libc version
...
llvm-svn: 174187
2013-02-01 15:58:46 +00:00
Kostya Serebryany
bda64b4d40
[sanitizer] make the error messages from sanitizer_common contain the actual tool name
...
llvm-svn: 174059
2013-01-31 14:11:21 +00:00
Dmitry Vyukov
00e0236665
asan/tsan: manually define FUTEX constants, because <linux/futes.h> header is broken on some linux distributions
...
llvm-svn: 173933
2013-01-30 14:39:27 +00:00
Alexey Samsonov
c500132a93
[Sanitizer] Add change missed in r173926
...
llvm-svn: 173929
2013-01-30 13:19:15 +00:00
Evgeniy Stepanov
358698279d
[sanitizer] Further split private and public sanitizer headers.
...
And make msan_interface.h C-compatible.
llvm-svn: 173928
2013-01-30 13:12:08 +00:00
Alexey Samsonov
49a32c1d08
[Sanitizer] update style checker script and fix namespace style warnings
...
llvm-svn: 173910
2013-01-30 07:45:58 +00:00
Dmitry Vyukov
0632dd410c
tsan: fix the message (tsan is not asan)
...
llvm-svn: 173784
2013-01-29 09:39:58 +00:00
Dmitry Vyukov
7943b69002
tsan: add IsSymbolizerAvailable() function for querying for presence of internal/external symbolizer
...
llvm-svn: 173783
2013-01-29 09:35:14 +00:00
Timur Iskhodzhanov
6cff9deb16
Use the correct order of NOINLINE vs ret type to fix Windows build
...
llvm-svn: 173694
2013-01-28 17:29:50 +00:00
Alexey Samsonov
5311754b62
[CMake] Fix compiler-rt tests after r173617
...
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
Alexey Samsonov
622a7b2408
[Sanitizer] More fixes to scanf interceptor: stub support for %s, support for %[...] directive
...
llvm-svn: 173451
2013-01-25 15:26:19 +00:00
Kostya Serebryany
c1056f90ae
[sanitizer] improve the calloc overflow check (spotted by samsonov@)
...
llvm-svn: 173443
2013-01-25 12:22:21 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +00:00
Alexey Samsonov
4899fb5cfb
[Sanitizer] fix errors in scanf interceptors: add support for %c and fix cases like %5d
...
llvm-svn: 173440
2013-01-25 11:43:32 +00:00