Commit Graph

4716 Commits

Author SHA1 Message Date
Justin Bogner cc0d7eeb6d profile: Avoid name collisions between instrumentation and runtime
The naming scheme we're using for counters in profile data shares a
prefix with some fixed names we use for the runtime, notably
__llvm_profile_data_begin and _end. Embarrassingly, this means a
function called begin() can't be instrumented.

This modifies the runtime names so as not to collide with the
instrumentation.

llvm-svn: 217166
2014-09-04 15:45:31 +00:00
Alexander Potapenko 7c3d581e8a [ASan] Remove the check for a double-SEGV from zero_page_pc.cc
Looks like the second crash doesn't happen on Mac.

llvm-svn: 217165
2014-09-04 15:40:25 +00:00
Viktor Kutuzov 2132b704ff Intercept _exit() for sanitizers' needs on FreeBSD
Differential Revision: http://reviews.llvm.org/D5171

llvm-svn: 217156
2014-09-04 14:24:27 +00:00
Viktor Kutuzov 3c821c0200 Fix building sanitizer_linux_libcdep.cc on FreeBSD
Differential Revision: http://reviews.llvm.org/D5166

llvm-svn: 217148
2014-09-04 13:58:59 +00:00
Evgeniy Stepanov e9ca1c72be [msan] Fix fork test on centos-6.5.
Missing <atomic> header.

llvm-svn: 217142
2014-09-04 11:07:42 +00:00
Evgeniy Stepanov bb91e02efd [msan] Make origin tracking fork-safe.
Chained origins make plain memory stores async-signal-unsafe.
We already disable it inside signal handlers.
This change grabs all origin-related locks before fork() and releases
them after fork() to avoid a deadlock in the child process.

llvm-svn: 217140
2014-09-04 10:36:14 +00:00
Alexander Potapenko 9d24aa0fa8 [ASan] allow deadly signals to be received in signal handlers
(previously ASan would just crash upon the second SEGV)
Other tools do not use this code yet.

llvm-svn: 217137
2014-09-04 09:34:22 +00:00
Alexey Samsonov 2428359e23 Fixup test case after r217079
llvm-svn: 217111
2014-09-03 23:46:12 +00:00
Kostya Serebryany fb5d6852c6 [asan] remove debug print
llvm-svn: 217101
2014-09-03 22:58:03 +00:00
Alexey Samsonov c8d8ca0bd6 Fix fast stack unwind on ARM to support code generated with GCC.
http://reviews.llvm.org/D4692

Patch by Maxim Ostapenko!

llvm-svn: 217079
2014-09-03 21:10:44 +00:00
Dmitry Vyukov f8cfdd9207 tsan: handle early signals
The second part of the fix of
https://code.google.com/p/thread-sanitizer/issues/detail?id=71

llvm-svn: 217031
2014-09-03 12:25:22 +00:00
Evgeniy Stepanov f1741f52ad [msan] Fix origin_history_per_stack_limit=0 behavior.
It disables the per-stack limit.

llvm-svn: 217030
2014-09-03 12:15:59 +00:00
Dmitry Vyukov 26411d6929 tsan: more precise handling of atexit callbacks
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=74

llvm-svn: 216906
2014-09-02 14:22:31 +00:00
Dmitry Vyukov 8bbb17dcc3 tsan: disable getpwent interceptors
There interceptors do not seem to be strictly necessary for tsan.
But we see cases where the interceptors consume 70% of execution time.
Memory blocks passed to fgetgrent_r are "written to" by tsan several times.
First, there is some recursion (getgrnam_r calls fgetgrent_r), and each
function "writes to" the buffer. Then, the same memory is "written to"
twice, first as buf and then as pwbufp (both of them refer to the same addresses).

llvm-svn: 216904
2014-09-02 12:51:11 +00:00
Dmitry Vyukov 1841219abd tsan: restructure signal handling to allow recursive handling
Fixes issue
https://code.google.com/p/thread-sanitizer/issues/detail?id=71

llvm-svn: 216903
2014-09-02 12:27:45 +00:00
Dmitry Vyukov dc1caa7cb8 tsan: address comments in r214912
See http://reviews.llvm.org/D4794

llvm-svn: 216900
2014-09-02 09:34:34 +00:00
Alexander Potapenko 3ae9193371 [libsanitizer] Fix the Android build.
llvm-svn: 216885
2014-09-01 15:38:16 +00:00
Evgeniy Stepanov 21202ba8dd [asan] Update asan_device_setup to support Android L Preview.
llvm-svn: 216884
2014-09-01 15:37:50 +00:00
Alexander Potapenko a909e493f1 [libsanitizer] Make sanitizer_unwind_posix.cc a libcdep source file.
Guard the source with #if SANITIZER_POSIX to fix compilation on Windows.
use it only in 

llvm-svn: 216882
2014-09-01 13:07:50 +00:00
Dmitry Vyukov 34fb3799a3 tsan: fix false positive related to signal handlers
Users expect synchronization between sigaction and arrival
of the signal. See the test for details.

llvm-svn: 216878
2014-09-01 12:46:42 +00:00
Alexander Potapenko 4d84996186 [ASan] Small refactoring - split the slow unwinding logic into sanitizer_unwind_posix.cc
This allows the slow unwinder to be used on OSX (it's disabled for now, see
https://code.google.com/p/address-sanitizer/issues/detail?id=137 for details)

llvm-svn: 216877
2014-09-01 12:43:03 +00:00
Dmitry Vyukov aa8fa60ba8 tsan: unbreak windows build
Currently it fails with:

# Testing race detector.
race_windows_amd64.syso:gotsan.cc:(.text+0x4d89): undefined reference to `__imp_SymGetModuleBase64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4d90): undefined reference to `__imp_SymFunctionTableAccess64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4dd8): undefined reference to `__imp_StackWalk64'
x86_64-w64-mingw32/bin/ld.exe: race_windows_amd64.syso
: bad reloc address 0x10 in section `.data'
collect2.exe: error: ld returned 1 exit status

