Evgeniy Stepanov
b9c1020696
[sanitizer] Replace ext2_ ioctls with generic fs_ ioctls.
...
They are actually the same, but ext2_fs.h header is not available in userspace
with newer kernels.
llvm-svn: 184184
2013-06-18 09:49:04 +00:00
Evgeniy Stepanov
8fa046e288
[sanitizer] Symbolic ioctl names.
...
Replace hardcoded ioctl request ids with symbolic names.
Disable certain ioctls on platforms where such names are not found in the
system headers.
Fix a bug in ioctl_lookup.
Reenable ioctl test on Mac.
llvm-svn: 184183
2013-06-18 09:22:24 +00:00
Alexey Samsonov
b0d92b3312
[Sanitizer] Rename InternalVector to InternalMmapVector
...
llvm-svn: 183972
2013-06-14 09:59:40 +00:00
Alexey Samsonov
bc1c6714f2
[Sanitizer] add file forgotten in r183730
...
llvm-svn: 183732
2013-06-11 08:14:24 +00:00
Alexey Samsonov
c8e7364763
[Sanitizer] support running external llvm-symbolizer on Mac
...
llvm-svn: 183730
2013-06-11 08:13:36 +00:00
Dmitry Vyukov
7e4a18c4fb
tsan: fix merge bug
...
llvm-svn: 183648
2013-06-10 11:11:29 +00:00
Kostya Serebryany
e71982d589
[asan] fix the bug with memalign and malloc_usable_size ( http://code.google.com/p/address-sanitizer/issues/detail?id=193 ); also fix lint
...
llvm-svn: 183647
2013-06-10 10:46:27 +00:00
Dmitry Vyukov
b278f1235f
tsan: fix windows crash (incorrect stack boundaries)
...
llvm-svn: 183646
2013-06-10 10:30:54 +00:00
Dmitry Vyukov
e979c5467c
tsan: fix windows mingw build
...
llvm-svn: 183644
2013-06-10 10:02:02 +00:00
Dmitry Vyukov
50ef53ebfc
tsan: fix lint warnings
...
llvm-svn: 183642
2013-06-10 10:00:54 +00:00
Bill Wendling
658fb53b7e
Reverting r183529:
...
This is causing the following error on Darwin:
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:282:1: error: 'assertion_failed__282' declared as an array with a negative size
CHECK_TYPE_SIZE(ifconf);
^~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:223:3: note: expanded from macro 'CHECK_TYPE_SIZE'
COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:239:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:245:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:284:1: error: 'assertion_failed__284' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ifconf, ifc_ifcu);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:228:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:239:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Sandbox/llvm-clean.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:245:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^~~~~~~~~~~~~~~
llvm-svn: 183557
2013-06-07 20:28:29 +00:00
Evgeniy Stepanov
cead69d4a3
[sanitizer] Handle SIOCGIFCONF ioctl.
...
llvm-svn: 183529
2013-06-07 15:49:38 +00:00
Evgeniy Stepanov
c24e13e7bb
[sanitizer] Fix Android build.
...
llvm-svn: 183523
2013-06-07 14:56:54 +00:00
Evgeniy Stepanov
74dcb1a8de
[sanitizer] Fix windows build.
...
llvm-svn: 183518
2013-06-07 13:19:33 +00:00
Evgeniy Stepanov
0b1f41b6f4
[sanitizer] ioctl interceptor.
...
ASan: disabled by default
MSan: enabled by default
TSan: disabled
llvm-svn: 183517
2013-06-07 13:00:47 +00:00
Sergey Matveev
db356560fc
[sanitizer] Do not fall back to SlowUnwindStack() in GetStackTrace()
...
llvm-svn: 183414
2013-06-06 14:19:36 +00:00
Sergey Matveev
ecc4f5ba8e
[lsan] Implement __lsan_ignore_object().
...
Leak annotation similar to HeapChecker's IgnoreObject().
llvm-svn: 183412
2013-06-06 14:17:56 +00:00
Dmitry Vyukov
ce0247c93e
tsan: fix darwin Go crashes
...
llvm-svn: 183405
2013-06-06 13:20:40 +00:00
Dmitry Vyukov
c9e304afbd
tsan: fix darwin Go build
...
llvm-svn: 183402
2013-06-06 13:00:32 +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
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
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
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
Timur Iskhodzhanov
cc61eefd4b
Fix MSVC W3 compiler warnings
...
llvm-svn: 182857
2013-05-29 14:11: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
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
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
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