Commit Graph

3095 Commits

Author SHA1 Message Date
Alexey Samsonov b0bad7b3b8 [ASan] Make sure slow stack unwinder doesn't return empty stacks.
llvm-svn: 194107
2013-11-05 23:29:12 +00:00
Evgeniy Stepanov 1c8c3fe4b4 [msan] Fix a very unfortunate typo in origin copying.
It was causing randomly missing origins.

llvm-svn: 194036
2013-11-05 01:24:38 +00:00
Bob Wilson 64b4abd07b Push back various changes for building Apple's compiler-rt dylib.
These changes had accumulated internally at Apple for no good reason.

llvm-svn: 193944
2013-11-03 07:06:29 +00:00
Evgeniy Stepanov a6b5eec757 [sanitizer] Intercept strptime.
llvm-svn: 193903
2013-11-02 01:01:35 +00:00
Evgeniy Stepanov 365bd0c88c [msan] Intercept memccpy.
llvm-svn: 193897
2013-11-01 23:49:48 +00:00
Dmitry Vyukov a131bff475 tsna: do not call user code from within runtime (from fflush)
llvm-svn: 193880
2013-11-01 19:15:32 +00:00
Alexey Samsonov 31d4c34433 [Sanitizer] Fix Go build
llvm-svn: 193873
2013-11-01 18:00:22 +00:00
Evgeniy Stepanov 7342857825 [sanitizer] Switch to an older version of struct iocb that is found in the latest Android NDK.
They are binary compatible, and we don't use any of the new fields anyway.

llvm-svn: 193870
2013-11-01 17:48:35 +00:00
Alexey Samsonov c5e1b16d0c [ASan] Kill use_stack_depot runtime flag and stack trace compression routines.
llvm-svn: 193868
2013-11-01 17:23:22 +00:00
Alexey Samsonov 5dc6cff06a [Sanitizer] Unify summary reporting across all sanitizers.
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".