llvm-svn: 216875
2014-09-01 11:44:59 +00:00
Kostya Serebryany c148f7c3af [asan] enable poison_array_cookie back
llvm-svn: 216705
2014-08-29 01:16:18 +00:00
Kostya Serebryany ac77055272 [asan] introduce __asan_load_cxx_array_cookie: check that the array cookie address is properly poisoned and return the cookie value. If not, return 0 to avoid infinite loop of DTORs (in case of use-after-free). Calls to this function will be inserted by clang (separate change)
llvm-svn: 216692
2014-08-28 22:28:04 +00:00
Kostya Serebryany 1e3b338606 [asan] disable poison_array_cookie while I am investigating a false positive on chromium (I suspect that LLVM looses nosanitizer metadata; no test yet)
llvm-svn: 216684
2014-08-28 20:24:05 +00:00
Timur Iskhodzhanov f77d20b1a9 [ASan/Win] Add a test case for r216663 [-Zl vs LIBCMT vs asan_win_uar_thunk]
llvm-svn: 216665
2014-08-28 13:20:23 +00:00
Timur Iskhodzhanov 737370da20 [ASan/Win] Add the -Zl flag to avoid /DEFAULTLIB:libcmt directive in the asan_win_uar_thunk object file
This directive results in 'symbol already defined' when linking DLLs that use -MD

llvm-svn: 216663
2014-08-28 12:28:04 +00:00
Alexander Potapenko 2164fa3b9b [ubsan] Follow-up for r216657: fixed the line numbers in the test.
llvm-svn: 216661
2014-08-28 10:25:17 +00:00
Alexander Potapenko 53cce89a81 [UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin
to make the tests green.
Slow stack unwinding is disabled in libsanitizer on Darwin now.

llvm-svn: 216657
2014-08-28 09:25:06 +00:00
Alexander Potapenko 83061238d4 [ASan] Whitespace fix. No functionality change.
llvm-svn: 216544
2014-08-27 13:43:18 +00:00
Evgeniy Stepanov 5d321d759d [asan] Add asprintf negative test.
llvm-svn: 216542
2014-08-27 12:46:58 +00:00
Timur Iskhodzhanov 6add9fe958 [ASan/Win] Enable building the MD runtime by default
llvm-svn: 216534
2014-08-27 10:17:20 +00:00
Evgeniy Stepanov 8f4e736080 [asan] Restore asan-rt name on linux back to pre-r216380.
There is no reason to have different library names for shared and static
cases on linux. It also breaks Android where we install the shared asan-rt
library into the system and should keep the old name.

This change reverts most of r216380 limiting it to win32 targets only.

llvm-svn: 216533
2014-08-27 09:46:54 +00:00
Kostya Serebryany 9455c5ab81 [asan] add a test for poison_array_cookie=1
llvm-svn: 216494
2014-08-26 22:05:12 +00:00
Sergey Matveev 08347ca4fd [lsan] Implement the public allocator interface in standalone LSan.
llvm-svn: 216459
2014-08-26 14:28:28 +00:00
Sergey Matveev 93a2906e80 [lsan] Implement __sanitizer_print_stack_trace() in standalone LSan.
llvm-svn: 216454
2014-08-26 12:52:41 +00:00
Timur Iskhodzhanov 47030475a0 [ASan/Win] Disable warning C4391: incorrect return type for intrinsic function
This warning makes it a bit hard to define strlen and wcslen interceptors in an elegant yet portable way

llvm-svn: 216450
2014-08-26 12:33:00 +00:00
Timur Iskhodzhanov 81885731a8 [ASan/Win] Rename asan_dll_thunk.cc to asan_win_dll_thunk.cc
llvm-svn: 216448
2014-08-26 10:21:37 +00:00
Timur Iskhodzhanov 6903e10ddf [ASan/Win] Add an extra thunk.lib to handle stack-use-after-return option
With this patch, "check-asan" passes all the tests with both MT and MD ASan RTL if you set COMPILER_RT_BUILD_SHARED_ASAN to ON
(PR20214)

llvm-svn: 216447
2014-08-26 10:08:24 +00:00
Kostya Serebryany 74bd6bc9f9 [sanitizer] move mlock interceptor from asan/tsan/msan to common; no functionality change intended
llvm-svn: 216407
2014-08-25 20:57:59 +00:00
Timur Iskhodzhanov dc8caada51 [ASan/Win] Add /DEBUG to the MD RTL link flags
llvm-svn: 216387
2014-08-25 16:45:53 +00:00
Timur Iskhodzhanov 2311f4dfaa [ASan] Replace CMake if/APPEND/endif with append_if
llvm-svn: 216386
2014-08-25 16:40:39 +00:00
Timur Iskhodzhanov 0a88b25c43 [ASan/Win] Intercept memory allocation functions in the MD CRT
llvm-svn: 216382
2014-08-25 13:19:05 +00:00
Timur Iskhodzhanov ea3ce790dc [ASan] Rename the ASan dynamic RT
Reviewed at http://reviews.llvm.org/D5026

llvm-svn: 216380
2014-08-25 11:44:06 +00:00
Alexey Samsonov 2ccbc621df [UBSan] Add support for printing backtraces to all UBSan handlers
llvm-svn: 216289
2014-08-22 21:42:04 +00:00
Alexander Potapenko ea2402ebf4 [ubsan] Follow-up for r216263: fix the expected line number.
llvm-svn: 216266
2014-08-22 12:44:16 +00:00
Timur Iskhodzhanov 220ddacf8d [ASan/Win] Land the trivial bits of -MD RTL support (PR20214)
llvm-svn: 216265
2014-08-22 12:38:07 +00:00
Timur Iskhodzhanov f2d24473fe [ASan] Use check_library_exists to determine if libc/libstdc++ are available
llvm-svn: 216264
2014-08-22 12:26:34 +00:00
Alexander Potapenko 66ae9712c5 [ubsan] Do not run Function/function.cpp on Darwin where -fsanitize=function is not supported.
llvm-svn: 216263
2014-08-22 11:09:10 +00:00
Alexander Potapenko 373863d31e Follow-up for r215436: use SIZE_T for strlen and wcslen interceptors.
llvm-svn: 216184
2014-08-21 16:12:46 +00:00
Timur Iskhodzhanov a14ef30443 [ASan] Turns out we should always intercept __cxa_throw
At least check-asan works with this change.

If the change breaks anything, we'll need to add:
a) a comment describing why we have to use INTERCEPT_FUNCTION rather than
   ASAN_INTERCEPT_FUNC
and
b) a test case.

llvm-svn: 216177
2014-08-21 13:33:39 +00:00
Alexey Samsonov 6d2022b2e0 Fix latent bug in try_compile macro and use CMAKE_EXE_LINKER_FLAGS
when testing for supported architectures, as suggested by Andy Gibbs.

llvm-svn: 216083
2014-08-20 17:12:58 +00:00
Peter Collingbourne 82ff058cf9 DFSan's set label function should avoid writing to the shadow memory when the write would not change the value in memory.
When writing a label to shadow memory, don't write if the value is already set to the value being written.  This dramatically reduces real memory consumption in programs with sparse use of labels.

