Commit Graph

4151 Commits

Author SHA1 Message Date
Viktor Kutuzov 9deb007191 [Tsan] Make calloc() to not track allocated space unless thread is completely initialized
Differential Revision: http://reviews.llvm.org/D5992

llvm-svn: 220673
2014-10-27 11:19:08 +00:00
Viktor Kutuzov a58fed9ab7 [Tsan] Fix guessing data range on FreeBSD
Differential Revision: http://reviews.llvm.org/D5990

llvm-svn: 220672
2014-10-27 11:14:24 +00:00
Alexey Samsonov e853b4f2e4 [Sanitizer] Return code that calculates hash for stacktrace back to StackDepot implementation
llvm-svn: 220663
2014-10-27 03:10:27 +00:00
Hans Wennborg f89a3f8623 Try to fix the Windows build after r220637
llvm-svn: 220643
2014-10-26 19:27:02 +00:00
Alexey Samsonov 3741ab82ba Change StackDepot interface to use StackTrace more extensively
llvm-svn: 220637
2014-10-26 06:23:07 +00:00
Alexey Samsonov 6e7af8156f Fixup deadlock sanitizer after r220635
llvm-svn: 220636
2014-10-26 05:43:17 +00:00
Alexey Samsonov 9c85927012 [Sanitizer] Make StackTrace a lightweight reference to array of PCs, and
introduce a BufferedStackTrace class, which owns this array.

Summary:
This change splits __sanitizer::StackTrace class into a lightweight
__sanitizer::StackTrace, which doesn't own array of PCs, and BufferedStackTrace,
which owns it. This would allow us to simplify the interface of StackDepot,
and eventually merge __sanitizer::StackTrace with __tsan::StackTrace.

Test Plan: regression test suite.

Reviewers: kcc, dvyukov

Reviewed By: dvyukov

Subscribers: llvm-commits

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

llvm-svn: 220635
2014-10-26 03:35:14 +00:00
Saleem Abdulrasool d888169d75 builtins: avoid endian.h in favour of compiler builtins
Use the __BYTE_ORDER__ macro which has been available in GCC since 4.6 and is
available in clang as well.

llvm-svn: 220626
2014-10-25 20:54:51 +00:00
Alexey Samsonov 3ca50c34ec Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
llvm-svn: 220582
2014-10-24 18:34:43 +00:00
Dmitry Vyukov e9a5f03716 tsan: support mmap(MAP_32BIT)
Allow user memory in the first TB of address space.
This also enabled non-pie binaries and freebsd.
Fixes issue:
https://code.google.com/p/thread-sanitizer/issues/detail?id=5

llvm-svn: 220571
2014-10-24 17:07:29 +00:00
Viktor Kutuzov a836924be4 [Tsan] Do not intercept non-FreeBSD functions on FreeBSD
Differential Revision: http://reviews.llvm.org/D5858

llvm-svn: 220554
2014-10-24 10:55:03 +00:00
Viktor Kutuzov 6a9dec2aa2 [Tsan] Intercept pthread_set_name_np on FreeBSD
Differential Revision: http://reviews.llvm.org/D5932

llvm-svn: 220551
2014-10-24 09:23:06 +00:00
Evgeniy Stepanov 7900202e14 [sanitizer] Add a bunch of sanity checks.
llvm-svn: 220528
2014-10-23 22:29:51 +00:00
Aaron Ballman 29eec9a520 Appeasing an MSVC compile warning about "and"; NFC.
llvm-svn: 220519
2014-10-23 21:59:34 +00:00
Kostya Serebryany 2bd7631520 [tsan] add a stub of another dynamic annotation
llvm-svn: 220369
2014-10-22 05:02:20 +00:00
Evgeniy Stepanov 35eb265421 [msan] Handle param-tls overflow.
ParamTLS (shadow for function arguments) is of limited size. This change
makes all arguments that do not fit unpoisoned, and avoids writing
past the end of a TLS buffer.

llvm-svn: 220351
2014-10-22 00:12:40 +00:00
Evgeniy Stepanov 5efbbca818 [sanitizer] Fix build with _FILE_OFFSET_BITS=64.
Sanitizer source is not affected by _FILE_OFFSET_BITS in general,
but this one file must be built with 32-bit off_t. More details in the code.

llvm-svn: 220328
2014-10-21 21:08:13 +00:00
Viktor Kutuzov cdcc46dc84 [Tsan] Add FreeBSD support to longjmp-related definitions
Differential Revision: http://reviews.llvm.org/D5857

llvm-svn: 220292
2014-10-21 13:38:05 +00:00
Viktor Kutuzov 6acdc50267 [Tsan] Fix sigaction_t to match system definition on FreeBSD
Differential Revision: http://reviews.llvm.org/D5856