llvm-svn: 193864
2013-11-01 17:02:14 +00:00
Evgeniy Stepanov 170d70be68 [msan] Check that address is an app region before printing shadow.
llvm-svn: 193863
2013-11-01 15:53:25 +00:00
Evgeniy Stepanov 2335879ff1 [sanitizer] Enhance io_submti syscall handler.
llvm-svn: 193848
2013-11-01 01:20:39 +00:00
Alexey Samsonov 4708c5912b Consistently use StackTrace::PrintStack in ASan, LSan and MSan
llvm-svn: 193834
2013-11-01 00:19:46 +00:00
Alexey Samsonov 627e2c0dd7 [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.
Summary:
TSan and MSan need to know if interceptor was called by the
user code or by the symbolizer and use pre- and post-symbolization hooks
for that. Make Symbolizer class responsible for calling these hooks instead.
This would ensure the hooks are only called when necessary (during
in-process symbolization, they are not needed for out-of-process) and
save specific sanitizers from tracing all places in the code where symbolization
will be performed.

Reviewers: eugenis, dvyukov

Reviewed By: eugenis

CC: llvm-commits

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

llvm-svn: 193807
2013-10-31 21:44:07 +00:00
Alexander Potapenko ac501f0250 [libsanitizer] Define SANITIZER_IOS when building for iOS or iOS simulator.
Do not use struct stat64 and struct statfs64 when building for iOS, where __DARWIN_ONLY_64_BIT_INO_T is set to 1.

llvm-svn: 193775
2013-10-31 17:38:18 +00:00
Evgeniy Stepanov 13322c6eda [msan] Intercept dlerror.
llvm-svn: 193760
2013-10-31 16:58:44 +00:00
Alexander Potapenko d29853564d [ASan] Make asan_symbolize.py fall back to ASAN_SYMBOLIZER_PATH (which is used when ASAN_OPTIONS=symbolize=1) if LLVM_SYMBOLIZER_PATH is empty.
llvm-svn: 193758
2013-10-31 16:08:09 +00:00
Evgeniy Stepanov a7add488ae [msan] Disable mlock/mlockall to work around a linux kernel bug.
The same logic is present in ASan and TSan.

llvm-svn: 193755
2013-10-31 15:51:22 +00:00
Evgeniy Stepanov 1cb37c4ee5 [sanitizer] Intercept getline, getdelim.
llvm-svn: 193730
2013-10-31 01:17:41 +00:00
Alexey Samsonov 85cee41633 [ASan] Turn on (non-strict) initialization order checker by default for all ASan users
llvm-svn: 193729
2013-10-31 00:40:15 +00:00
Evgeniy Stepanov 82509b6675 [msandr] Add check-before-write optimization.
Replace blind store with check-before-store to avoid unnecessary memory stores.

Patch by Qin Zhao.

llvm-svn: 193703
2013-10-30 17:44:22 +00:00
Alexey Samsonov 3c845b6f1b [Sanitizer] Update comment in sanitizer_symbolizer.h
llvm-svn: 193700
2013-10-30 17:17:35 +00:00
Alexey Samsonov 78928c1d2a [Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's suggestion)
llvm-svn: 193697
2013-10-30 17:05:37 +00:00
Evgeniy Stepanov 60db142d86 [asan] Fix syscall hooks build on Android.
llvm-svn: 193670
2013-10-30 00:58:17 +00:00
Evgeniy Stepanov cbe83ea141 [santiizer] Disable sincos interceptor in OSX.
llvm-svn: 193667
2013-10-30 00:32:50 +00:00
Evgeniy Stepanov 0bd1f00ec6 [sanitizer] Intercept drand48_r, lrand48_r.
llvm-svn: 193655
2013-10-29 22:25:27 +00:00
Evgeniy Stepanov 867dd7488a [msandr] Remove use of std::set in msandr client to avoid reentrancy issues.
Patch by Qin Zhao.

llvm-svn: 193654
2013-10-29 22:19:25 +00:00
Evgeniy Stepanov e8cd2fad0e [asan] Maybe fix test failures on lld bots.
llvm-svn: 193647
2013-10-29 20:06:12 +00:00
Evgeniy Stepanov bf60342d47 [sanitizer] Intercept sincos, remquo, lgamma, lgamma_r.
llvm-svn: 193645
2013-10-29 19:49:35 +00:00
Evgeniy Stepanov ae2f76fb78 [msandr] Add support for standalone test.
Add macro MSANDR_STANDALONE_TEST for standalone test without msan executables.

Patch by Qin Zhao.

llvm-svn: 193643
2013-10-29 19:44:47 +00:00
Evgeniy Stepanov 596d108feb [tsan] Fix unused variable warnings.
llvm-svn: 193639
2013-10-29 18:44:52 +00:00
Evgeniy Stepanov 7d24620b6d [asan] Fix build.
llvm-svn: 193635
2013-10-29 18:29:39 +00:00
Evgeniy Stepanov 02839ced75 [sanitizer] Fix build warnings.
llvm-svn: 193634
2013-10-29 18:24:06 +00:00
Evgeniy Stepanov 477f8b73a5 [sanitizer] Ptrace syscall handler.
llvm-svn: 193633
2013-10-29 17:59:45 +00:00
Kostya Serebryany 2a9b70cb4c [asan] increase the max malloc size from 8Gb to 64Gb
llvm-svn: 193615
2013-10-29 15:16:54 +00:00
Dmitry Vyukov 3e8432ee6c tsan/asan: support pthread_setname_np to set thread names
llvm-svn: 193602
2013-10-29 10:30:39 +00:00
Alexey Samsonov a687d2593f [Sanitizer] Simplify StackTrace::PrintStack interface: prefer common flags to turn on/off the symbolization
llvm-svn: 193587
2013-10-29 05:31:25 +00:00
Evgeniy Stepanov 451c8de2d8 [msan] Intercept shmat.
llvm-svn: 193581
2013-10-29 02:48:49 +00:00
Evgeniy Stepanov d828208713 [msan] Fix a typo and enable poison_in_free flag.
llvm-svn: 193529
2013-10-28 18:53:37 +00:00
Alexey Samsonov 590fe110f9 [Sanitizer] Revert r193501 and properly fix r193448
llvm-svn: 193522
2013-10-28 16:31:39 +00:00
Dmitry Vyukov cf7259c094 asan/msan: separate different report blocks with new lines
this makes the reports consistent with tsan, and much more readable.

llvm-svn: 193520
2013-10-28 13:05:32 +00:00
Dmitry Vyukov 33dd200ba9 tsan: start the background thread with signals blocked, otherwise it can steal users signals
llvm-svn: 193519
2013-10-28 12:29:32 +00:00
Timur Iskhodzhanov a1d048acb7 Work around ASan/Win breakage by r193448
llvm-svn: 193501
2013-10-27 13:37:23 +00:00
Alexey Samsonov 4cc939e6a6 [Sanitizer] Add pthread_attr_getaffinity_np to the list of versioned functions
llvm-svn: 193470
2013-10-26 12:54:03 +00:00
Peter Collingbourne cbdea323ac Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.
Differential Revision: http://llvm-reviews.chandlerc.com/D1984

llvm-svn: 193449
2013-10-25 23:03:34 +00:00
Peter Collingbourne 791e65dcfb Overhaul the symbolizer interface.
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps.  Those steps now always take place
together.

Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer.  Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.

The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.

Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.

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

llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Peter Collingbourne 8d27910d7d Rename SpinMutex::AssertHeld to CheckLocked, for consistency with BlockingMutex.
llvm-svn: 193447
2013-10-25 23:03:21 +00:00
Evgeniy Stepanov c0fdb3941c [sanitizer] Disable tmpnam_r interceptor on Mac.
llvm-svn: 193417
2013-10-25 16:22:50 +00:00
Evgeniy Stepanov 94042e1ff2 [sanitizer] Intercept tmpnam, tmpnam_r, tempnam.
llvm-svn: 193415
2013-10-25 15:51:48 +00:00
Evgeniy Stepanov a59daaef3e [msandr] Add NATIVE_EXEC macro for building client for running in DynamoRIO hybrid mode only.
When running application in DynamoRIO hybrid mode only, only uninstrumented
modules will run in DynamoRIO and be instrumented by the client, so we do not
need module table in MSanDR.

Patch by Qin Zhao.

llvm-svn: 193411
2013-10-25 14:57:02 +00:00
Evgeniy Stepanov 2acb2470f9 [sanitizer] Remove pthread_attr_getstackaddr interceptor.
The function is deprecated.

llvm-svn: 193409
2013-10-25 14:27:00 +00:00
Evgeniy Stepanov 7f42c6e007 [sanitizer] Fix Android build.
llvm-svn: 193408
2013-10-25 14:24:31 +00:00
Evgeniy Stepanov 07507ffab4 [msan] Zerofill initstate_r buffer in random_r test.
llvm-svn: 193406
2013-10-25 13:03:20 +00:00
Evgeniy Stepanov c2b6cb0747 [sanitizer] Intercept pthread_attr_get*.
llvm-svn: 193405
2013-10-25 13:01:31 +00:00
Evgeniy Stepanov ced9fede02 [msan] Separate access and origin blocks in msan reports with an extra whiteline.
llvm-svn: 193401
2013-10-25 11:17:54 +00:00
Dmitry Vyukov 53491113f0 tsan: do not crash when apparently bogus fd is passed to e.g. close
some tests test libc/filesystem error handling paths (e.g. close(INT_MAX)),
currently such tests fail
with this change they work as expected

llvm-svn: 193400
2013-10-25 09:45:44 +00:00
Evgeniy Stepanov be9cdbb58c [sanitizer] Intercept random_r.
llvm-svn: 193396
2013-10-25 08:58:13 +00:00
Stephen Hines 7633afc960 Switch __ARM_ARCH_7S__ to __ARM_ARCH_EXT_IDIV__ for use of sdiv/udiv assembly.
__ARM_ARCH_EXT_IDIV__ is the define that ARM is using to indicate the presence
of hardware integer divide (sdiv/udiv). Previously, this code was only being
invoked for processors marked 7S. We now can correctly generate hardware
divides on cortex-a15 devices.

llvm-svn: 193392
2013-10-25 06:26:44 +00:00
Evgeniy Stepanov f312b480e2 [sanitizer] Intercept shmctl.
llvm-svn: 193348
2013-10-24 14:47:34 +00:00
Evgeniy Stepanov 7edb87a92c [msan] Unpoison errno in common interceptors.
llvm-svn: 193343
2013-10-24 13:20:34 +00:00
Evgeniy Stepanov d280ee48e8 [msan] Fix invalid origin copying.
Origin copying may destroy valid origin info. This is caused by
__msan_copy_origin widening the address range to the nearest 4-byte aligned
addresses both on the left and on the right. If the target buffer is
uninitialized and the source is fully initialized, this will result in
overriding valid origin of target buffer with stale (possibly 0) origin of the
source buffer.

With this change the widened origin is copied only if corresponding shadow
values are non zero.

llvm-svn: 193338
2013-10-24 11:56:03 +00:00
Evgeniy Stepanov f2fd459a5b [msan] Change wording in the invalid origin message.
llvm-svn: 193335
2013-10-24 11:52:48 +00:00
Peter Collingbourne 50cb32e614 Introduce an operator new for LowLevelAllocator, and convert most users to it.
llvm-svn: 193308
2013-10-24 06:23:39 +00:00
Alexey Samsonov 857e3ece9b [ASan] ASan can be combined with LSan and UBSan, so export symbol from them as well.
llvm-svn: 193245
2013-10-23 15:36:22 +00:00
Evgeniy Stepanov 55a3ba2281 [sanitizer] Fix OSX build.
llvm-svn: 193244
2013-10-23 15:21:10 +00:00
Evgeniy Stepanov 3e6064f9d2 [sanitizer] Intercept ether_* functions.
llvm-svn: 193241
2013-10-23 13:57:47 +00:00
Dmitry Vyukov 1ec0fd4071 tsan: parse symbolize/external_symbolizer_path common flags
llvm-svn: 193236
2013-10-23 09:00:49 +00:00
Dmitry Vyukov 2346c7a511 tsan: fix linux syscall hooks
the file references non-existent arguments and breaks build

llvm-svn: 193234
2013-10-23 08:40:19 +00:00
Nick Lewycky 993f1f38fd Continue to keep 'SUMMARY: ' prefix in lsan. Whoops!
llvm-svn: 193232
2013-10-23 07:58:11 +00:00
Nick Lewycky 622348e693 Hoist the addition of the prefix "SUMMARY: " from
__sanitizer_report_error_summary to ReportErrorSummary.

llvm-svn: 193231
2013-10-23 07:45:53 +00:00
Nick Lewycky d27d668342 Make sure ASan always emits an error summary if it reports an error.
llvm-svn: 193229
2013-10-23 06:19:04 +00:00
Evgeniy Stepanov 2794c47243 [msan] Drain allocator cache when leaving thread.
llvm-svn: 193163
2013-10-22 14:31:30 +00:00
Evgeniy Stepanov 0229c09d43 [sanitizer] Intercept initgroups.
llvm-svn: 193158
2013-10-22 12:24:48 +00:00
Sergey Matveev fd10073aeb [lsan] When detect_leaks=false, be completely silent.
In particular, don't make a fuss if we're passed a malformed suppressions file,
or if we have trouble identifying ld.so. Also, make LSan interface functions
no-ops in this case.

llvm-svn: 193108
2013-10-21 19:35:00 +00:00
Peter Collingbourne b745eec4e4 Use internal_memset to initialize this variable.
Otherwise, the compiler may use memset in non-optimized builds, which is
forbidden in the nolibc part of the runtime.

llvm-svn: 193098
2013-10-21 18:11:57 +00:00
Kostya Serebryany b773785a59 [asan] count the size of QuarantineBatch in the total Quarantine size; make QuarantineBatch fit into 8K, fix a MSVC compile warning
llvm-svn: 193072
2013-10-21 08:36:10 +00:00
Dmitry Vyukov 1e995d4f3e tsan: fix strerror interceptor (eliminate false positives)
llvm-svn: 193070
2013-10-21 07:40:19 +00:00
Peter Collingbourne 90a0876ae7 Runtime support for the indirect function call checker.
Differential Revision: http://llvm-reviews.chandlerc.com/D1339

llvm-svn: 193060
2013-10-20 21:29:46 +00:00
Peter Collingbourne b714e7e12a [ubsan] Introduce %clangxx substitution for all C++ tests.
llvm-svn: 193059
2013-10-20 21:29:32 +00:00
Kostya Serebryany 8bb5d60235 [asan] fix stack trace printing on Mac
llvm-svn: 192990
2013-10-18 17:46:43 +00:00
Kostya Serebryany f11e485d60 [asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space
llvm-svn: 192980
2013-10-18 15:07:07 +00:00
Kostya Serebryany 9628839869 [asan] reduce the size of AsanThreadContext by storing the stack trace in the stack depot
llvm-svn: 192979
2013-10-18 14:50:44 +00:00
Alexander Potapenko e45ca59fd9 [ASan] fix compilation of sanitizer_platform_limits_posix.cc on OSX.
llvm-svn: 192975
2013-10-18 14:16:54 +00:00
Alexander Potapenko 2fe16d720c [ASan] fix compilation of atexit_stats.cc on OSX
llvm-svn: 192973
2013-10-18 14:12:15 +00:00
Evgeniy Stepanov 78c5730bec [sanitizer] Fix OSX build some more.
llvm-svn: 192967
2013-10-18 12:19:23 +00:00
Evgeniy Stepanov b4e501c6ec [sanitizer] Fix OSX build.
llvm-svn: 192966
2013-10-18 11:26:02 +00:00
Evgeniy Stepanov 3cb9df042e [sanitizer] Move statfs/fstatfs to common interceptors and add statvfs/fstatvfs.
llvm-svn: 192965
2013-10-18 11:14:16 +00:00
Kostya Serebryany e2007b706e [asan] fix a test on Mac
llvm-svn: 192960
2013-10-18 09:42:24 +00:00
Evgeniy Stepanov 70d5abfba2 [sanitizer] Intercept getmntent, getmntent_r.
llvm-svn: 192959
2013-10-18 09:41:43 +00:00
Kostya Serebryany 4bf67d99f4 [asan] fix atexit stats
llvm-svn: 192956
2013-10-18 07:57:59 +00:00
Richard Smith c1d5471291 Make the big array in the UBSan C++ runtime be zero-initialized to dramatically
shrink the binary size of the ubsan runtime.

Also fix a bug where long-running processes could eventually trigger a crash in
the runtime by filling up the cache. I've not found a nice way to add a test for
this crasher; ideas welcome.

llvm-svn: 192931
2013-10-17 22:51:04 +00:00
Alexander Potapenko 1f5573cca2 [ASan] fix assign_large_valloc_to_global.cc to use the correct header for valloc() on OSX.
llvm-svn: 192901
2013-10-17 15:48:24 +00:00
Kostya Serebryany 8e2881d0c2 [asan] fix a failure with ASAN_OPTIONS=verbosity=1:use_sigaltstack=1
llvm-svn: 192892
2013-10-17 13:18:21 +00:00
Evgeniy Stepanov 4bbf273173 [sanitizer] Fix unpoisoning of msghdr::msg_name in recvmsg interceptor.
llvm-svn: 192886
2013-10-17 11:32:30 +00:00
Kostya Serebryany f04ae33106 [asan] Fix a deadlock between asan's allocator and lsan
Summary:
This fixes a deadlock which happens in lsan
on a large memalign-allocated chunk that resides in lsan's root set.

Reviewers: samsonov, earthdok

Reviewed By: earthdok

CC: llvm-commits

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

llvm-svn: 192885
2013-10-17 11:18:11 +00:00
Alexey Samsonov bc7c87a8cb [Sanitizer] Move pthread_cond_signal and pthread_cond_broadcast to common interceptors
llvm-svn: 192876
2013-10-17 09:24:03 +00:00
Dmitry Vyukov 333112a439 tsan: merge 2 similar tests into 1
llvm-svn: 192874
2013-10-17 08:27:24 +00:00
Dmitry Vyukov e88dbe5774 tsan: add a test for __tsan_default_options()
llvm-svn: 192873
2013-10-17 08:13:38 +00:00
Will Dietz ece9ede240 Use configured PYTHON in asan lit tests.
llvm-svn: 192870
2013-10-17 05:33:22 +00:00
Dmitry Vyukov cdc971c03c tsan: revert variable name change in test
It works as is with new llvm-symbolizer.

llvm-svn: 192798
2013-10-16 15:57:23 +00:00