Test Plan: It would be nice to test that unnecessary writes are skipped, but I do not see how a unit test could do this.

Patch by Sam Kerner!

Differential Revision: http://reviews.llvm.org/D4894

llvm-svn: 215961
2014-08-19 01:47:33 +00:00
Alexey Samsonov 2e39027931 [LSan] Parse common flags from LSAN_OPTIONS even if LSan is combined with
another sanitizer.

A user may run both LSan and LSan+ASan. It is weird to pass path to leak
suppression file (or other common sanitizer flags, like "verbosity") in
"LSAN_OPTIONS" in the first case and in "ASAN_OPTIONS" in the second case.

llvm-svn: 215949
2014-08-18 23:39:47 +00:00
Alexey Samsonov 00c02b297a Add regression test for PR15823
llvm-svn: 215941
2014-08-18 22:11:14 +00:00
Alexey Samsonov 591d15272e [TSan] Add -lpthread to the test which uses pthread_ functions
llvm-svn: 215939
2014-08-18 22:09:17 +00:00
Justin Bogner 8da47ac82e profile: Improve error messages on bad GCDA files
llvm-svn: 215933
2014-08-18 20:47:32 +00:00
Hans Wennborg 4834653872 sanitizer_printf.cc: guard the va_copy hack on _MSC_VER
llvm-svn: 215932
2014-08-18 20:23:16 +00:00
Hans Wennborg a2d4b09a55 Revert "[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore" (r215708)
This is still needed for VS2012.

llvm-svn: 215930
2014-08-18 19:55:35 +00:00
Alexey Samsonov cd21e2f7e4 [TSan] Initialize flags as early as possible. Disables back coredump, accidentally enabled in r215479. Add a test.
llvm-svn: 215763
2014-08-15 19:53:51 +00:00
Timur Iskhodzhanov 48e21c07c1 Follow-up to r215724: fix a lint warning
llvm-svn: 215725
2014-08-15 16:10:02 +00:00
Timur Iskhodzhanov 5c84264194 [ASan/Win] Introduce a new macro for malloc-like function attributes; also, clang-format the definitions of these functions
llvm-svn: 215724
2014-08-15 16:08:53 +00:00
Timur Iskhodzhanov 3e00116dc1 [ASan/Win] Remove one more reference to __interception::GetRealFunctionAddress (follow-up to r215707)
llvm-svn: 215722
2014-08-15 15:41:03 +00:00
Timur Iskhodzhanov f8b1cd210d [ASan/Win] We don't really need to use .CRT to call __asan_init when using -MD
llvm-svn: 215719
2014-08-15 14:44:17 +00:00
Timur Iskhodzhanov cc01fad1d9 [ASan/Win] Remove a hack that seems not to be required with VS2013 anymore
llvm-svn: 215708
2014-08-15 13:45:23 +00:00
Timur Iskhodzhanov 750f1cf9e4 [ASan/Win] Remove old, unused and non-functional code that will be re-written soon
llvm-svn: 215707
2014-08-15 12:56:52 +00:00
Timur Iskhodzhanov 893beb96a2 [ASan/Win] Slightly update&relax test expectations to work with both -MT and -MD (in progress, PR20214) CRTs
llvm-svn: 215641
2014-08-14 13:11:39 +00:00
Timur Iskhodzhanov 7040f13639 [ASan/Win] Mark tests that require -MT asan_dll_thunk as such
llvm-svn: 215638
2014-08-14 13:02:51 +00:00
Dmitry Vyukov 5f86aaa27b tsan: fix unaligned memory access routine
It was possimitically handling an aligned 8-byte access as 2 4-byte accesses.

llvm-svn: 215546
2014-08-13 13:20:23 +00:00
Alexey Samsonov de443c5002 [UBSan] Add returns-nonnull sanitizer.
Summary:
This patch adds a runtime check verifying that functions
annotated with "returns_nonnull" attribute do in fact return nonnull pointers.
It is based on suggestion by Jakub Jelinek:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223693.html.

Test Plan: regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4849

llvm-svn: 215485
2014-08-13 00:26:40 +00:00
Alexey Samsonov 5a32f79af3 [MSan] Disable coredump for 64-bit binaries.
llvm-svn: 215482
2014-08-12 22:37:47 +00:00
Alexey Samsonov 34e2b280da [TSan] Share the code the setup code calling getrlim/setrlim with sanitizer_common
llvm-svn: 215481
2014-08-12 22:31:19 +00:00
Alexey Samsonov d2d2457823 [Sanitizer] Make disable_coredump a common flag and use it in TSan
llvm-svn: 215479
2014-08-12 22:07:48 +00:00
Alexey Samsonov b9ec65cd4d [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in favor of
a unified interface in <sanitizer/allocator_interface.h>.

llvm-svn: 215469
2014-08-12 20:28:20 +00:00
Hans Wennborg a03feadeb2 Fix the CMake build when setting MACOSX_DEPLOYMENT_TARGET
If we don't reset CMAKE_OSX_DEPLOYMENT_TARGET, it will end up in
CFLAGS together with the -mmacosx-version-min that we set,
and the compiler errors about the conflict.

llvm-svn: 215468
2014-08-12 20:03:33 +00:00
Timur Iskhodzhanov 6963686c47 [ASan] Use more appropriate return types for strlen/wcslen to avoid MSVC warnings
llvm-svn: 215436
2014-08-12 11:02:53 +00:00
Timur Iskhodzhanov de1718d355 [ASan/Win] Fix PR18987: warning about overriding '/MD' with '/MT'
llvm-svn: 215435
2014-08-12 09:44:56 +00:00
Alexey Samsonov 968a358974 [ASan] Add new options for asan_symbolize.py script.
The patch adds new features in asan-symbolizer script which are helpful for using ASan on embedded systems:

1) add cross-compile prefix for binutils
2) define path to sysroot with sanitized binaries

Features are enabled by command line options.
The patch also extends command line interface with help option.

Reviewed in http://reviews.llvm.org/D4703.

Patch by Maria Guseva!

llvm-svn: 215381
2014-08-11 20:02:49 +00:00
Alexey Samsonov 266ba5586d Fix build on some architectures caused by r215247.
llvm-svn: 215380
2014-08-11 19:57:56 +00:00
Saleem Abdulrasool a0d65971d4 builtins: add signature to some assembly routines
Add a helpful description and a signature for the functions implemented in
assembly for the integral math routines.  NFC.