llvm-svn: 220291
2014-10-21 13:31:05 +00:00
Alexey Samsonov 3eb69f5482 Remove unused local variable
llvm-svn: 220247
2014-10-20 23:58:08 +00:00
Dan Albert c5d4bc7581 Fix checks for Android.
__ANDROID__ is a define that comes from the toolchain when building
for Android targets. ANDROID has a different meaning. ANDROID is
defined for _every_ Android build, including those done for host
modules. For host modules, we want to build the regular Linux
sanitizers and builtins, not the one for Android devices. This hasn't
been a problem until now because we only just started building the
sanitizers for the host.

llvm-svn: 220203
2014-10-20 15:35:01 +00:00
Kostya Serebryany c9855da6d9 [asan] the run-time part of intra-object-overflow detector (-fsanitize-address-field-padding=1). Note that all of this is still experimental; don't use unless you are brave.
llvm-svn: 220013
2014-10-17 01:22:37 +00:00
Kostya Serebryany 87b70fc823 [asan] make sure coverage is dumped even if leaks are reported
llvm-svn: 219946
2014-10-16 18:59:07 +00:00
Kuba Brecka 14c0c5901d [compiler-rt] compiler-rt's CMake append_if function clashes with LLVM's, let's rename it to append_list_if
Doing s/append_if/append_list_if/, no functional change.

http://reviews.llvm.org/D5739

llvm-svn: 219860
2014-10-15 22:47:54 +00:00
Will Schmidt a286594237 [compiler-rt] Enable ASAN for powerpc64le-linux
Whitespace update for lint check by myself (Will).  Otherwise code and comments by Peter Bergner, as previously seen on llvm-commits. 

    The following patch gets ASAN somewhat working on powerpc64le-linux.
    It currently assumes the LE kernel uses 46-bit addressing, which is
    true, but it doesn't solve the case for BE where it may be 44 or
    46 bits.  That can be fixed with a follow on patch.
    
    There are some test suite fails even with this patch that I haven't had
    time to solve yet, but this is better than the state it is in now.
    The limited debugging of those test suite fails seems to show that the
    address map for 46-bit addressing has changed and so we'll need to
    modify the shadow memory location slightly.  Again, that can be fixed
    with a follow on patch.

llvm-svn: 219827
2014-10-15 18:34:04 +00:00
Dmitry Vyukov 6373829449 tsan: fix false positive related to signals
Write interceptor calls malloc, which causes a false
unsafe-call-in-signal-handler report. See the test.

llvm-svn: 219784
2014-10-15 08:56:43 +00:00
Dmitry Vyukov a08a8dc01d tsan: use a different dir for llvm build
build is used as gtest temp build dir, and is cleared during every build

llvm-svn: 219783
2014-10-15 08:56:15 +00:00
Dmitry Vyukov f03e719f23 tsan: remove dead code
llvm-svn: 219779
2014-10-15 05:38:49 +00:00
Ed Maste 3ba162d2f9 Fix compiler-rt build on FreeBSD 10.1
We have to #define _WANT_RTENTRY to get struct rtentry, and add headers
that it depends on.

SIOCADDRT and SIOCDELRT also do not exist in FreeBSD 10.1 and were removed
in FreeBSD rev. 263203:

  Garbage collect long time obsoleted (or never used) stuff from routing
  API.

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

llvm-svn: 219722
2014-10-14 21:08:35 +00:00
Bob Wilson ca0a38e0ae Add complex multiply/divide functions to arm64 iOS libclang_rt libraries.
Clang r219557 introduces libcalls to complex multiply/divide functions.
Since these functions are not available in iOS for arm64 devices, add them to
the static libraries.

llvm-svn: 219715
2014-10-14 20:33:36 +00:00
Evgeniy Stepanov 9e984c5137 [sanitizer] Fix a crash in FP unwinder on ARM.
This change fixes 2 issues in the fast unwinder from r217079:
* A crash if a frame pointer points below current stack head, but
  inside the current thread stack limits. That memory may be
  unmapped. A check for this was lost in r217079.
* The last valid stack frame (the first one with an invalid next
  frame pointer) is always interpreted as a GCC layout frame. This
  results in garbled last PC in the (expected) case when the last
  frame has LLVM layout.

llvm-svn: 219683
2014-10-14 13:46:07 +00:00
Renato Golin 8fcae0b35e Fix silly commit to disable test on ARM
llvm-svn: 219681
2014-10-14 12:32:47 +00:00
Renato Golin 3743568735 Disable failing ASAN LongJump test on ARM
Updated the URL to reflect information on the problem as well as build the
case for ARM. This seems to be a wider problem, not ARM or PPC specific.

