Commit Graph

3078 Commits

Author SHA1 Message Date
Dmitry Vyukov 2e7e5801a7 asan: disable pthread_setname_np interceptor
it does not work anyway and can cause significant slowdown

llvm-svn: 194711
2013-11-14 16:48:22 +00:00
Kostya Serebryany c46f281f83 [asan] unbreak dfsan, which includes sanitizer/common_interface_defs.h into internal sources (although it shoudn't)
llvm-svn: 194704
2013-11-14 13:44:43 +00:00
Kostya Serebryany 599f0c1309 [asan] disable CovDump on Windows for now (fails to compile)
llvm-svn: 194703
2013-11-14 13:37:54 +00:00
Kostya Serebryany 91c52d9552 [asan] Poor man's coverage that works with ASan (compiler-rt part)
llvm-svn: 194702
2013-11-14 13:28:17 +00:00
Evgeniy Stepanov 5912fa4c4b [msan] A test for r194697.
llvm-svn: 194699
2013-11-14 12:31:18 +00:00
Alexey Samsonov 164841036d [UBSan] Make sure ASan and UBSan interact properly by running each test from UBSan test suite with and without ASan
llvm-svn: 194698
2013-11-14 12:30:09 +00:00
Alexey Samsonov 003c4bfc42 [ASan] Introduce a top-level target to collect all ASan runtimes and deps
llvm-svn: 194696
2013-11-14 12:24:12 +00:00
Alexey Samsonov 84dbdc0d8e [UBSan] Update UBSan location rendering to match r194686
llvm-svn: 194687
2013-11-14 09:54:10 +00:00
Alexey Samsonov 4d369187ec [Sanitizer] Print symbolized stack frame using a single Printf() call.
This reduces the number of "write" syscalls performed to print a single
stack frame description, and makes sanitizer output less intermixed with
program output. Also, add a number of unit tests.

llvm-svn: 194686
2013-11-14 09:41:24 +00:00
Alexey Samsonov 498e5906ad [Sanitizer] Add print_summary runtime flag to disable error summaries (UBSan doesn't need them)
llvm-svn: 194685
2013-11-14 08:56:59 +00:00
Alexander Potapenko 0706e5dd36 [ASan] Remove the stale dependency on the Foundation framework from the dynamic ASan runtime.
llvm-svn: 194583
2013-11-13 15:52:39 +00:00
Alexey Samsonov cf6ac12e23 [Sanitizer] Use same PC threshold in slow unwinder on all platforms
llvm-svn: 194580
2013-11-13 15:20:10 +00:00
Alexey Samsonov 9ff4598225 [ASan] Do not rely on malloc context in allocator reports.
Invoke a fatal stack trace unwinder when ASan prints allocator-relevant
error reports (double-free, alloc-dealloc-mismatch, invalid-free).
Thus we'll be able to print complete stack trace even if allocation/free
stacks are not stored (malloc_context_size=0).

Based on the patch by Yuri Gribov!

llvm-svn: 194579
2013-11-13 14:46:58 +00:00
Alexey Samsonov 41f7c404c9 [ASan] Use new feature of FileCheck: provide multiple --check-prefix args
llvm-svn: 194578
2013-11-13 14:16:40 +00:00
Alexander Potapenko fa82ba91f9 [ASan] Don't call __asan_init() from certain interceptors on Darwin.
Fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58994, which hadn't
manifested in LLVM because libclang_rt.asan_osx_dynamic.dylib used to depend on
the Foundation framework.
Without that dependency some interceptors may be called from the system
libraries before libSystem_initializer() is called, which lead to assertion
failures in sanitizer_mac.cc (_NSGetEnviron() returns NULL).

To fix the problem we fall back to the original functions in the common
libsanitizer interceptors and the __cxa_atexit() interceptor on Darwin.

This patch also prints a better error message in the case _NSGetEnviron()
returns NULL.

llvm-svn: 194573
2013-11-13 13:34:53 +00:00
Kostya Serebryany 04a1767a2e [asan] fix a leak in tds (https://code.google.com/p/address-sanitizer/issues/detail?id=233)
llvm-svn: 194572
2013-11-13 13:27:44 +00:00
Yuchen Wu 61a1bfcd61 Added summary info to GCDAProfiling.
This function will be called by GCOVProfiling to write and update object
and program summaries to be read in by llvm-cov.

llvm-svn: 194499
2013-11-12 18:45:50 +00:00
Alexey Samsonov 6345150992 [Sanitizer] Specify a default value for each common runtime flag
llvm-svn: 194479
2013-11-12 13:59:08 +00:00
Evgeniy Stepanov 90e12a6cb2 [sanitizer] Avoid needless use of stringification (#symver) in INTERCEPT_FUNCTION_VER.
This is a workaround for clang-format bug (PR17874).

llvm-svn: 194468
2013-11-12 10:21:52 +00:00
Tim Northover 38a0cb5201 ARM: make assembly files compile Thumb2 with nop IT block.
ARM's UAL syntax allows the same assembly file to be compiled in both ARM and
Thumb mode. Conditional execution is handled by requiring the Thumb IT blocks,
but essentially ignoring them when compiling for ARM.

llvm-svn: 194429
2013-11-11 22:50:13 +00:00
Evgeniy Stepanov 5a29068b97 [msan] One more test for r194374.
llvm-svn: 194375
2013-11-11 13:38:24 +00:00
Evgeniy Stepanov b69699eb58 [sanitizer] Warn if interception fails.
This includes a clang-format pass over common interceptors.

llvm-svn: 194372
2013-11-11 11:28:30 +00:00
Evgeniy Stepanov bfdb9b2ec6 [msan] Sanity check for non-PIE.
llvm-svn: 194370
2013-11-11 09:27:20 +00:00
Evgeniy Stepanov 987f59b5c3 [asan] Bypass pthread_attr_getdetachstate interceptor in compiler_rt code.
llvm-svn: 194369
2013-11-11 08:56:49 +00:00
Timur Iskhodzhanov e87f5701bb Remove a FIXME now that I can't reproduce the problem
llvm-svn: 194331
2013-11-09 15:01:23 +00:00
Timur Iskhodzhanov 1f1c7ec400 [Sanitizers] Share some stack walking code between Windows and Linux
Reviewed at http://llvm-reviews.chandlerc.com/D2126

llvm-svn: 194326
2013-11-09 13:59:12 +00:00
Alexander Potapenko 49034e3c33 [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib

The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.

The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.

llvm-svn: 194199
2013-11-07 10:08:19 +00:00
Alexey Samsonov b3d939902a [Sanitizer] Make StackTrace::Unwind the only public way to unwind a stack trace.
llvm-svn: 194196
2013-11-07 07:28:33 +00:00
Alexey Samsonov 5d350b2ab6 [Sanitizer] Presumable fix stack trace unwinding on Windows
llvm-svn: 194195
2013-11-07 06:53:41 +00:00
Alexey Samsonov e13f775a63 [Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
llvm-svn: 194193
2013-11-07 06:33:06 +00:00
Kostya Serebryany 82d0679e92 [asan] attempting to fix x32 build (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59018)
llvm-svn: 194155
2013-11-06 17:47:39 +00:00
Alexander Potapenko 10e316a68e [ASan] Use OS-specific matches in the malloc_context_size.cc lit test.
The top stack frames for operator new and operator delete are different on Linux and Darwin.

llvm-svn: 194150
2013-11-06 14:00:37 +00:00
Alexey Samsonov fead612a02 [ASan] Disable back init-order checker. Make strict_init_order imply check_initialization_order
llvm-svn: 194125
2013-11-06 04:27:09 +00:00
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