llvm-svn: 215296
2014-08-09 20:17:43 +00:00
Saleem Abdulrasool 6063983c30 builtins: correct __umodsi3, __udivsi3 on ARM
When building the builtins for a modern CPU (idiv support), __umodsi3 was
completely incorrect as it would behave as __udivmosi3, which takes a tertiary
parameter which is a pointer.

__udivsi3 was also incorrect, returning the remainder in r1.  Although this
would not result in any crash or invalid behaviour as r1 is a caller saved
register in AAPCS, this is unnecessary.  Simply perform the division ignoring
the remainder.

llvm-svn: 215295
2014-08-09 20:17:37 +00:00
Alexey Samsonov 408d2152c4 Fixup Android tests build rules
llvm-svn: 215264
2014-08-09 00:23:11 +00:00
Alexey Samsonov 68b9e74592 [CMake] Determine which compiler-rt libraries are supported on
a given platform in a top-level CMakeLists.txt to use it both
in lib/ and in test/ subdirectories. Move architecture/platform
checks to config-ix.

llvm-svn: 215247
2014-08-08 22:01:20 +00:00
Timur Iskhodzhanov 255958391d [ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails
llvm-svn: 215203
2014-08-08 13:25:55 +00:00
Viktor Kutuzov 7a27160780 Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4807

llvm-svn: 215185
2014-08-08 06:21:09 +00:00
Evgeniy Stepanov f5c1f8ac84 [sanitizer] Intercept timerfd_settime, timerfd_gettime.
llvm-svn: 215112
2014-08-07 14:21:42 +00:00
Evgeniy Stepanov 37e069c2ac [msan] Fix fcvt interceptor.
fcvt() result can be heap-allocated and must be unpoisoned.

llvm-svn: 215106
2014-08-07 12:45:55 +00:00
Viktor Kutuzov c68a37c531 Add FreeBSD support to the address sanitizer's malloc_context_size.cc test case
Differential Revision: http://reviews.llvm.org/D4665

llvm-svn: 215081
2014-08-07 04:58:41 +00:00
Alexey Samsonov 71b471fa09 [TSan] Try to fix Go runtime build
llvm-svn: 215000
2014-08-06 23:13:23 +00:00
Viktor Kutuzov a37ad099e8 Segregate FreeBSD-specific parts from sanitizer_procmaps_linux.cc
Differential Revision: http://reviews.llvm.org/D4555

llvm-svn: 214955
2014-08-06 10:16:52 +00:00
Dmitry Vyukov 70db9d4d72 tsan: allocate vector clocks using slab allocator
Vector clocks is the most actively allocated object in tsan runtime.
Current internal allocator is not scalable enough to handle allocation
of clocks in scalable way (too small caches). This changes transforms
clocks to 2-level array with 512-byte blocks. Since all blocks are of
the same size, it's possible to cache them more efficiently in per-thread caches.

llvm-svn: 214912
2014-08-05 18:45:02 +00:00
Timur Iskhodzhanov 0575694729 [ASan/Win] Handle SEH exceptions even with -GS
This is a follow-up to r213654, r213656, r213667 and r213668.

llvm-svn: 214861
2014-08-05 13:26:26 +00:00
Alexander Kornienko c3f7bcbd48 The test doesn't export ASAN_OPTIONS, so $ASAN_OPTIONS should not be used in RUN lines.
llvm-svn: 214855
2014-08-05 11:12:23 +00:00
Alexey Samsonov ff24fd2516 [UBSan] Allow to suppress reports from vptr checker for specified types.
Based on http://reviews.llvm.org/D4702 by Byoungyoung Lee!

llvm-svn: 214833
2014-08-05 01:24:22 +00:00
Alexey Samsonov ae1764854e [Sanitizer] Turn SuppressionContext::Init() into InitIfNecessary().
Suppression context might be used in multiple sanitizers working
simultaneously (e.g. LSan and UBSan) and not knowing about each other.

llvm-svn: 214831
2014-08-05 00:43:23 +00:00
Kostya Serebryany e9f24a9b3b [asan] poison array cookies only on 64-bit arch
llvm-svn: 214713
2014-08-04 12:59:45 +00:00
Kostya Serebryany 522c35eb80 [asan] introduce __asan_poison_cxx_array_cookie. This is asan-rt part of PR19838 (Left OOB accesses on new[]-allocated arrays with array cookies are not detected). No tests yet. They will follow once I commit the clang part.
llvm-svn: 214711
2014-08-04 12:43:13 +00:00
Kostya Serebryany 1cd57ebb6b [asan] intercept sized operator delete[]
llvm-svn: 214704
2014-08-04 10:10:50 +00:00
Alexey Samsonov d9ad5cec0c [ASan] Use metadata to pass source-level information from Clang to ASan.
Instead of creating global variables for source locations and global names,
just create metadata nodes and strings. They will be transformed into actual
globals in the instrumentation pass (if necessary). This approach is more
flexible:
1) we don't have to ensure that our custom globals survive all the optimizations
2) if globals are discarded for some reason, we will simply ignore metadata for them
   and won't have to erase corresponding globals
3) metadata for source locations can be reused for other purposes: e.g. we may
   attach source location metadata to alloca instructions and provide better descriptions
   for stack variables in ASan error reports.

No functionality change.

llvm-svn: 214604
2014-08-02 00:35:50 +00:00
Viktor Kutuzov f164bee0e0 Add FreeBSD support to the address sanitizer's deep_stack_uaf.cc test case
Differential Revision: http://reviews.llvm.org/D4668

llvm-svn: 214544
2014-08-01 19:37:05 +00:00
Viktor Kutuzov 62308221bc Fix the waitid sanitizer interceptor to work on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4670

llvm-svn: 214543
2014-08-01 19:33:14 +00:00
Ehsan Akhgari 9e5b6a08d4 [ASan] Support the asan_loadN/asan_storeN functions in the DLL thunk library
Summary:
This is required for linking DLLs with large functions exceeding
san-instrumentation-with-call-threshold.  One such function is
vp9_fdct16x16_sse2 in libvpx.

Reviewers: timurrrr

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D4758

llvm-svn: 214532
2014-08-01 18:04:53 +00:00
Alexey Samsonov 19fc293782 [Sanitizer] Don't try to parse unspecified suppressions file
llvm-svn: 214421
2014-07-31 19:06:47 +00:00
Evgeniy Stepanov 1cd9e019da [asan] End-to-end test for REP MOVS instrumentation.
Patch by Yuri Gorshenin.