llvm-svn: 219680
2014-10-14 12:24:28 +00:00
Dmitry Vyukov 4eebdf22ef tsan: remove trailing whitespace
llvm-svn: 219678
2014-10-14 09:46:56 +00:00
Evgeniy Stepanov f518a4e774 [asan] Add fast_unwind_on_check flag.
Allows to specify the unwinder to use for CHECK failures. Previous behaviour
was to use the "fatal" unwinder.
As compiler-rt is built without frame pointers, only the slow unwinder
really makes sense here, and it is the default.

llvm-svn: 219677
2014-10-14 09:36:24 +00:00
Dmitry Vyukov ea2f3bffca tsan: refactor atexit handling
The current handling (manual execution of atexit callbacks)
is overly complex and leads to constant problems due to mutual ordering of callbacks.
Instead simply wrap callbacks into our wrapper to establish
the necessary synchronization.
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=80

llvm-svn: 219675
2014-10-14 09:32:45 +00:00
Alexey Samsonov eb47d8a2c8 Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642
2014-10-13 23:59:00 +00:00
Dmitry Vyukov 02ff8bb986 tsan: better reporting for virtual-call-after-free
Previously we said that it's a data race, which is confusing
if it happens in the same thread.

llvm-svn: 219600
2014-10-13 08:46:25 +00:00
Viktor Kutuzov 4546519196 [Tsan] Do not use INTERCEPT_FUNCTION_VER() on FreeBSD
Differential Revision: http://reviews.llvm.org/D5708

llvm-svn: 219483
2014-10-10 07:11:58 +00:00
Viktor Kutuzov bafaa7f6ba [Sanitizers] Intercept dlopen() and dlclose() on FreeBSD
Differential Revision: http://reviews.llvm.org/D5664

llvm-svn: 219396
2014-10-09 08:59:59 +00:00
Viktor Kutuzov 2ed7c9df7f [Tsan] Fix references to libc entities in tsan_interceptors.cc on FreeBSD
Differential Revision: http://reviews.llvm.org/D5663

llvm-svn: 219395
2014-10-09 08:56:22 +00:00
Ed Maste e4320f5e6a Remove bashisms and switch to /bin/sh
On a default FreeBSD install Bash is not installed and fdescfs is not
mounted.  Use plain sh functionality instead.

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

llvm-svn: 219333
2014-10-08 18:35:16 +00:00
Tim Northover a5a06ad6fc AArch64: add support for ARM64 iOS versions of compiler-rt.
Just a dummy directory and a few sane choices in the Darwin SDK.

rdar://problem/18575597

llvm-svn: 219323
2014-10-08 17:28:37 +00:00
Lorenzo Martignoni 60ebffc12f Custom wrappers for DFSanitizing sprintf & snprintf.
Differential Revision: http://reviews.llvm.org/D5561

llvm-svn: 219293
2014-10-08 10:01:42 +00:00
Ed Maste 89b80fb022 Avoid bashisms and switch to /bin/sh
Bash may not be installed on some systems by default, like FreeBSD.

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

llvm-svn: 219231
2014-10-07 20:23:57 +00:00
Saleem Abdulrasool 2cf5d82983 builtins: add missed change from previous commit
The macro rework was missing a trailing SEPARATOR for the .thumb_func, resulting
in assembly failures.

llvm-svn: 219183
2014-10-07 03:00:17 +00:00
Saleem Abdulrasool 48d4e4dd35 builtins: rework use of DEFINE_COMPILERRT_THUMB_FUNCTION
This is simply to help clarity of the code.  The functions are built as thumb
only if Thumb2 is available (__ARM_ARCH_ISA_THUMB == 2).  Sink the selection
into the location of the definition and make DEFINE_COMPILERRT_THUMB_FUNCTION
always define a thumb function while DEFINE_COMPILERRT_FUNCTION always selects
the default.

Since the .thumb_func directive is always available (at least on Linux, Windows,
and BSD), sinking the macro right into the macro works just as well.

No functional change intended.

llvm-svn: 219182
2014-10-07 02:39:13 +00:00
Evgeniy Stepanov faef77480d [asan] Minor tweak to asan_device_setup.
Add another wait-for-device which may fix a flaky setup error.
Fix output message.

llvm-svn: 219117
2014-10-06 12:45:39 +00:00
Bob Wilson 115547464e Try harder to fix ARM/Linux after r219040.
llvm-svn: 219066
2014-10-04 20:11:10 +00:00
Bob Wilson d2f1281e6c Attempt to fix ARM/Linux after r219040.
llvm-svn: 219064
2014-10-04 18:13:41 +00:00