Commit Graph

2244 Commits

Author SHA1 Message Date
Sergey Matveev ffe38d267c Quick fix for ASan test build on Android.
llvm-svn: 181429
2013-05-08 14:11:12 +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
Peter Collingbourne 5829a98c48 [nolibc] Disable the GCC stack protector when building sanitizer runtimes.
This is the first in a sequence of changes designed to eliminate the
libc dependency in sanitizer_common.  The main motivation for these
changes is to be able to provide an alternative for the current
interceptor-based technique for instrumenting functions in libc.
In this new technique, we compile libc with instrumentation.  This has
the potential advantages of being more accurate than interception and
reducing the amount of custom code required for each libc function.
As a side effect of this, we cannot depend on libc in the sanitizer
runtime due to mutual dependency issues.

This change disables the GCC stack protector, which introduces a libc
dependency and is enabled by default in Ubuntu.

Differential Revision: http://llvm-reviews.chandlerc.com/D755

llvm-svn: 181422
2013-05-08 10:39:05 +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 6eff11e714 [msan] Common flags in MSan.
llvm-svn: 181194
2013-05-06 13:15:14 +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
Bill Wendling e575be4c0e I was wrong in my testing.
There isn't a speedup when using unbuffered I/O. It slows it down in fact.

llvm-svn: 181060
2013-05-03 22:06:41 +00:00
Bill Wendling 6ce98c49f4 Use unbuffered I/O. This reduces the runtime by about half. Our implementation is now only about 5 times slower than gcc's.
llvm-svn: 180980
2013-05-03 00:25:49 +00:00
Bob Wilson b1835b7947 Rewrite sw_vers makefile check to avoid error message on Linux.
When building compiler-rt on Linux, the "which sw_vers" check fails and
writes an error message into the build log. Apparently on Solaris "which"
writes the error message to stdout, so that the current test won't even
work properly. As far as I know sw_vers always lives in /usr/bin, so just
check for it there instead of using "which".

llvm-svn: 180792
2013-04-30 17:06:40 +00:00
Dmitry Vyukov 93b2cba03b asan: fix windows build
llvm-svn: 180788
2013-04-30 13:30:29 +00:00
Dmitry Vyukov db7d9e5db4 tsan: comment out debug output in test
llvm-svn: 180787
2013-04-30 13:09:31 +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 d0ac6c168b tsan: fix deadlock detector table (OK to lock sync var mutex during reporting)
llvm-svn: 180782
2013-04-30 12:00:40 +00:00
Dmitry Vyukov 56cf378071 tsan: reverse stack trace for failed CHECK's, this is how we print traces in other places
llvm-svn: 180781
2013-04-30 11:57:32 +00:00
Dmitry Vyukov 3f7bf08b12 tsan: add interface functions for unaligned access, e.g. __sanitizer_unaligned_load16
llvm-svn: 180780
2013-04-30 11:56:56 +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
Evgeniy Stepanov 9562bbaf9a Add -fno-rtti to ASan runtime cflags on Android.
Otherwise we are picking up an extra libstdc++ dependency.

llvm-svn: 180265
2013-04-25 14:58:23 +00:00
Alexey Samsonov 5c38383205 [ASan] Add allow_user_segv_handler to let users override SEGV handler installed by ASan
llvm-svn: 180255
2013-04-25 10:52:15 +00:00
Dmitry Vyukov a05bbe1c9a tsan: add a test that used to crash, fixed by r180180.
llvm-svn: 180251
2013-04-25 06:58:43 +00:00
Dmitry Vyukov 368d97e33c tsan: fix stack traces for malloc and free
llvm-svn: 180184
2013-04-24 11:16:47 +00:00
Dmitry Vyukov 7a8535d2f2 tsan: run tests sequentially otherwise cmake says:
make[3]: make[3]: /bin/sh: ../../../../../bin/clang: Text file busy

llvm-svn: 180183
2013-04-24 11:07:25 +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
Dmitry Vyukov 54d9c81082 tsan: fix crash when data race happens on out-of-bounds accesses.
llvm-svn: 180180
2013-04-24 09:20:25 +00:00
Bob Wilson f7405fabf5 Use the new iOS deployment target command-line options.
We now rely on the -mios-simulator-version-min option to identify the iOS
simulator target. I'm not sure if there's anything in compiler-rt where that
matters, but it's the right thing to do regardless.

llvm-svn: 180163
2013-04-23 23:52:10 +00:00
Dmitry Vyukov c63d73e59d tsan: support heap starting at 0x04c0 (used in some custom deplyments)
llvm-svn: 180116
2013-04-23 15:59:56 +00:00
Dmitry Vyukov 43cf90f4d1 tsan: update Go memory mapping, Go now uses 0x00c0 heap base
llvm-svn: 180113
2013-04-23 15:24:26 +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 bcd32a9525 [ASan] Disable strict-init-order checker once we have more than one thread, as this mode is thread-hostile
llvm-svn: 180106
2013-04-23 13:57:35 +00:00
Alexey Samsonov 34093f0de8 [MSan] Make a few interface functions accept 'const void *' instead of 'void*'
llvm-svn: 180102
2013-04-23 13:34:19 +00:00
Evgeniy Stepanov 455abf4872 [msan] Unpoison the result of posix_memalign.
llvm-svn: 180101
2013-04-23 13:27:36 +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
Alexander Potapenko 262eb01bbf [ASan] Make wait.cc more Darwin-compatible: fix the header name and the CHECK patterns.
llvm-svn: 180097
2013-04-23 12:36:37 +00:00
Alexander Potapenko 15aa1cd1ac [ASan] Disable AddressSanitizer.AllocDeallocMismatch on Darwin.
See https://code.google.com/p/address-sanitizer/issues/detail?id=131.

llvm-svn: 180093
2013-04-23 12:14:55 +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
Bill Wendling 9a9141aed5 Improve performance of file I/O.
The fread / fwrite calls were happening for each timer. However, that could be
pretty expensive for a large number of timers. Instead, read and write the
timers in one call.

This gives ~10% speedup in compilation time.

llvm-svn: 179990
2013-04-22 03:36:22 +00:00
Alexey Samsonov e7ea8cfb49 Fixup for r179843: add missing header
llvm-svn: 179844
2013-04-19 08:49:05 +00:00
Alexey Samsonov dcf0ade114 [ASan] Make init-order checker allow access to already initialized globals.
This change adds ASan runtime option "strict-init-order" (off by default)
that makes init-order checker bark if global initializer accesses any global from different
translation unit (even if the latter is already initialized). strict init-order checking
doesn't play well with, e.g. LLVM registration machineries, and causes issue 
https://code.google.com/p/address-sanitizer/issues/detail?id=178.

llvm-svn: 179843
2013-04-19 08:35:16 +00:00
Alexey Samsonov 6021e94774 [TSan] Allocate fd table in user heap instead of using internal allocator. We need this to catch races on fds.
llvm-svn: 179841
2013-04-19 08:04:46 +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