llvm-svn: 214396
2014-07-31 09:12:20 +00:00
Dmitry Vyukov b7e8e5cdc0 tsan: use MADV_NOHUGEPAGE only if it is supported by platform
Fixes build failure on an old system:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/7555/steps/build/logs/stdio

llvm-svn: 214394
2014-07-31 08:24:59 +00:00
Alexey Samsonov 89b17bb7bc [Sanitizer] Hoist the code parsing suppressions file into sanitizer_common.
Remove corresponding bits from LSan and TSan runtimes. No functionality change.

llvm-svn: 214344
2014-07-30 21:53:30 +00:00
Alexey Samsonov 77f646c623 [Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
No functionality change.

llvm-svn: 214343
2014-07-30 21:33:04 +00:00
Alexey Samsonov 34a4c6e12f [Sanitizer] Make SuppressionContext a singleton class, residing in sanitizer_common.
Convert TSan and LSan to the new interface. More changes will follow:
1) "suppressions" should become a common runtime flag.
2) Code for parsing suppressions file should be moved to SuppressionContext::Init().

llvm-svn: 214334
2014-07-30 20:54:37 +00:00
Evgeniy Stepanov c3478490ed [asan] XFAIL sized-delete test on Android.
llvm-svn: 214303
2014-07-30 12:39:30 +00:00
Kostya Serebryany e7532e59c0 [asan] rename new-delete-size-mismatch to new-delete-type-mismatch and make the report more verbose
llvm-svn: 214299
2014-07-30 11:20:37 +00:00
Kostya Serebryany 69852a843c [asan] add a feature to detect new-delete-size-mismatch (when used with -Xclang -fsized-deallocation). Not yet on Mac. Also, remove some unused code.
llvm-svn: 214296
2014-07-30 09:48:23 +00:00
Evgeniy Stepanov 5c72938c39 [msan] Use SIGHUP instead of SIGUSR1 in test.
Apparently, SIGUSR1 does not work on x86_64+ArchLinux for some reason.

For more details, see:
https://groups.google.com/forum/#!topic/llvm-dev/4Ag1FF4M2Dw

llvm-svn: 214289
2014-07-30 08:17:58 +00:00
Alexey Samsonov 96591cd1f1 [UBSan] Introduce ScopedReport object.
This object is used to encapsulate all actions that need to be
done before/after printing UBSan diagnostics. Currently these
actions are:
* locking a mutex to ensure that UBSan diagnostics from several
threads won't mix with each other and with other sanitizers' 
reports
* killing a program once the report is printed (if necessary).

Use this object in all UBSan handlers. Unify the way we implement
fatal and non-fatal handlers by making all the handlers simple
one-liners that redirect __ubsan_handle_foo(_abort)? to
handleFooImpl().

llvm-svn: 214279
2014-07-30 01:49:19 +00:00
Alexey Samsonov 64a5f0fa1a [UBSan] Allow to override runtime flags defaults by providing
compile definition UBSAN_DEFAULT_OPTIONS when building the runtime.
This mirrors similar ASan functionality.

llvm-svn: 214259
2014-07-30 00:01:41 +00:00
Alexey Samsonov 6ae5bac794 [UBSan] Move all runtime flags parsing to ubsan_flags.cc.
No functionality change.

llvm-svn: 214258
2014-07-29 23:49:20 +00:00
Alexey Samsonov 20c5c7b723 [UBSan] Get pc/bp for stack unwinding as early as possible.
This will ensure that stack frames in error reports will not
contain internal UBSan failures, and frame #0 will be the
actual place in the program where the error happens.

llvm-svn: 214245
2014-07-29 23:22:41 +00:00
Alexey Samsonov 17edc9230e [UBSan] Build part of UBSan runtime that can be linked into C programs with -fno-rtti flag.
llvm-svn: 214232
2014-07-29 21:52:25 +00:00
Alexey Samsonov 8b9d18e4fe [UBSan] Try to enable pipefail in UBSan lit tests to make them behave more predictably
llvm-svn: 214149
2014-07-29 00:30:01 +00:00
Alexey Samsonov 4462ec6c02 Exclude ASM from CompilerRT languages as an attempt to fix CMake failure in standalone mode
llvm-svn: 214130
2014-07-28 22:04:19 +00:00
Dmitry Vyukov 3baf5b390d tsan: add a useful debug check
llvm-svn: 214082
2014-07-28 13:54:18 +00:00
Saleem Abdulrasool 3a2d6a3096 builtins: make ARM compilation with GAS work again
The LLVM IAS seems to accept wide instructions for add and sub in ARM mode even
though it is not permitted.  This uses a macro to ensure that the wide modifier
is only applied when building in THUMB mode.

This repairs building with GCC/GAS in ARM mode.

llvm-svn: 214046
2014-07-27 02:01:24 +00:00
Saleem Abdulrasool b6690c34cf builtins: move macro definitions into assembly.h
The macro definitions are shared across multiple files.  Define them once in the
assembly.h header rather than redefining it in each file.

llvm-svn: 214045
2014-07-27 02:01:20 +00:00
Saleem Abdulrasool 31306b1571 builtins: whitespace
llvm-svn: 214044
2014-07-27 02:01:15 +00:00
Saleem Abdulrasool b72a2fdd72 builtins: avoid multiple definitions of symbols
The architecture specific implementation of routines would be built and included
along with the generic implementation.  This would result in multiple
definitions of those symbols.

The linker is free to select either of the two.  Most of the time, this
shouldn't be too terrible as the forward iteration should catch the architecture
version due to the ordering.  Rather than relying on the linker and build
infrastructure ordering things in a specific manner, only provide the
architecture version when available.

This reduces the size of compiler-rt, simplifies inspection of the library
implementations, and guarantees that the desired version is selected at a
slightly complex build system.

llvm-svn: 214040
2014-07-26 23:44:22 +00:00
Saleem Abdulrasool 24c68b26d8 builtins: add missed files from previous commits
This adds missed files in SVN r214033 for alignment and corrects a change from
SVN r214034 for fixing compilation with GCC.

llvm-svn: 214039
2014-07-26 23:44:18 +00:00
Saleem Abdulrasool 12ae9a8704 builtins: move the readonly constants into rodata
Place the floating point constants into the read-only data section.  This was
already being done for x86_64, this simply mirrors the behaviour for i686.

llvm-svn: 214034
2014-07-26 21:08:41 +00:00
Saleem Abdulrasool 15a906cf37 builtins: correct constant alignments
MMX/SSE instructions expect 128-bit alignment (16-byte) for constants that they
reference.  Correct the alignment on the constant values.  Although it is quite
possible for the data to end up aligned, there is no guarantee that this will
occur unless it is explicitly aligned to the desired location.  If the data ends
up being unaligned, the resultant binary would fault at runtime due to the
unaligned access.

As an example, the follow would fault previously:
  cc -c lib/builtins/x86_64/floatundidf.S -o floatundidf.o
  cc -c test/builtins/Unit/floatundidf_test.c -o floatundidf_test.c
  ld -m elf_x86_64 floatundidf.o floatundidf_test.o -lc -o floatundidf

However, if the object files were reversed, the data would end up aligned and
the problem would go unnoticed.

llvm-svn: 214033
2014-07-26 21:08:34 +00:00
Dmitry Vyukov 7b70cadae9 tsan: advise shadow for 0x7f region to not use huge pages
see the comment for justification

llvm-svn: 214030
2014-07-26 17:41:10 +00:00
Dmitry Vyukov 5b1b02eb29 tsan: improve shadow flush benchmark
allow to specify access stride

llvm-svn: 214029
2014-07-26 16:40:33 +00:00
Dmitry Vyukov 4baa65518b tsan: reduce internal allocator region from 16M to 1M
16M regions can waste almost 1G for nothing.
Since region size is used only during initial heap growth,
it's unclear why we even need such huge regions.

llvm-svn: 214027
2014-07-26 10:17:26 +00:00
Dmitry Vyukov 07fdaf97e4 tsan: remove meta from internal allocator
I am puzzled why it is even there.

llvm-svn: 214026
2014-07-26 10:06:11 +00:00
Nick Lewycky 1f30f5aef7 Satisfy -Wparentheses.
llvm-svn: 214017
2014-07-26 05:07:41 +00:00
Saleem Abdulrasool 7618240aa9 builtins: re-enable building assembly sources
Re-apply SVN r213684 which was reverted in SVN r213724 since it broke the
build bots.  Add a tweak to enable inclusion of the assembly sources in
standalone build as well.

Original commit message:

This patch address the PR20360. The CMake assembler build system
ignores the .S assembly files in builtins library build. This patch
fixes the issue.

llvm-svn: 214013
2014-07-26 04:04:02 +00:00
Saleem Abdulrasool 93efc78a04 builtins: make the x86_64 compatible with GAS
The .rodata directive was added on the IA-64 (Itanium) platform.  The LLVM IAS
supports the .rodata on i386 and x86_64 as well.  There is no reason to really
restrict compilation of the builtins to just clang.  By explicitly indicating
that the data is meant to be pushed into the .rodata section via the .section
.rodata, the assembly is made compatible with clang and gcc (with GAS).

This will enable building these routines on the Linux buildbots via CMake.

llvm-svn: 214012
2014-07-26 04:03:59 +00:00
Alexey Samsonov e87e5ce5d6 [UBSan] Initialize symbolizer inside __ubsan::Init().
We used to initialize symbolizer lazily, but this doesn't work in
various sandboxed environments. Instead, let's be consistent with
the rest of sanitizers.

llvm-svn: 214006
2014-07-26 01:41:45 +00:00
Alexey Samsonov 1440105338 [Sanitizer] Simplify Symbolizer creation interface.
Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.

No functionality change.

llvm-svn: 214005
2014-07-26 01:37:23 +00:00
Alexey Samsonov f51b9488c6 [DFSan] Fixup for r213980
llvm-svn: 213997
2014-07-26 00:49:36 +00:00
Alexey Samsonov 6eb53d6460 [UBSan] Call UBSan initialization as early as possible.
Specifically, use .preinit_array initialization on Linux and dynamic global
initializer on another platforms. Historically UBSan didn't have any
initialization code and its runtime was stateless. This is no longer the
case - UBSan relies on some non-trivial functionality from sanitizer_common
(e.g. online symbolization) and is now configurable by runtime flags.
Additionally, we've dropped support for enabling UBSan only for a few shared
objects, so UBSan is now always linked into the main executable, so now
we can use similar initialization as all the rest sanitizers.

llvm-svn: 213983
2014-07-25 22:24:34 +00:00
Alexey Samsonov 2178054216 [Sanitizer] Introduce SANITIZER_CAN_USE_PREINIT_ARRAY definition and use it across sanitizers.
Get rid of ASAN_USE_PREINIT_ARRAY and LSAN_USE_PREINIT_ARRAY - just always
use .preinit_array if it's available. This mode seems stable enough, and
we've been relying on default values of these macro for a long time.

llvm-svn: 213980
2014-07-25 22:05:02 +00:00
Dmitry Vyukov 6819cf4974 tsan: query RSS every 100ms
Now that it become faster, it's OK to query it every 100ms again.

llvm-svn: 213943
2014-07-25 13:48:25 +00:00
Dmitry Vyukov fe17080c88 tsan: fix and make faster GetRSS
It is currently broken because it reads a wrong value from profile (heap instead of total).
Also make it faster by reading /proc/self/statm. Reading of /proc/self/smaps
can consume more than 50% of time on beefy apps if done every 100ms.

llvm-svn: 213942
2014-07-25 13:47:57 +00:00
Viktor Kutuzov d712403b98 Allow initialization of Asan interceptors before the general Asan initialization takes place on FreeBSD
Differential Revision: http://reviews.llvm.org/D4496

llvm-svn: 213941
2014-07-25 12:45:36 +00:00
Viktor Kutuzov 2fde54f48c Support traversing ELF objects for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4656

llvm-svn: 213940
2014-07-25 12:29:04 +00:00
Alexander Potapenko 08cfa79d87 [lsan] Follow-up for r213518: replace MAP_ANONYMOUS with MAP_ANON
(despite it's deprecated on Linux) to remove the ifdefs.

llvm-svn: 213929
2014-07-25 08:57:51 +00:00
Viktor Kutuzov 545ff90d47 Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON
Differential Revision: http://reviews.llvm.org/D4561

llvm-svn: 213858
2014-07-24 12:05:13 +00:00
Alexey Samsonov 16ea3268b2 Build libcxx-tsan only if TSan is supported on host architecture
llvm-svn: 213791
2014-07-23 20:07:26 +00:00
Alexey Samsonov db615d565d Fix unused-variable warning
llvm-svn: 213786
2014-07-23 19:40:54 +00:00
Alexey Samsonov bfa711c8b0 [UBSan] Add the ability to dump call stacks to -fsanitize=vptr
This change introduces the first UBSan-specific runtime flag: print_stacktrace
(off by default). It can be set in UBSAN_OPTIONS to unwind and print call stacks
in addition to diagnostic messages. For now these stacks are printed only
in vptr checker.

This change is based on http://reviews.llvm.org/D4410 by Byoungyoung Lee!

llvm-svn: 213783
2014-07-23 18:44:54 +00:00
Alexey Samsonov cd875aa551 [UBSan] Introduce UBSAN_OPTIONS environment variable.
If UBSan is run in a standalone mode (w/o any other sanitizer), it
still uses functions from sanitizer_common, some of which depend on
the value of runtime flags. Allow to override the default values of these
flags with UBSAN_OPTIONS variable. In particular, UBSAN_OPTIONS=symbolize=0
can be used to turn off online symbolization.

llvm-svn: 213782
2014-07-23 18:32:55 +00:00
Renato Golin bb3d7b5e81 Revert "Include assembly files in builtins library build"
This reverts commit r213684, since it was breaking the compiler-rt
build and the sanitizers' bot.

llvm-svn: 213724
2014-07-23 04:46:23 +00:00
Alexey Samsonov ad63cfd7e5 [Sanitizer] Disable Wframe-larger-than on PowerPC hosts
llvm-svn: 213702
2014-07-22 23:10:13 +00:00
Renato Golin 8c714213d5 Fix incompatible assembly in ARM builtins library
Convert the CBNZ backward branch instruction to CMP and BNE
avoiding illegal backwards branch and making the assembly code
in synh-ops.h to be UAL compliant.

Patch by: Sumanth Gundapaneni

llvm-svn: 213685
2014-07-22 20:59:41 +00:00
Renato Golin aad0347c8b Include assembly files in builtins library build
The CMake assembler build system ignores the .S assembly files in builtins
library build. This patch fixes the issue.

Patch by: Sumanth Gundapaneni

llvm-svn: 213684
2014-07-22 20:59:38 +00:00
Timur Iskhodzhanov 4bea5a83bd [ASan/Win tests] Bring back -GS- as SEH tests fail otherwise
llvm-svn: 213668
2014-07-22 16:09:11 +00:00
Timur Iskhodzhanov 74487a7c32 [ASan/Win tests] Don't generate debug info where it is not needed
Otherwise it results in flaky tests

llvm-svn: 213667
2014-07-22 15:53:10 +00:00
Timur Iskhodzhanov cb5bf58f3d [ASan/Win] Add SEH handling to the DLL thunk as well
llvm-svn: 213656
2014-07-22 14:02:53 +00:00
Timur Iskhodzhanov 6d4a6cd68f [ASan/Win] Handle SEH exceptions (best-effort, similar to longjmp)
llvm-svn: 213654
2014-07-22 13:44:18 +00:00
Timur Iskhodzhanov f2b96e3009 [ASan/Win] Add handling of C++ exceptions to the RTL
Also add a longjmp() test

llvm-svn: 213649
2014-07-22 12:37:51 +00:00
Timur Iskhodzhanov 8f41c3eb74 [ASan] Simplify exception/longjmp tests even further
llvm-svn: 213646
2014-07-22 12:25:51 +00:00
Timur Iskhodzhanov 723c81ff80 [ASan] Split throw_catch tests into two files: throw/catch + longjmp
Also add some more assertions into these tests

llvm-svn: 213642
2014-07-22 11:46:24 +00:00
Alexey Samsonov d6906e4ffe [MSan] Fix strncpy interceptor
llvm-svn: 213590
2014-07-22 00:10:08 +00:00
Alexey Samsonov a89ad664b1 [ASan] Fix __asan_describe_address and add a test for it.
llvm-svn: 213583
2014-07-21 21:33:46 +00:00
Alexey Samsonov 4532489752 Adjust gen_dynamic_list for PowerPC function descriptors
llvm-svn: 213577
2014-07-21 19:01:03 +00:00
Alexander Potapenko 96008ea849 [lsan] Allow using ucontext.h in the test on OSX.
llvm-svn: 213523
2014-07-21 13:35:09 +00:00
Alexander Potapenko e816521c00 [lsan] Define MAP_ANONYMOUS as MAP_ANON for OSX in the test.
llvm-svn: 213518
2014-07-21 13:12:44 +00:00
Alexander Potapenko 4789f63bf3 [lsan] Use a more standard-conformant sched_yield() instead of pthread_yield().
There's no pthread_yield() on OSX (only sched_yield() and pthread_yield_np()).

llvm-svn: 213516
2014-07-21 13:01:06 +00:00
Joerg Sonnenberger 9720fcf4bf Redo THUMB support.
Discussed with and tested by: Saleem Abdulrasool

llvm-svn: 213481
2014-07-20 20:53:37 +00:00
Joerg Sonnenberger 8f6cf7085a Revert r213467, it breaks non-thumb mode.
llvm-svn: 213479
2014-07-20 20:00:26 +00:00
Saleem Abdulrasool 8817bfe7e2 ARM: fix division in some cases
For ARM cores that are ARMv6T2+ but not ARMv7ve or ARMv7-r and not an updated
ARMv7-a that has the idiv extension (chips with clz but not idiv), an incorrect
jump would be calculated due to the preference to thumb instructions over ARM.

Rather than computing the target at runtime, use a jumptable instead.  This
trades a bit of storage for performance.  The overhead is 32-bytes for each of
the three routines, but avoid the calculation of the offset.

Because clz was introduced in ARMv6T2 and idiv in certain versions of ARMv7,
the non-clz, non-idiv case implies a target which does not support Thumb-2, and
thus we cannot use Thumb on those targets (as it is unlikely that the assembly
will assemble).

Take the opportunity to refactor the IT block macros into assembly.h rather than
redefining them in the TUs where they are used.

Existing tests cover the full change already, so no new tests are added.

This effectively reverts SVN r213309.

llvm-svn: 213467
2014-07-20 04:44:21 +00:00
Dmitry Vyukov 9cf7ac7589 tsan: fix Go runtime build with clang
llvm-svn: 213384
2014-07-18 15:32:22 +00:00
Dmitry Vyukov a8df247f5a tsan: expose atomic operations in Go runtime
llvm-svn: 213382
2014-07-18 14:54:02 +00:00
Viktor Kutuzov 5f5adb8ed5 Add FreeBSD support to the Asan symbolization script
Differential Revision: http://reviews.llvm.org/D4560

llvm-svn: 213370
2014-07-18 12:07:00 +00:00
Viktor Kutuzov 838afd799d Add FreeBSD support to the address sanitizer's waitid.cc test case
Differential Revision: http://reviews.llvm.org/D4422

llvm-svn: 213368
2014-07-18 12:02:42 +00:00
Stephen Hines 31a38cc32f Revert Thumb-2 conversion of some ARM builtins.
The udivmodsi4/modsi3/umodsi3 code computes jump targets based on ARM encodings
(if CLZ is present and IDIV is not present).

Reverts parts of r211032 and r211035.

llvm-svn: 213309
2014-07-17 20:41:01 +00:00
Evgeniy Stepanov 92d20f3f90 [asan] Remove leftover debug printf.
llvm-svn: 213264
2014-07-17 13:05:21 +00:00
Evgeniy Stepanov f62cd5559e [asan] Fix malloc interception on Android L Preview.
Format of __libc_malloc_dispatch has changed in Android L.
While we are moving towards a solution that does not depend on bionic
internals, here is something to support both K* and L releases.

llvm-svn: 213263
2014-07-17 12:48:45 +00:00
Kuba Brecka 033890cd0a [compiler-rt] [asan] Refactor DescribeAddressIfStack to allow reuse for debugging API
Refactoring the DescribeAddressIfStack function in asan_report.cc to be able to reuse it for http://reviews.llvm.org/D4527.

Reviewed at http://reviews.llvm.org/D4545.

llvm-svn: 213215
2014-07-17 00:18:03 +00:00
Timur Iskhodzhanov bdf23a51b1 [ASan/Win] Handle situations when the client app has used DbgHelp before
Reviewed at http://reviews.llvm.org/D4533

llvm-svn: 213151
2014-07-16 14:11:02 +00:00
Timur Iskhodzhanov 5d96f44da1 [ASan] Adjust 'sed' invocation to work on OS X
This is a follow-up to r213053

llvm-svn: 213144
2014-07-16 12:56:47 +00:00
Alexander Potapenko 9c62a6d8a2 [ASan] Factor out SymbolizationLoop.process_line() function to let Python
scripts that import asan_symbolize to symbolize their reports line by line.

llvm-svn: 213136
2014-07-16 11:00:16 +00:00
Viktor Kutuzov 4a9638324a Add FreeBSD support to the address sanitizer's assign_large_valloc_to_global.cc test case
Differential Revision: http://reviews.llvm.org/D4525

llvm-svn: 213135
2014-07-16 10:14:01 +00:00
Viktor Kutuzov f7dfafe712 Add FreeBSD support to the address sanitizer's atexit_stats.cc test case
Differential Revision: http://reviews.llvm.org/D4524

llvm-svn: 213134
2014-07-16 10:05:29 +00:00
Viktor Kutuzov 39c28e86a6 Remove explicit references to libdl from Asan test cases
Differential Revision: http://reviews.llvm.org/D4499

llvm-svn: 213131
2014-07-16 09:53:00 +00:00
Viktor Kutuzov 82041bbc08 Add FreeBSD support to the address sanitizer's null_deref.cc test case
Differential Revision: http://reviews.llvm.org/D4421

llvm-svn: 213130
2014-07-16 09:37:40 +00:00
Kuba Brecka 58f44dce96 [ASan] Add ASan debugging API to get malloc/free stack traces and shadow memory mapping info
Reviewed at http://reviews.llvm.org/D4466

llvm-svn: 213080
2014-07-15 17:33:23 +00:00
Dmitry Vyukov 1015f8d753 tsan: remove special handling of false reports coming from JVM
There is now a more common functionality in the form of called_from_lib suppressions.

llvm-svn: 213057
2014-07-15 09:38:30 +00:00
Dmitry Vyukov 48b00fe8f9 tsan: remove compat mapping
There are no known usages anymore, so one less thing to support.

llvm-svn: 213056
2014-07-15 09:31:29 +00:00
Evgeniy Stepanov bce3cf8074 [sanitizer] De-flake one test.
llvm-svn: 213054
2014-07-15 08:46:51 +00:00
Timur Iskhodzhanov 9e4580c8ee [ASan] Only define macros in asan_init_version.h, move the __asan_init declaration back to asan_interface_internal.h
This fixes the issues we've uncovered after landing r212815.

Reviewed at http://reviews.llvm.org/D4500

llvm-svn: 213053
2014-07-15 08:16:04 +00:00
Ehsan Akhgari 911ea4e2be Add support for intercepting thunks of the form
llvm-svn: 212979
2014-07-14 20:28:21 +00:00
Timur Iskhodzhanov 0aad92e0d6 [ASan/Win] Add a test for the case when dll_thunk is linked twice to the same DLL
This is a test case for r212815.

llvm-svn: 212959
2014-07-14 17:04:03 +00:00
Kostya Serebryany 6cdb0b8051 [tsan] honour XFAIL in tsan/test_output.sh
llvm-svn: 212952
2014-07-14 16:03:13 +00:00
Kostya Serebryany 850a837cf2 [tsan] add a printf to a test
llvm-svn: 212951
2014-07-14 15:52:33 +00:00
Kostya Serebryany 94b6801839 [tsan] add a currently-failing test with a must-deadlock
llvm-svn: 212944
2014-07-14 14:27:21 +00:00
Timur Iskhodzhanov 9b8fa878ea [ASan] Fix a couple of nits in NULL deref tests
This is a follow-up to r212807

llvm-svn: 212943
2014-07-14 14:26:35 +00:00
Evgeniy Stepanov d73e7cc879 [sanitizer] Intercept getpass.
llvm-svn: 212937
2014-07-14 13:07:51 +00:00
Evgeniy Stepanov 465466e80c [msan] Stop demangling function name in the stack origin report.
This was done by calling __cxa_demangle directly, which is bad
when c++abi library is instrumented. The following line always
contains the demangled name (when running with a symbolizer) anyway.

llvm-svn: 212929
2014-07-14 09:35:27 +00:00
Evgeniy Stepanov 6c254aa70e [asan] Remove XFAIL:android from 2 newly passing tests.
Fixed in r212872.

llvm-svn: 212926
2014-07-14 08:54:10 +00:00
Alexey Samsonov 15c9669615 [ASan] Collect unmangled names of global variables in Clang to print them in error reports.
Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

llvm-svn: 212872
2014-07-12 00:42:52 +00:00
Alexey Samsonov ae9d59e8c4 [ASan] Improve ODR-violation error reports.
Demangle names of involved globals. Print a more consistent summary line.

llvm-svn: 212857
2014-07-11 23:34:26 +00:00