Commit Graph

734 Commits

Author SHA1 Message Date
Reid Kleckner 60e53cdcb7 Fix order of arguments to fputs
This time actually tested on Linux, where the test is not XFAILed.

llvm-svn: 263294
2016-03-11 21:07:48 +00:00
Reid Kleckner 3b07caef66 Switch to fputs stderr to try to fix output buffering issues
llvm-svn: 263293
2016-03-11 20:54:14 +00:00
Reid Kleckner 7a2113882f Make printf-4 more robust to strlen interception after r263177
The CHECK line was matching stack-buffer-overflow from puts calling
strlen, which is not the bug the test is trying to catch.

llvm-svn: 263282
2016-03-11 19:11:15 +00:00
Alexey Samsonov 54411d5042 Fix ASan test cases after r263177
llvm-svn: 263195
2016-03-11 05:04:49 +00:00
Reid Kleckner ad04914a53 [Windows] Fix UnmapOrDie and MmapAlignedOrDie
Now ASan can return virtual memory to the underlying OS. Portable
sanitizer runtime code needs to be aware that UnmapOrDie cannot unmap
part of previous mapping.

In particular, this required changing how we implement MmapAlignedOrDie
on Windows, which is what Allocator32 uses.

The new code first attempts to allocate memory of the given size, and if
it is appropriately aligned, returns early. If not, it frees the memory
and attempts to reserve size + alignment bytes. In this region there
must be an aligned address. We then free the oversized mapping and
request a new mapping at the aligned address immediately after. However,
a thread could allocate that virtual address in between our free and
allocation, so we have to retry if that allocation fails. The existing
thread creation stress test managed to trigger this condition, so the
code isn't totally untested.

Reviewers: samsonov

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

llvm-svn: 263160
2016-03-10 20:47:26 +00:00
Filipe Cabecinhas 721447c873 [test/asan/closed-fds] Properly quote log_path for shell invocation.
llvm-svn: 263106
2016-03-10 11:51:59 +00:00
Alexey Samsonov c8f2c957e0 [asan] Fix odr_c_test failure with gold linker
Summary:
Adds another global to asan's odr_c_test to help force the target global to
not lie at the start of bss with the gold linker where it is always
aligned.

Patch by Derek Bruening!

llvm-svn: 262678
2016-03-04 00:41:39 +00:00
Evgeniy Stepanov aafe4b63d9 [asan] Fix new[]/delete mismatch in tests.
This code is actually never executed because all RUN lines trigger an
earlier heap-use-after-free, but there is still a compiler warning.

llvm-svn: 262276
2016-03-01 00:38:39 +00:00
Maxim Ostapenko d0257b7bf1 [asan] Fix UB in test/asan/TestCases/Linux/recvfrom.cc testcase.
llvm-svn: 262210
2016-02-29 08:56:26 +00:00
Maxim Ostapenko 8d8f919cf5 [asan] Re-enable test/asan/TestCases/Linux/recvfrom.cc testcase.
This testcase failed on sanitizer-x86_64-linux buildbot in large parallel build due to race on
port 1234 between AddressSanitizer-i386-linux and AddressSanitizer-x86_64-linux instances of recvfrom.cc.
This patch tries to resolve the issue by relying on kernel to choose available port instead of hardcoding
its number in testcase.

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

llvm-svn: 262204
2016-02-29 07:47:35 +00:00
Maxim Ostapenko 50ca4464c4 [sanitizer] Fix third parameter in COMMON_INTERCEPTOR_WRITE_RANGE in recv and recvfrom interceptors.
Pass res instead of len as third parameter to COMMON_INTERCEPTOR_WRITE_RANGE,
because otherwise we can write to unrelated memory (in MSan) or get wrong report (in ASan).

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

llvm-svn: 261898
2016-02-25 17:07:38 +00:00
Maxim Ostapenko 640d1fc46c [asan] Disable recvfrom test failing on the bots.
llvm-svn: 261870
2016-02-25 14:58:07 +00:00
Maxim Ostapenko 1f4cea0467 [asan] Disable recvfrom testcase on Android due to buildbot failure.
Trying to fix following error on Android:

FAIL: AddressSanitizer-arm-android :: TestCases/Linux/recvfrom.cc (47 of 350)
...
Command Output (stderr):
--
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:22:22: error: variable has incomplete type 'struct sockaddr_in'
  struct sockaddr_in serveraddr; // server's addr
                     ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:22:10: note: forward declaration of 'sockaddr_in'
  struct sockaddr_in serveraddr; // server's addr
         ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:29:38: error: use of undeclared identifier 'INADDR_ANY'
  serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
                                     ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:30:25: error: use of undeclared identifier 'htons'
  serveraddr.sin_port = htons(kPortNum);
                        ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:45:22: error: variable has incomplete type 'struct sockaddr_in'
  struct sockaddr_in serveraddr; // server's addr
                     ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:45:10: note: forward declaration of 'sockaddr_in'
  struct sockaddr_in serveraddr; // server's addr
         ^
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/asan/TestCases/Linux/recvfrom.cc:69:25: error: use of undeclared identifier 'htons'
  serveraddr.sin_port = htons(kPortNum);

llvm-svn: 261855
2016-02-25 10:55:52 +00:00
Maxim Ostapenko 7389936f57 [sanitizer] Move recvmsg and recv interceptors to sanitizer_common.
This patch moves recv and recvfrom interceptors from MSan and TSan to
sanitizer_common to enable them in ASan.

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

llvm-svn: 261841
2016-02-25 08:44:25 +00:00
Alexey Samsonov 4d35491a12 [tests] Run test that uses gnu asm syntax on Posix only.
llvm-svn: 261609
2016-02-23 04:10:53 +00:00
Alexey Samsonov 4e796d0c9f [tests] Remove "supported-target" in favor of "target-arch" lit features.
Test cases definitely should not care about the complete set of architectures
supported by compiler-rt - they should only care about current
architecture that the test suite was configured for.

Introduce new lit feature to reflect this, and convert tests to use it.

llvm-svn: 261603
2016-02-23 01:58:56 +00:00
Mike Aizatsky 361a7bb338 [sancov] requiring dynamic asan.
llvm-svn: 261362
2016-02-19 20:47:25 +00:00
Mike Aizatsky 731942565b [sancov] using static asan
We are not able to recover coverage points from dynamically linked
binaries at this point without symbols in @plt tables.

llvm-svn: 261352
2016-02-19 18:46:30 +00:00
Reid Kleckner 12813b0def [Windows] Simplify more tests now that Clang supports EH
Remove TestCases/Windows/throw_catch.cc, since it is redundant with the
portable test TestCases/throw_catch.cc.

llvm-svn: 261342
2016-02-19 17:36:54 +00:00
Reid Kleckner 00203bc60b [Windows] Add 10s timeout to some WaitForSingleObject calls
I ran the test suite yesterday and when I came back this morning the
queue_user_work_item.cc test was hung. This could be why the
sanitizer-windows buildbot keeps randomly timing out. I updated all the
usages of WaitForSingleObject involving threading events. I'm assuming
the API can reliably wait for subprocesses, which is what the majority
of call sites use it for.

While I'm at it, we can simplify some EH tests now that clang can
compile C++ EH.

llvm-svn: 261338
2016-02-19 17:30:38 +00:00
Reid Kleckner 973dacf691 Un-XFAIL the last C++ EH test, it was fixed by r261258
llvm-svn: 261263
2016-02-18 21:24:30 +00:00
Reid Kleckner 7c8e2c37ba Clang on Windows supports exceptions, un XFAIL the passing tests
llvm-svn: 261236
2016-02-18 18:33:58 +00:00
Kostya Serebryany d4590c7304 [sanitizer-coverage] implement -fsanitize-coverage=trace-pc. This is similar to trace-bb, but has a different API. We already use the equivalent flag in GCC for Linux kernel fuzzing. We may be able to use this flag with AFL too
llvm-svn: 261159
2016-02-17 21:34:43 +00:00
Alexey Samsonov 2af1e3e963 PR26606: Make abort_on_error.cc test more portable.
llvm-svn: 261157
2016-02-17 21:25:12 +00:00
Jonas Hahnfeld ccb0e464be [compiler-rt] Fix test failures when switching default C++ library
1. Add two explicit -stdlib=libstdc++ in conjunction with -static-libstdc++
2. Pass -nostdinc++ when adding include paths for libc++ built for tsan. This
   prevents clang finding the headers twice which would confuse #include_next

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

llvm-svn: 260883
2016-02-15 11:28:15 +00:00
Alexey Samsonov eb649bcfb9 [LSan] Print more helpful error message if LSan crashes during leak detection.
llvm-svn: 260717
2016-02-12 20:20:51 +00:00
Mike Aizatsky 92cbbfcd89 [sancov] improved object files handling.
Updating sancov invocation on html_cov_dump.

sancov change: http://reviews.llvm.org/D17169

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

llvm-svn: 260629
2016-02-12 00:29:24 +00:00
Alexey Samsonov d077c29c80 [ASan] Disable test that uses profile runtime on Windows.
llvm-svn: 260561
2016-02-11 18:26:57 +00:00
Reid Kleckner ceda883e4d [Windows] Fill in read/write information in SignalContext
Implements https://github.com/google/sanitizers/issues/653

llvm-svn: 260539
2016-02-11 16:44:35 +00:00
Reid Kleckner 031bbd062b Un-XFAIL a passing test on Windows
llvm-svn: 260481
2016-02-11 02:02:56 +00:00
Reid Kleckner ddcf07d51c Move mmap_limit_mp test to Posix
This test isn't posix specific, but it doesn't pass on Windows and is
XFAILed. I suspect that this test, which is expected to fail, is causing
the hangs I'm seeing on our WinASan builder.  Moving it to Posix seems
to be the cleanest way to avoid running it on Windows.

llvm-svn: 260480
2016-02-11 02:02:52 +00:00
Kostya Serebryany 8c4b9ff921 [asan] update the scariness score: tweak a few weights and add tests
llvm-svn: 260327
2016-02-09 23:46:43 +00:00
Evgeniy Stepanov 52f6c262d9 [asan] Implement SEGV read vs write detection for ARM and AArch64.
llvm-svn: 260163
2016-02-08 22:50:25 +00:00
Kostya Serebryany e4ddfd14f1 [asan] re-commit r259961, this time making the test Linux-Only
llvm-svn: 260128
2016-02-08 19:21:08 +00:00
Maxim Ostapenko 3dd0ec12d7 [asan] XFAIL local_alias.cc testcase on android in order to fix sanitizer-x86_64-linux buildbot.
llvm-svn: 260090
2016-02-08 12:58:05 +00:00
Maxim Ostapenko 08a70542b1 [asan] XFAIL local alias related tests on Mips due to https://llvm.org/bugs/show_bug.cgi?id=26525.
llvm-svn: 260079
2016-02-08 09:50:57 +00:00
Maxim Ostapenko 9ab99ab985 [asan] Introduce new approach for ODR violation detection based on odr indicator symbols.
This is a compiler-rt part of this http://reviews.llvm.org/D15642 patch. Here,
we add a new approach for ODR violation detection.
Instead of using __asan_region_is_poisoned(g->beg, g->size_with_redzone) on
global address (that would return false now due to using private alias), we can
use new globally visible indicator symbol to perform the check.

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

llvm-svn: 260076
2016-02-08 08:39:59 +00:00
Nico Weber d64186f5da Revert r259961, r259978, r259981.
The "sanitizer-windows" buildbot has been failing for two days because of this:

FAILED: cl.exe asan_report.cc
asan_scariness_score.h(60) : error C2536:
  '__asan::ScarinessScore::__asan::ScarinessScore::descr' :
      cannot specify explicit initializer for arrays
asan_scariness_score.h(60) : see declaration of '__asan::ScarinessScore::descr'

llvm-svn: 260059
2016-02-07 21:41:37 +00:00
Kostya Serebryany bafa729e26 [asan] trying to fix the non-x86 bots
llvm-svn: 259981
2016-02-06 04:50:30 +00:00
Kostya Serebryany c02ed2a8e2 [asan] properly report an un-aligned global variable instead of just crashing
llvm-svn: 259979
2016-02-06 03:22:24 +00:00
Kostya Serebryany cfc83bc707 [asan] disabled one subtest in scariness_score_test.cc that may fail when running under GNU make. Add more subtests
llvm-svn: 259978
2016-02-06 02:37:39 +00:00
Kostya Serebryany 23a6822976 [asan] add an experimental feature that prints the scariness score of the error message. To enable it use ASAN_OPTIONS=print_scariness=1
llvm-svn: 259961
2016-02-06 00:29:44 +00:00
Kostya Serebryany 0e05d6eb9c [asan] fix the non-x86 build
llvm-svn: 259745
2016-02-04 02:33:48 +00:00
Kostya Serebryany 2b9be25066 [asan] When catching a signal caused by a memory access, print if it's a READ or a WRITE. This touches win/mac files which I have not tested, if a win/mac bot fails I'll try to quick-fix
llvm-svn: 259741
2016-02-04 02:02:09 +00:00
Maxim Ostapenko 4a3c7fa441 [asan] Fix internal CHECK failure on double free in recovery mode.
This patches fixes https://github.com/google/sanitizers/issues/639

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

llvm-svn: 259473
2016-02-02 07:32:24 +00:00
Anna Zaks 2c5c33dc38 [asan] Fixup r258849 by updating warning in the test
The error message has been changed in code as of r258849 (http://reviews.llvm.org/D16546). Update the test as well.

llvm-svn: 259452
2016-02-02 02:01:21 +00:00
Mike Aizatsky 343322bb93 putting requires on one line - ppc still executes my tests.
llvm-svn: 259012
2016-01-28 02:24:35 +00:00
Mike Aizatsky b4c48d1e15 [sancov] run sancov test on x86_64 linux only
llvm-svn: 259006
2016-01-28 00:35:17 +00:00
Mike Aizatsky ecaeb1d93b [sancov] running sancov test on linux only
llvm-svn: 259004
2016-01-28 00:27:13 +00:00
Mike Aizatsky 2654299d6a [sanitizers] generating html report on coverage dump
Subscribers: tberghammer, danalbert, srhines

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

llvm-svn: 258999
2016-01-27 23:51:36 +00:00
Kostya Serebryany af69f1c690 [asan] print an additional hint when reporting a container overflow
llvm-svn: 258337
2016-01-20 19:49:12 +00:00
Maxim Ostapenko 1965cc6258 [asan] Optionally print reproducer cmdline in ASan reports.
Differential Revision: http://reviews.llvm.org/D16070

llvm-svn: 258037
2016-01-18 07:55:12 +00:00
Mike Aizatsky 54fc6575c5 [sancov] coverage pc buffer
Differential Revision: http://reviews.llvm.org/D15871

llvm-svn: 256804
2016-01-05 01:49:39 +00:00
Evgeniy Stepanov ed61ae6cde [asan] Add mincore test.
ASan does not really do anything interesting with mincore, but this
test verifies that the function still works correctly.

llvm-svn: 256207
2015-12-21 22:35:03 +00:00
Yury Gribov a8ffa6189e [asan] Move halt_on_error_suppress_equal_pcs.cc to Posix directory.
Patch by Max Ostapenko.

llvm-svn: 255230
2015-12-10 08:34:28 +00:00
Yury Gribov 6bfade1b81 [asan] Suppress duplicated errors in ASan recovery mode.
Patch by Max Ostapenko.

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

llvm-svn: 255228
2015-12-10 08:08:53 +00:00
Yury Gribov b18e2c7110 [asan] Enable alloca_vla_interact.cc test on PowerPC64.
Patch by Max Ostapenko.

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

llvm-svn: 254708
2015-12-04 09:32:45 +00:00
Kuba Brecka ab43f42d9c Follow-up of r254600 to fix the dyld_insert_libraries_reexec.cc testcase on OS X 10.10.
llvm-svn: 254604
2015-12-03 11:34:16 +00:00
Yury Gribov 67a001fd17 [asan] Correctly release memory allocated during early startup.
Calloc interceptor initially allocates memory from temp buffer (to serve dlsyms called during asan_init). There is a chance that some non-instrumented library (or executable) has allocated memory with calloc before asan_init and got pointer from the same temporary buffer which later caused problems with free.

Inspired by https://github.com/google/sanitizers/issues/626

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

llvm-svn: 254395
2015-12-01 09:22:41 +00:00
Kuba Brecka ad986d5141 [asan] Fix the atos-symbolizer-dyld-root-path.cc test case
Due to a typo, atos-symbolizer-dyld-root-path.cc is currently being skipped all the time. There's a few more typos/copy-paste-errors. Let's fix them and enable this test.

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

llvm-svn: 254058
2015-11-25 07:59:00 +00:00
Anna Zaks f30f351faf [asan] Disable the test on i386 Darwin.
This test checks if we can print a backtrace from the death callback. On old
OS X versions, backtrace is not able to symbolicate the trace past the ASan
runtime because we build with -fomit-frame-pointer.

llvm-svn: 253729
2015-11-20 22:55:22 +00:00
Yury Gribov dd679b334b [asan] Enable halt_on_error tests on ARM targets.
Differential Revision: http://reviews.llvm.org/D14751

llvm-svn: 253549
2015-11-19 08:36:26 +00:00
Mike Aizatsky b2c5e1b263 Removing memory leak to appease windows bots.
Differential Revision: http://reviews.llvm.org/D14785

llvm-svn: 253507
2015-11-18 21:44:33 +00:00
Mike Aizatsky 52025af820 Disable gvn non-local speculative loads under asan.
Summary: Fix for https://llvm.org/bugs/show_bug.cgi?id=25550

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

llvm-svn: 253499
2015-11-18 20:43:20 +00:00
Yury Gribov 4c3baeb686 [asan] Use proper macro in runline.
llvm-svn: 253457
2015-11-18 13:38:45 +00:00
Yury Gribov 6689df85ee [asan] Enable halt_on_error tests on OS X.
llvm-svn: 253342
2015-11-17 16:34:39 +00:00
Yury Gribov bdf8751609 [asan] Restored asynch signal test.
llvm-svn: 253204
2015-11-16 13:54:32 +00:00
Yury Gribov 7e3c7ee0b1 [asan] Fixed invalid check in test.
llvm-svn: 253037
2015-11-13 12:49:58 +00:00
Yury Gribov eed2daa80c [asan] Dump test output in case of error in single-threaded mode.
llvm-svn: 253035
2015-11-13 12:07:15 +00:00
Yury Gribov a085297030 [asan] Fix test to properly handle collisions.
llvm-svn: 253025
2015-11-13 10:32:13 +00:00
Yury Gribov 1e89f53902 [asan] Get rid of rand_r (not available on all targets).
llvm-svn: 253021
2015-11-13 09:43:30 +00:00
Reid Kleckner b8e3bff98a [Windows] Fix halt_on_error-1.c test on Windows with %env_asan_opts
llvm-svn: 252958
2015-11-12 21:58:28 +00:00
Evgeniy Stepanov 833c75e554 [asan] Mark halt_on_error-torture test unsupported on android.
Android libc is missing rand_r until API 21. ASan supports API 19.

llvm-svn: 252930
2015-11-12 19:30:38 +00:00
Kostya Serebryany 673283cc7c [sanitizer coverage] reset global counters in __sanitizer_reset_coverage
llvm-svn: 252815
2015-11-11 22:44:25 +00:00
Evgeniy Stepanov 77ef54288a [asan] Remove a flaky test.
llvm-svn: 252805
2015-11-11 21:37:12 +00:00
Yury Gribov 8fbd938641 [ASan] Improve portability of new tests.
llvm-svn: 252742
2015-11-11 15:42:26 +00:00
Jay Foad 305586257c Implement some TLS support for PowerPC64.
Summary: This is enough to get the asan static_tls.cc test case working.

Reviewers: eugenis, samsonov

Subscribers: llvm-commits

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

llvm-svn: 252738
2015-11-11 15:37:47 +00:00
Yury Gribov 159727d417 [ASan] Add stress test for asynch signals in nonhalting mode.
Differential Revision: http://reviews.llvm.org/D14241

llvm-svn: 252729
2015-11-11 14:02:33 +00:00
Yury Gribov 468d955b98 [ASan] Enable optional ASan recovery.
Differential Revision: http://reviews.llvm.org/D12318

llvm-svn: 252723
2015-11-11 11:59:38 +00:00
Mike Aizatsky 1e41784f20 Asan: utility function to determine first wrongly poisoned byte in
container.

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

llvm-svn: 252071
2015-11-04 19:56:03 +00:00
Kuba Brecka 465cb8a6fa [tsan] Use malloc zone interceptors on OS X, part 1 (refactoring)
TSan needs to use a custom malloc zone on OS X, which is already implemented in ASan.  This patch is a refactoring patch (NFC) that extracts this from ASan into sanitizer_common, where we can reuse it in TSan.

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

llvm-svn: 252052
2015-11-04 15:43:45 +00:00
Evgeniy Stepanov d10e6280cb [asan] Disable a flaky test on Android.
Bug: https://github.com/google/sanitizers/issues/618
llvm-svn: 251554
2015-10-28 20:45:52 +00:00
Daniel Sanders 6c583b8b25 [mips][asan] XFAIL ptrace.cc
It was recently enabled for non-x86 targets and doesn't seem to work for MIPS.
The reason is currently unclear so XFAILing while I investigate.

llvm-svn: 251466
2015-10-27 23:13:26 +00:00
Daniel Sanders 171d6fa35d Attempt to fix asan's ptrace.cc on the clang-cmake-mips builder after r251331.
llvm-svn: 251379
2015-10-27 01:35:57 +00:00
Evgeniy Stepanov f0344626d2 [asan] Mark 5 tests unsupported on Android.
llvm-svn: 251362
2015-10-26 22:19:50 +00:00
Evgeniy Stepanov fb38728241 [asan] Fix throw-call-test to properly XFAIL on android/aarch64.
The test is sensitive to stack layout changes. Tweak it a bit to
expose the bug on aarch64 as well as on arm.

llvm-svn: 251361
2015-10-26 22:19:47 +00:00
Adhemerval Zanella 6153ecc4fd [compiler-rt] Fix ptrace interceptor for aarch64
This patch fixes the ptrace interceptor for aarch64. The PTRACE_GETREGSET
ptrace syscall with with invalid memory might zero the iovec::iov_base
field and then masking the subsequent check after the syscall (since it
will be 0 and it will not trigger an invalid access). The fix is to copy
the value on a local variable and use its value on the checks.

The patch also adds more coverage on the Linux/ptrace.cc testcase by addding
check for PTRACE_GETREGSET for both general and floating registers (aarch64
definitions added only).

llvm-svn: 251331
2015-10-26 18:55:04 +00:00
Kostya Serebryany e3d25c3873 [sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairs
llvm-svn: 251071
2015-10-22 22:06:41 +00:00
Yury Gribov 8da1408277 [asan] Get rid of UB in string tests. Patch by Max Ostapenko.
Differential revision: http://reviews.llvm.org/D13895

llvm-svn: 250998
2015-10-22 08:10:56 +00:00
Ivan Krasin cffe8caed3 Disabling speculative loads under asan.
Summary:
While instrumenting std::string with asan I discovered that speculative load might load data from poisoned region. Disabling all speculative loads for asan-annotated functions.

The test follows the std::string implementation.

Corresponding CL in llvm: http://reviews.llvm.org/D13264
Patch by Mike Aizatsky, the review page for the CL is http://reviews.llvm.org/D13265

Reviewers: aizatsky

Subscribers: kcc, llvm-commits

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

llvm-svn: 250837
2015-10-20 17:34:47 +00:00
Reid Kleckner 8da160173c Remove the XFAIL for the C++ EH test
It works on Windows now.

llvm-svn: 249799
2015-10-09 01:33:15 +00:00
Daniel Sanders bb9c116165 [asan][mips] Fix ABI incompatibility crash in pthread_create() following r248325.
Like i386, Mips needs a versioned interceptor but must select GLIBC_2.2.

llvm-svn: 249307
2015-10-05 12:43:47 +00:00
Evgeniy Stepanov 06e338b403 [asan] Disable pthread_create_version test on mips.
llvm-svn: 249191
2015-10-02 21:23:53 +00:00
Evgeniy Stepanov 25c58d124b [asan] Fix asan_symbolize.py handling of non-existing paths
llvm-svn: 248962
2015-09-30 23:17:39 +00:00
Evgeniy Stepanov a7ecbe5685 [asan] Add missing -pthread in tests.
llvm-svn: 248332
2015-09-22 22:24:46 +00:00
Evgeniy Stepanov 9147de0ddf [asan] Versioned interceptor for pthread_create.
This fixes a crash in pthread_create on linux/i386 due to abi
incompatibility between intercepted and non-intercepted functions.

See the test case for more details.

llvm-svn: 248325
2015-09-22 21:34:44 +00:00
Reid Kleckner 3e9d733e68 [Windows] xfail a test that uses C++ EH
llvm-svn: 247845
2015-09-16 20:32:22 +00:00
Alexey Samsonov f23dee5408 [ASan] Add test for .preinit_array/.init_array/.fini_array sections.
llvm-svn: 247737
2015-09-15 23:06:17 +00:00
Kuba Brecka 6f7ef0ea3e Revert r246961 "[asan] Intercept and wrap XPC callback blocks".
There is a build failure for the simulator.

llvm-svn: 246967
2015-09-07 12:25:51 +00:00
Kuba Brecka dfaac293dc [asan] Intercept and wrap XPC callback blocks
On recent OS X systems, blocks used as callbacks for XPC events (set up e.g. via xpc_connection_set_event_handler) are not later executed via the public libdispatch API (dispatch_async, etc). Because we don't intercept the path where the block is executed, we can fail to register the newly created dispatch thread. To fix that, let's intercept libxpc's APIs that take a block as a callback handler, and let's wrap these blocks in the same way as we do for libdispatch API.

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

llvm-svn: 246961
2015-09-07 11:19:22 +00:00
Evgeniy Stepanov 7dee008911 [asan] Disable array cookie test on ARM, enable on Android/x86.
The failure is caused by the missing implementation of array cookie
poisoning in Clang for ARMCXXABI and has nothing to do with Android
(and the test passes on Android/x86).

llvm-svn: 246832
2015-09-04 01:15:28 +00:00
Evgeniy Stepanov d67f1b9dbc [asan] Split a test in two.
wait3 is gone in android-21. Move it out of the common
(wait/waitpid/wait3) test, and mark as unsupported on Android.

llvm-svn: 246742
2015-09-03 01:26:30 +00:00
Evgeniy Stepanov afe6c1d466 [asan] Replace valloc with posix_memalign in test.
valloc is gone in android-21.

llvm-svn: 246741
2015-09-03 01:22:06 +00:00
Kuba Brecka b79932addf [asan] Fix the freopen interceptor to allow NULL instead of a filename
According to `man freopen`, passing NULL instead of a filename is valid, however the current implementation of the interceptor assumes this parameter is non-NULL. Let's fix that and add a test case.

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

llvm-svn: 246435
2015-08-31 12:41:55 +00:00
Reid Kleckner 255ee043cb Unit test the CRLF change to suppression parsing
It's a simpler, faster, and more portable.

llvm-svn: 246171
2015-08-27 18:05:33 +00:00
Reid Kleckner 766e507784 [windows] Avoid unix2dos, it seems to not work on our bot
llvm-svn: 246162
2015-08-27 16:56:10 +00:00
Reid Kleckner ac86c29bd0 Handle suppression files ending in CRLF (\r\n)
The gnuwin32 version of 'echo' appears to produce such files, causing a
test failure that only reproduced with gnuwin32.

llvm-svn: 246096
2015-08-26 22:23:50 +00:00
Alexey Samsonov 1130681716 [ASan] More ASAN_OPTIONS churn: use %env_asan_opts where applicable.
Reviewers: filcab, rnk, kubabrecka

Subscribers: tberghammer, danalbert, srhines, llvm-commits

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

llvm-svn: 245962
2015-08-25 18:27:53 +00:00
Reid Kleckner 14b7dde85f Move ASAN_OPTIONS setting from compile command to run command, fixes test on posix
llvm-svn: 245079
2015-08-14 18:29:00 +00:00
Reid Kleckner 89d994367a [windows] Fix or XFAIL remaining portable test failures and enable them
Summary:
This involved various fixes:

- Move a test that uses ulimit to Posix.

- Add a few "REQUIRES: shell" lines to tests using backtick subshell
  evaluation.

- The MSVC CRT buffers stdio if the output is a pipe by default. Some
  tests need that disabled to avoid interleaving test stdio with asan
  output.

- MSVC headers provide _alloca instead of alloca (go figure), so add a
  portability macro to the two alloca tests.

- XFAIL tests that rely on accurate symbols, we need to pass more flags
  to make that work.

- MSVC's printf implementation of %p uses upper case letters and doesn't
  add 0x, so do that manually.

- Accept "SEGV" or "access-violation" reports in crash tests.

Reviewers: samsonov

Subscribers: tberghammer, danalbert, llvm-commits, srhines

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

llvm-svn: 245073
2015-08-14 17:39:48 +00:00
Reid Kleckner 85220d0218 Use %env_asan_opts= substitution instead of 'env ASAN_OPTIONS=$ASAN_OPTIONS'
Summary:
The lit internal shell is used by default on Windows, and it does not
support bash variable expansion. Because bash variable expansion
interacts with tokenization, it is prohibitively difficult to make the
existing lit shell do general shell variable expansion.

The most common use of shell variables in the asan tests is to add
options to the default set of options set by lit.cfg. We can avoid the
need for variable expansion with a substitution that expands to 'env
ASAN_OPTIONS=<defaults:>'.

This has the side benefit of shortening the RUN lines, so it seemed
better than implementing limited variable expansion in lit.

Reviewers: samsonov, filcab

Subscribers: llvm-commits

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

llvm-svn: 244839
2015-08-12 23:50:12 +00:00
Reid Kleckner f787cdd031 Combine helper file into main test file with ifdefs
Keeping tests isolated to a single file is nice, and it was suggested in
post-commit review for r244827.

llvm-svn: 244833
2015-08-12 23:24:41 +00:00
Reid Kleckner e7ffbffaef Move tests that use unistd.h and pthread.h to TestCases/Posix
llvm-svn: 244827
2015-08-12 22:58:56 +00:00
Reid Kleckner 269d406a9d [windows] Use lld-link instead of lld-link2, the latter no longer exists
The test passed for me locally because I had a stale copy of
lld-link2.exe.

llvm-svn: 244638
2015-08-11 17:36:09 +00:00
Reid Kleckner 46ed25e199 [windows] Remove CHECK for strdup symbol that comes from the CRT
llvm-symbolizer isn't symbolizing it for some reason. I'll investigate.

llvm-svn: 244629
2015-08-11 16:56:26 +00:00
Reid Kleckner 7d9e1e1259 [Windows] Use llvm-symbolizer before using dbghelp
Summary:
llvm-symbolizer understands both PDBs and DWARF, so it's a better bet if
it's available. It prints out the function parameter types and column
numbers, so I needed to churn the expected test output a bit.

This makes most of the llvm-symbolizer subprocessing code
target-independent. Pipes on all platforms use fd_t, and we can use the
portable ReadFromFile / WriteToFile wrappers in symbolizer_sanitizer.cc.
Only the pipe creation and process spawning is Windows-specific.

Please check that the libcdep layering is still correct. I don't know
how to reproduce the build configuration that relies on that.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244616
2015-08-11 15:51:40 +00:00
Reid Kleckner c0120a3000 [Windows] Relax test case patterns to allow parameter lists
llvm-symbolizer will print parameter types.  Split out from D11791.

NFC

llvm-svn: 244522
2015-08-10 22:43:04 +00:00
Kostya Serebryany cc9fd3cbe9 [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM)
llvm-svn: 244234
2015-08-06 17:52:54 +00:00
Renato Golin 4ae2e1f575 Revert "[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski"
This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline.

llvm-svn: 244210
2015-08-06 12:42:46 +00:00
Kostya Serebryany ce1799a83f [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski
llvm-svn: 244136
2015-08-05 21:19:11 +00:00
Adhemerval Zanella 975998bf6a [asan] Enable asan for aarch64
This patch enables asan for aarch64/linux.  It marks it as 'unstable-release',
since some tests are failing due either kernel missing support of non-executable
pages in mmap or environment instability (infinite loop in juno reference
boards).

It sets decorate_proc_maps test to require stable-release, since the test expects
the shadow memory to not be executable and the support for aarch64 is only
added recently by Linux (da141706aea52c1a9 - 4.0).

It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call
as a TLS optimization.

llvm-svn: 244054
2015-08-05 15:13:33 +00:00
Reid Kleckner 646386e779 [asan] Print VAs instead of RVAs for module offsets on Windows
Summary:
This is consistent with binutils and ASan behavior on other platforms,
and makes it easier to use llvm-symbolizer with WinASan. The
--relative-address flag to llvm-symbolizer is also no longer needed.

An RVA is a "relative virtual address", meaning it is the address of
something inside the image minus the base of the mapping at runtime.

A VA in this context is an RVA plus the "preferred base" of the module,
and not a real runtime address. The real runtime address of a symbol
will equal the VA iff the module is loaded at its preferred base at
runtime.

On Windows, the preferred base is stored in the ImageBase field of one
of the PE file header, and this change adds the necessary code to
extract it. On Linux, this offset is typically included in program and
section headers of executables.

ELF shared objects typically use a preferred base of zero, meaning the
smallest p_vaddr field in the program headers is zero. This makes it so
that PIC and PIE module offsets come out looking like RVAs, but they're
actually VAs. The difference between them simply happens to be zero.

Reviewers: samsonov, majnemer

Subscribers: llvm-commits

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

llvm-svn: 243895
2015-08-03 19:51:18 +00:00
Alexey Samsonov 25ac9311d0 [ASan] Fix two tests on FreeBSD: alloca.h is missing there.
llvm-svn: 243800
2015-07-31 23:57:06 +00:00
Evgeniy Stepanov 1378c683e9 [asan] XFAIL 1 test on Android.
The test uses source file relative paths which does not work when the
test is executed on a remote device.

llvm-svn: 243564
2015-07-29 20:17:21 +00:00
Evgeniy Stepanov 7eeb02bd09 [asan] Read process name from /proc/self/cmdline on Linux.
Rename getBinaryBasename() to getProcessName() and, on Linux,
read it from /proc/self/cmdline instead of /proc/self/exe. The former
can be modified by the process. The main motivation is Android, where
application processes re-write cmdline to a package name. This lets
us setup per-application ASAN_OPTIONS through include=/some/path/%b.

llvm-svn: 243473
2015-07-28 20:27:51 +00:00
Kuba Brecka cd7720c970 Fix typo from r243418. Should fix the failing `abort_on_error.cc` test.
See http://reviews.llvm.org/D7203

llvm-svn: 243426
2015-07-28 15:43:45 +00:00
Kuba Brecka 873855e291 [asan] Set abort_on_error=1 by default on OS X
This sets the default ASan flags to abort_on_error=1 on OS X. For unit tests and lit tests we set ASAN_OPTIONS back to abort_on_error=0 before running the tests (to avoid crashing). I added two tests that intentionally don't respect the default ASAN_OPTIONS to test the behavior of an empty ASAN_OPTIONS (on OS X we should crash, on Linux we should exit()).

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

llvm-svn: 243418
2015-07-28 14:34:13 +00:00
Kuba Brecka a11cfb990a [asan] Rename the ABI versioning symbol to '__asan_version_mismatch_check' instead of abusing '__asan_init'
We currently version `__asan_init` and when the ABI version doesn't match, the linker gives a `undefined reference to '__asan_init_v5'` message. From this, it might not be obvious that it's actually a version mismatch error. This patch makes the error message much clearer by changing the name of the undefined symbol to be `__asan_version_mismatch_check_xxx` (followed by the version string). We obviously don't want the initializer to be named like that, so it's a separate symbol that is used only for the purpose of version checking.

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

llvm-svn: 243004
2015-07-23 10:55:13 +00:00
Reid Kleckner d2a8dc88ff [asan] Remove CHECK line for kernel32.dll
Windows 8 users report that it isn't present in the address space by
default anymore.

Fixes PR23773.

llvm-svn: 242958
2015-07-22 22:39:36 +00:00
Reid Kleckner 24e5ee7708 [asan] Disable ctrl+c test until I figure out how to make it portable
llvm-svn: 242952
2015-07-22 22:25:07 +00:00
Reid Kleckner 33b9cd2191 [asan] Make __asan_handle_no_return tolerate unregistered threads
Summary:
On Windows, thread injection by the kernel or other running processes is
a fairly common occurrence, so ASan should be resilient to it.  The
comments on GetCurrentThread() say that it can return null, so we
shouldn't be CHECK failing if it does.

Sending control-C is one way to get the kernel to inject a thread into
your process, so I wrote a test around it.

Reviewers: llvm-commits

Subscribers: samsonov

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

llvm-svn: 242948
2015-07-22 21:58:31 +00:00
Reid Kleckner 83a019d427 [asan] Test clang's SEH implementation as well as MSVC's
llvm-svn: 242933
2015-07-22 20:54:24 +00:00
Kuba Brecka 8c5db0f852 Reverting r242787, attempt 2.
llvm-svn: 242799
2015-07-21 16:31:35 +00:00
Kuba Brecka e40677434b Reverting r242787 ("[asan] Fix the freopen interceptor to allow NULL instead of a filename") to investigate buildbot failure.
llvm-svn: 242791
2015-07-21 15:27:40 +00:00
Kuba Brecka 4c0cdec138 [asan] Fix the freopen interceptor to allow NULL instead of a filename
According to man freopen, passing NULL instead of a filename is valid, however the current implementation of the interceptor assumes this parameter is non-NULL. Let's fix that and add a test case.

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

llvm-svn: 242787
2015-07-21 14:23:27 +00:00
Alexey Samsonov fd5211a5b3 [ASan] PR24150: restrict test case to i386.
llvm-svn: 242449
2015-07-16 21:46:58 +00:00
Kostya Serebryany 7f1e1f0f8e [asan] relax the test case to allow either 'malloc' or '__interceptor_malloc' ; PR22681
llvm-svn: 241755
2015-07-08 22:57:03 +00:00
Kuba Brecka 61db9ebdea [asan] Add missing $ASAN_OPTIONS to some test cases
Since http://reviews.llvm.org/D10294, ASan test cases now respect default env. options via `ASAN_OPTION=$ASAN_OPTIONS:additional_options=xxx`.  This patch adds this to a few test cases where it's still missing.

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

llvm-svn: 241571
2015-07-07 09:55:00 +00:00
Kuba Brecka 76cc55a94d [asan] Add OS X 10.11's new dyld interposition support
On OS X 10.11 (which is currently a public beta), the dynamic linker has been improved so that it doesn't require the use of DYLD_INSERT_LIBRARIES in order for interposition/wrappers to work. This patch adds support of this behavior into ASan – we no longer need to re-exec in case the env. variable is not set.

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

llvm-svn: 241487
2015-07-06 19:07:55 +00:00
Kuba Brecka f3a493638f [asan] Fix an OS X startup crash when an empty section is present
On OS X, when the main instrumented binary contains a custom section with zero length, ASan will crash (assert failure) early in the initialization.

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

llvm-svn: 241474
2015-07-06 17:17:06 +00:00
Evgeniy Stepanov b41e87c534 [asan] Suppress read_binary_name_regtest.c test failure on unsupported hosts.
read_binary_name_regtest.c requires seccomp kernel headers.
Make the test pass if <linux/seccomp.h> is missing.

llvm-svn: 241119
2015-06-30 21:28:55 +00:00
Alexander Potapenko 5e70fb13de [ASan] Add a regression test for r240960 (https://crbug.com/502974)
The test simulates a sandbox that prevents the program from calling readlink().
ASan is supposed to still be able to print the executable name regardless of that.

llvm-svn: 241072
2015-06-30 15:18:03 +00:00
Evgeniy Stepanov 8fee84d01e [asan] Re-enable clang_gcc_abi test at higher opt levels.
PR23971 is fixed.

llvm-svn: 240975
2015-06-29 18:05:31 +00:00
Evgeniy Stepanov 8e449f6d9f [asan] Disable 3 tests on Android.
Different reasons for failing; see source file comments.

llvm-svn: 240858
2015-06-26 23:44:43 +00:00
Evgeniy Stepanov 8dbebeb53f [asan] Add -pie to uninstrumented executables on interface_test.cc
This helps Android (which only support PIE) and does not hurt anything else.

llvm-svn: 240857
2015-06-26 23:43:03 +00:00
Evgeniy Stepanov 77d543f756 [asan] Enable 2 tests on Android.
Due to bionic improvements and "recent" sized-delete changes in clang.

llvm-svn: 240856
2015-06-26 23:41:50 +00:00
Evgeniy Stepanov 4e78a248e2 [asan] Disable -O1,-O2,-O3 in clang_gcc_abi.cc test.
A workaround for PR23971.
Fixes the test on Android.

llvm-svn: 240855
2015-06-26 23:40:27 +00:00
Anna Zaks a16075cfc9 [asan] Do not unset DYLD_ROOT_PATH before calling atos on Darwin
We were unsetting DYLD_ROOT_PATH before calling atos on Darwin in order to
address it not working for symbolicating 32 bit binaries. (atos essentiall
tries to respawn as a 32 bit binary and it's disallowed to respawn if
DYLD_ROOT_PATH is set ... ) However, processes rely on having DYLD_ROOT_PATH
set under certain conditions, so this is not the right fix. In particular, this
always crashes when running ASanified process under the debugger in Xcode with
iOS simulator, which is a very important workflow for us to support.

This patch reverts the unsetting of the DYLD_ROOT_PATH. The correct fix to the
misbehavior on 32-bit binaries should happen inside atos.

http://reviews.llvm.org/D10722

llvm-svn: 240724
2015-06-25 23:36:21 +00:00
Filipe Cabecinhas 65e703ac84 [ASan tests] Revert a bad change from r239754
Hopefully the last partial revert. Sorry about the noise.

llvm-svn: 239785
2015-06-15 23:44:53 +00:00
Filipe Cabecinhas 0ff92e6e3e [ASan tests] Leftover that didn't get reverted in r239754
llvm-svn: 239773
2015-06-15 22:19:47 +00:00
Filipe Cabecinhas 1b66f5dc82 [ASan tests] Use export, not env.
llvm-svn: 239771
2015-06-15 22:14:21 +00:00
Filipe Cabecinhas 9d8663f8d0 Revert "[ASan tests] Try to fix Windows buildbots due to r239754"
This reverts commit r239764 and the TestCases/Windows part of r239754.

llvm-svn: 239768
2015-06-15 21:49:35 +00:00
Filipe Cabecinhas 0470998860 [ASan tests] Try to fix Windows buildbots due to r239754
llvm-svn: 239764
2015-06-15 21:15:26 +00:00
Filipe Cabecinhas 91244924cb [ASan] Test churn for setting ASAN_OPTIONS=symbolize_vs_style=false
Summary:
This commit adds symbolize_vs_style=false to every instance of
ASAN_OPTIONS in the asan tests and sets
ASAN_OPTIONS=symbolize_vs_style=false in lit, for tests which don't set
it.

This way we don't need to make the tests be able to deal with both
symbolize styles.

This is the first patch in the series. I will eventually submit for the
other sanitizers too.

We need this change (or another way to deal with the different outputs) in
order to be able to default to symbolize_vs_style=true on some platforms.

Adding to this change, I'm also adding "env " before any command line
which sets environment variables. That way the test works on other host
shells, like we have if the host is running Windows.

Reviewers: samsonov, kcc, rnk

Subscribers: tberghammer, llvm-commits

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

llvm-svn: 239754
2015-06-15 20:43:42 +00:00
Yury Gribov ef40f0bbff [ASan] Quick-fix tests for new string interceptors.
Patch by Maria Guseva.

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

llvm-svn: 239461
2015-06-10 07:16:02 +00:00
Anna Zaks dd9e6578f0 [asan] Fixup to r239134. This test does pass on darwin.
This should restore the darwin buildbot.

llvm-svn: 239364
2015-06-08 23:24:55 +00:00
Yury Gribov 2d45554b82 [ASan] Add process basename to log name and error message to
simplify analysis of sanitized systems logs.
    
Differential Revision: http://reviews.llvm.org/D7333

llvm-svn: 239134
2015-06-05 06:08:23 +00:00
Yury Gribov ddf646b8c7 [ASan] Fixed tests to pass on Darwin. Patch by Maria Guseva!
Differential Revision: http://reviews.llvm.org/D10159

llvm-svn: 238837
2015-06-02 14:59:26 +00:00
Yury Gribov 9ebb303459 [ASan] Fix flaky tests (see https://llvm.org/bugs/show_bug.cgi?id=23230).
Patch by Maria Guseva!

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

llvm-svn: 238545
2015-05-29 06:45:13 +00:00
Yury Gribov 83aaa8e05c [ASan] Disable alloca tests on ARM targets due to flakiness.
llvm-svn: 238426
2015-05-28 14:29:12 +00:00
Yury Gribov 64c701b3f7 [ASan] XFAIL VLA tests on ARM and PowerPC. Patch by Max Ostapenko!
llvm-svn: 238409
2015-05-28 10:30:46 +00:00
Yury Gribov 0ca65fd83d [sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, strpbrk.
Patch by Maria Guseva.

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

llvm-svn: 238406
2015-05-28 09:24:33 +00:00
Yury Gribov 63d9764585 [ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!
Differential Revision: http://reviews.llvm.org/D7098

llvm-svn: 238401
2015-05-28 07:49:05 +00:00
Evgeniy Stepanov 270c5257e6 [asan] Disable static-tls test on PowerPC.
llvm-svn: 237534
2015-05-17 05:24:09 +00:00
Evgeniy Stepanov 7f6290ca9a [sanitizer] Recognize static TLS in __tls_get_addr interceptor.
Current code tries to find the dynamic TLS header to the left of the
TLS block without checking that it's not a static TLS allocation.

llvm-svn: 237495
2015-05-16 00:34:15 +00:00
Sergey Matveev 2680fe5f07 [sanitizer] Override pipefail in coverage-missing test.
This should finally fix it.

llvm-svn: 237147
2015-05-12 16:32:41 +00:00
Sergey Matveev 1a66c0ba53 [sanitizer] Re-enable a broken test with debug output.
llvm-svn: 237137
2015-05-12 14:43:31 +00:00
Evgeniy Stepanov d7b3ef65bb [asan] Disable coverage-missing test failing on the bots.
llvm-svn: 237049
2015-05-11 21:16:18 +00:00
Sergey Matveev 42cc8fa592 [sanitizer] Attempt to fix the test for missing coverage script.
llvm-svn: 236877
2015-05-08 16:30:01 +00:00
Sagar Thakur 6c253006b8 [ASAN] Use regex for addresses in kernel_area.cc test
This test was failing on mips because mips addresses are 40-bit long.
Using regex for address solves this issue.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9516

llvm-svn: 236844
2015-05-08 12:47:10 +00:00
Alexey Samsonov 8e5e8fb2f3 [SanitizerCoverage] Upgrade lit tests to new -fsanitize-coverage= flags.
llvm-svn: 236796
2015-05-07 23:20:47 +00:00
Sergey Matveev a4cf7d71b8 [sanitizer] Restrict the missing coverage test to x86/x86_64.
Contrary to my hopes, it didn't magically work on other platforms.

llvm-svn: 236645
2015-05-06 21:50:42 +00:00
Sergey Matveev c2de346e48 [sanitizer] Extend sancov.py to show which PCs are missing from coverage.
Example usage:

sancov.py print a.out.1234.sancov | sancov.py missing a.out

llvm-svn: 236637
2015-05-06 20:48:29 +00:00
Reid Kleckner 4fe30a06b1 Fix Windows coverage test with lit shell
llvm-svn: 236446
2015-05-04 19:41:58 +00:00
Daniel Sanders 0568283e69 [asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.
Summary:
During the review of http://reviews.llvm.org/D9199 where I had originally
changed the debug_mapping.cc test to accept hexadecimal values, we realized
that SHADOW_SCALE and SHADOW_GRANULARITY ought to be printed as decimal values.
This patch makes that change.

This patch also adds a '0x' prefix to the SHADOW_OFFSET to make it clear that
it is hexadecimal while the other two are decimal.

Reviewers: kcc, timurrrr, samsonov

Reviewed By: timurrrr, samsonov

Subscribers: samsonov, llvm-commits, sagar

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

llvm-svn: 235798
2015-04-25 10:57:35 +00:00
Alexey Samsonov 26856434d2 [ASan] Relax test modified in r235540 to pacify ARM buildbots.
llvm-svn: 235619
2015-04-23 18:43:08 +00:00
Daniel Sanders 9316d89d55 [asan] debug_mapping.cc should also pass when the leading digit of SHADOW_SCALE is hexadecimal.
Summary:
Previously the CHECK directive for SHADOW_SCALE only matched decimal digits
causing it to match '7' on x86_64 instead of the whole value.

This fixes a failure on mips-linux-gnu targets where the leading digit is 'a'.

Reviewers: kcc, sagar, timurrrr

Reviewed By: timurrrr

Subscribers: llvm-commits

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

llvm-svn: 235594
2015-04-23 13:23:21 +00:00
Alexey Samsonov 9e463ba35d [ASan] Print global registration site in init-order-checker reports.
llvm-svn: 235540
2015-04-22 20:30:19 +00:00
Timur Iskhodzhanov 8f40f03024 [ASan/Win] Add a test that makes sure coverage works at least in the simple cases
llvm-svn: 234496
2015-04-09 15:58:38 +00:00
Dmitry Vyukov 1e5b9f4131 sanitizer: new "strict_string_checks" run-time flag
This patch is related to Issue 346: moar string interceptors: strstr, strcasestr, strcspn, strpbrk
As was suggested in original review http://reviews.llvm.org/D6056 a new "strict_string_checks" run-time flag introduced.
The flag support applied for existing common, asan, msan and tsan interceptors. New asan tests added.

Change by Maria Guseva reviewed in http://reviews.llvm.org/D7123

llvm-svn: 234187
2015-04-06 18:00:26 +00:00
Alexander Potapenko 0ae78444e7 [ASan] Make the remaining coverage tests pass on Darwin, move them to Posix/
This CL:
 - moves PrepareForSandboxing() to sanitizer_posix_libcdep.cc
 - fixes the coverage tests to use flag substitutions defined in r233802 and not rely on hardcoded shared library names
 - moves those tests to TestCases/Posix so that they can be executed on Darwin

llvm-svn: 233828
2015-04-01 17:56:29 +00:00
Alexander Potapenko 8db9e77ba7 [ASan] Deduplicate interception-in-shared-lib-test.cc by introducing platform-specific substitutions for rpath linker flags
Also make suppressions-library.cc use the same flags to avoid warnings about unused -rpath flags.
The same substitutions will be used to make coverage tests work on both Linux and Darwin without duplicating the code.

llvm-svn: 233802
2015-04-01 12:13:03 +00:00
Alexey Samsonov 705c449af5 [ASan] Remove XFAIL from now passing test.
llvm-svn: 233040
2015-03-23 23:37:39 +00:00
Alexander Potapenko 141e420a81 [ASan] Distinguish between read, write and read-write file access modes in OpenFile.
This is to fix mapping coverage files into memory on OSX.

llvm-svn: 232936
2015-03-23 10:10:46 +00:00
Kuba Brecka 0e66c49d62 Fix a flaky heap-overflow-large.cc test
Reviewed at http://reviews.llvm.org/D8515

llvm-svn: 232920
2015-03-22 18:00:58 +00:00
Kuba Brecka eefb2e2703 Demangling for DlAddrSymbolizer
On OS X, dladdr() provides mangled names only, so we need need to demangle in
DlAddrSymbolizer::SymbolizePC.

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

llvm-svn: 232910
2015-03-22 11:38:55 +00:00
Kuba Brecka 0be4e0e0c1 Add AtosSymbolizer and DlAddrSymbolizer as fallbacks for OS X
This patch changes the symbolizer chain on OS X (which currently only uses 1
symbolizer at most) to use this behavior:

* By default, use LLVMSymbolizer -> DlAddrSymbolizer.
* If the llvm-symbolizer binary is not found, use AtosSymbolizer 
    -> DlAddrSymbolizer.
* If the user specifies ASAN_SYMBOLIZER_PATH=.../atos, then use AtosSymbolizer
    -> DlAddrSymbolizer.
* If neither llvm-symbolizer or atos is found, or external symbolication is
    disabled with ASAN_SYMBOLIZER_PATH="", use DlAddrSymbolizer.

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

llvm-svn: 232908
2015-03-22 10:02:50 +00:00
Kostya Serebryany 90bb050c54 [asan] update the sized_delete_test following the change of clang flags in r232788.
llvm-svn: 232845
2015-03-20 20:45:42 +00:00
Alexander Potapenko 24c262f213 [ASan] fix litling warnings for coverage-order-pcs.cc
llvm-svn: 232812
2015-03-20 14:11:05 +00:00
Alexander Potapenko 001deff940 [ASan] Move a couple of Posix-specific tests to Posix/
Add a comment about potential breakage of coverage-maybe-open-file.cc on Win

llvm-svn: 232809
2015-03-20 13:42:11 +00:00
Alexander Potapenko d5b3f7b125 [ASan] Move the coverage tests that work on Darwin to common testcase dir.
llvm-svn: 232808
2015-03-20 13:31:03 +00:00
Kostya Serebryany dcb54db809 [sanitizer] fix 'sancov.py merge' and add a test for it
llvm-svn: 232763
2015-03-19 21:01:27 +00:00
Justin Bogner eba5227ccd asan: Cargo cult the linux test changes in r232501 to the darwin tests
This gets check-asan working again on Darwin - it looks like it was
just an omission not to update this as part of r232501.

llvm-svn: 232672
2015-03-18 21:30:46 +00:00
Renato Golin d8a128aafb [ARM] Remove XFAIL from passing RT test
This test started passing without warning, so in theory, we shouldn't mark
is as XPASS, but the buildbots are red and there's been an uncaught regression
meanwhile. Since it's passing on {ARM,Thumb2} x {NEON,VFPv3}, I'll risk future
failures for the benefit of getting the bots green again.

llvm-svn: 232642
2015-03-18 15:42:15 +00:00
Kostya Serebryany cba49d4b04 [sanitizer] add run-time a flag coverage_order_pcs. When true, the PCs are dumped in the order of their appearance
llvm-svn: 232573
2015-03-18 00:23:44 +00:00
Alexey Samsonov c9d9610317 Improve SUMMARY reporting in sanitizers.
Make sure SUMMARY is always reported unless print_summary flag is set to
false, even if symbolizer is unavailable or report stack trace is empty.
If file/line info for PC can't be evaluated, print module name/offset
like we do in stack trace.

llvm-svn: 232567
2015-03-17 23:46:06 +00:00
Dmitry Vyukov 6bd917a31f asan: optimization experiments
The experiments can be used to evaluate potential optimizations that remove
instrumentation (assess false negatives). Instead of completely removing
some instrumentation, you set Exp to a non-zero value (mask of optimization
experiments that want to remove instrumentation of this instruction).
If Exp is non-zero, this pass will emit special calls into runtime
(e.g. __asan_report_exp_load1 instead of __asan_report_load1). These calls
make runtime terminate the program in a special way (with a different
exit status). Then you run the new compiler on a buggy corpus, collect
the special terminations (ideally, you don't see them at all -- no false
negatives) and make the decision on the optimization.

The exact reaction to experiments in runtime is not implemented in this patch.
It will be defined and implemented in a subsequent patch.

http://reviews.llvm.org/D8198

llvm-svn: 232501
2015-03-17 16:59:11 +00:00
Timur Iskhodzhanov d58230b9dc [ASan/Win] Fix a CHECK failure when an exception is thrown from a callback passed to BindIoCompletionCallback
This also simplifies how we handle QueueUserWorkItem

llvm-svn: 232499
2015-03-17 16:50:59 +00:00
Timur Iskhodzhanov 81514e0660 [ASan/Win] Fix a CHECK failure when an exception is thrown from a callback passed to QueueUserWorkItem
llvm-svn: 231947
2015-03-11 17:47:10 +00:00
Dmitry Vyukov 2d78c6371d asan: fix leak test for power platform
Power is 64-bit but does not support leak detection,
so this test fails. Use the more robust leak-detection
predicate instead.

llvm-svn: 231782
2015-03-10 10:36:06 +00:00
Kostya Serebryany 48a4023f40 [sanitizer] fix instrumentation with -mllvm -sanitizer-coverage-block-threshold=0 to actually do something useful.
llvm-svn: 231736
2015-03-10 01:58:27 +00:00
Kostya Serebryany 136494c256 [asan] Fix 2 problems in nohugepage_test.
1. /proc/self/smaps may be bigger than 1 << 14.  On my machine, it is
26KB.
2. The read system call may return a partially filled buffer.  We need
to check the return value from read.

Patch by H.J. Lu

llvm-svn: 231502
2015-03-06 19:33:58 +00:00
Kuba Brecka da0204d05f Add a symbolizer testcase for closed stdin/stdout
Reviewed at http://reviews.llvm.org/D7973

llvm-svn: 231429
2015-03-05 23:41:47 +00:00
Kostya Serebryany 769ddaa2d4 [sanitizer] Reconstruct the function that dumps block/edge coverage, hopefully making it more robust. Also increase the allowed coverage size on 32-bit.
llvm-svn: 231413
2015-03-05 22:19:25 +00:00
Dmitry Vyukov 72f169797e tsan: fix signal handling during stop-the-world
Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

This is reincarnation of reverted r229678 (http://reviews.llvm.org/D7722).
Changed:
- execute TracerThreadDieCallback only on tracer thread
- reset global data in TracerThreadSignalHandler/TracerThreadDieCallback
- handle EINTR from waitpid

Add 3 new test:
- SIGSEGV during leak checking
- StopTheWorld operation during signal storm from an external process
- StopTheWorld operation when the program generates and handles SIGSEGVs

http://reviews.llvm.org/D8032

llvm-svn: 231367
2015-03-05 14:37:28 +00:00
Kostya Serebryany c1d6ab9a1e [sanitizer] add a run-time flag to dump the coverage counter bitset
llvm-svn: 231343
2015-03-05 02:48:51 +00:00
Kostya Serebryany 07aee9c2c6 [sanitizer] when dumping coverage bitset, dump seperate file for every module, instead of dumping a single combined bitset
llvm-svn: 231319
2015-03-04 23:41:55 +00:00
Kostya Serebryany 4bdf5ada18 [asan] more fixes for x32, patches by H.J. Lu
llvm-svn: 231174
2015-03-03 23:46:40 +00:00
Timur Iskhodzhanov 18cfba9fa4 [ASan/Win] Work around PR22545: call LLVM global_dtors in the MD atexit()
llvm-svn: 231000
2015-03-02 19:41:09 +00:00
Alexey Samsonov 1be519876d [Sanitizer] Fix StripPathPrefix function and improve test case.
llvm-svn: 230986
2015-03-02 18:55:46 +00:00
Timur Iskhodzhanov 45ddd694fd [ASan/Win] Rename a test.
I came up with the original name trying to test a different issue and forgot to rename afterwards

llvm-svn: 230961
2015-03-02 14:49:44 +00:00
Alexey Samsonov 34dc40730a [ASan] debug_stacks.cc was passing on ARM by accident, disable this test there for now.
llvm-svn: 230833
2015-02-28 01:35:46 +00:00
Timur Iskhodzhanov 342f5dead0 [ASan/Win] Update test expectations after r230724
llvm-svn: 230755
2015-02-27 14:29:53 +00:00
Anna Zaks 2249049db2 [compiler-rt] Allow suppression file to be relative to the location of the executable
The ASanified executable could be launched from different locations. When we
cannot find the suppression file relative to the current directory, try to
see if the specified path is relative to the location of the executable.

llvm-svn: 230723
2015-02-27 03:12:19 +00:00
Kostya Serebryany ba9422971c [asan] reenable odr-violation.cc test on non-x86-64 after confirming that it's fixed. PR22699
llvm-svn: 230573
2015-02-25 23:23:01 +00:00
Kostya Serebryany 497eeb598b [asan] restict no_asan_gen_globals.c test to 64-bit due to PR22682
llvm-svn: 230537
2015-02-25 20:19:23 +00:00
Kostya Serebryany 2a102cbc77 [asan] temporary disable the test on non-x86-64 while we are investigating PR22699
llvm-svn: 230516
2015-02-25 18:03:03 +00:00
Timur Iskhodzhanov 40d72d9a1f Reland r230019 - [ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand
This incorporates the fix for ARM architecture suggested by Renato Golin.

llvm-svn: 230506
2015-02-25 17:03:34 +00:00
Timur Iskhodzhanov 73e5951ed9 Fix duplicate test code introduced by running "patch -p0" twice
Sorry, SVN had some weird problems so I had to revert and reapply the patch
locally a couple of times and didn't notice I've added file contents to the same
file....

llvm-svn: 230505
2015-02-25 17:01:09 +00:00
Timur Iskhodzhanov 5c62af5bb1 Reland r230419 - add __asan_default_suppressions() hook with a fix for Windows
llvm-svn: 230501
2015-02-25 16:00:26 +00:00
Nico Weber d70bb8d8cb Revert 230419, 230425, 230432.
They don't build on Windows.
http://lab.llvm.org:8011/builders/sanitizer-windows/ went red for example.

llvm-svn: 230461
2015-02-25 04:39:21 +00:00
Kostya Serebryany 74dc7ea2e9 [asan] add __asan_default_suppressions() hook
llvm-svn: 230419
2015-02-25 01:15:37 +00:00
Kostya Serebryany efa60dfd34 [asan] add suppressions for odr violations
llvm-svn: 230409
2015-02-25 00:49:12 +00:00
Kostya Serebryany c1d8a371bf [asan] fix odr-violation.cc test to always use slow unwinding (hopefully fixes the ARM bot)
llvm-svn: 230356
2015-02-24 18:52:38 +00:00
Timur Iskhodzhanov 6ba66b95d1 [ASan/Win] Add support for sanitizer allocator hooks, __asan_default_options and __asan_on_error
llvm-svn: 230344
2015-02-24 17:07:22 +00:00
Kuba Brecka e4ac10179c Fix alloca_instruments_all_paddings.cc test to work under higher -O levels (compiler-rt part)
When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca.  This patch fixes that.

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

llvm-svn: 230317
2015-02-24 09:47:33 +00:00
Alexey Samsonov f535d33fee [ASan] Disable strict init-order checking if dlopen() is called.
Revise the fix to https://code.google.com/p/address-sanitizer/issues/detail?id=178:
always disable strict init-order checking the first time dlopen() is
called: at this point shared library is allowed to access globals
defined in the main executable, as they are guaranteed to be
initialized. Revise the test cases:
* simplify init-order-dlopen.cc test case: make it Linux-specific
  (there's no strict init-order checking on other platforms anyway),
  and single-threaded.
* reinforce init-order-pthread-create.cc test case: make sure that
  init-order checker would produce a false positive unless we
  turn it off at the moment we call pthread_create().

llvm-svn: 230288
2015-02-24 00:37:27 +00:00
Alexey Samsonov 562145c4e1 Add -fdefine-sized-deallocation to ASan test case.
This flag is now needed to force Clang emit the weak definition
of sized delete if it's not present in the header.

llvm-svn: 230242
2015-02-23 19:18:31 +00:00
Renato Golin 4b1482e75c Revert "[ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand"
This reverts commit r230019, as it was breaking the ARM sanitizer buildbot
and let other errors be introduced since it wasn't fixed/reverted in
time.

llvm-svn: 230179
2015-02-22 18:58:18 +00:00
Kuba Brecka 3280dc7081 Whitespace fix for r230172.
llvm-svn: 230173
2015-02-22 11:49:21 +00:00
Kuba Brecka 11bb33c78b Fix gc-test.cc to work under higher -O levels
The gc-test.cc tries underflows of a variable up to -32 bytes, but on i386, the left redzone is not 32 bytes, it’s only 16 bytes and therefore the access to var[-32] is completely off. The reason why this test didn’t fail before is that we’ve been lucky and there was another variable before the var array, which was also instrumented. This fix uses “-32” for 64-bit systems and “-16” for 32-bit.

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

llvm-svn: 230172
2015-02-22 11:12:17 +00:00
Timur Iskhodzhanov 8af971b267 [ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand
llvm-svn: 230019
2015-02-20 15:45:51 +00:00
Timur Iskhodzhanov d3e81e9625 [ASan/Win] Work around PR22545 - unregister globals when using the MD runtime
llvm-svn: 230018
2015-02-20 15:34:16 +00:00
Timur Iskhodzhanov 2462a2f404 [ASan/Win] Thread sanitizer common interface through asan_win_dll_thunk.cc
llvm-svn: 229860
2015-02-19 15:25:26 +00:00
Timur Iskhodzhanov 805d807139 [ASan/Win] Speculative fix to make the sed command line work with all sed implementations
llvm-svn: 229679
2015-02-18 15:14:07 +00:00
Reid Kleckner c12cc5eba8 WinASan: Fix escaping in dll_host.cc test to work with internal shell
llvm-svn: 229570
2015-02-17 22:22:20 +00:00
Timur Iskhodzhanov f220f88fc9 [ASan/Win] Add an OOM test
llvm-svn: 229399
2015-02-16 15:24:20 +00:00
Viktor Kutuzov 0247b970c4 [Asan] Fix the dlclose-test.cc unit test to build on FreeBSD 11
Differential Revision: http://reviews.llvm.org/D7586

llvm-svn: 229381
2015-02-16 13:11:09 +00:00
Timur Iskhodzhanov 54cc5b6fc8 [ASan/Win] Add the executable's directory to the symbol search path
This should fix symbolization in those cases when the .exe file is moved together with the .pdb

llvm-svn: 228701
2015-02-10 16:17:01 +00:00
Alexey Samsonov e977a8c747 [ASan] Add missing RUN: prefix.
llvm-svn: 228651
2015-02-10 01:55:02 +00:00
Timur Iskhodzhanov 758ac94ee2 [ASan/Win] Add a test case for PR22431
llvm-svn: 228573
2015-02-09 12:47:51 +00:00
Kuba Brecka bb39671516 [compiler-rt] Make MaybeReexec properly process DYLD_INSERT_LIBRARIES when using non-absolute paths
MaybeReexec() in asan_mac.cc checks for presence of the ASan dylib in DYLD_INSERT_LIBRARIES, and if it is there, it will process this env. var. and remove the dylib from its value, so that spawned children don't have this variable set. However, the current implementation only works when using a canonical absolute path to the dylib, it fails to remove the dylib for example when using @executable_path.

This patch changes the processing of DYLD_INSERT_LIBRARIES to comparing values only based on filenames (ignoring directories).

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

llvm-svn: 228392
2015-02-06 12:07:29 +00:00
Alexander Potapenko 1c4d621556 [ASan] Fix interface_symbols_darwin.c test
by manually adding __asan_mz_* to the generated interface functions list.

Declaring these functions in asan_interface_internal.h doesn't work quite well:
their prototypes must match the prototypes of zone functions in malloc/malloc.h,
but some of the types (e.g. malloc_zone_t and size_t) aren't available in
asan_interface_internal.h

llvm-svn: 228290
2015-02-05 13:07:50 +00:00
Kostya Serebryany cc0c773f76 [sanitizer] move the coverage interface into a separate header, <sanitizer/coverage_interface.h>. NFC, except for the header name change. This may break existing users, but in this case it's better this way (not too many users so far)
llvm-svn: 228017
2015-02-03 19:40:53 +00:00
Timur Iskhodzhanov 82cd135738 [ASan/Win] Add a test case for r208215 [stack buffer overflow in <iostream>]
The issue re-appears if one uses the -fsanitize-blacklist= flag,
so it's time to have a test case.

llvm-svn: 227799
2015-02-02 12:31:11 +00:00
Kostya Serebryany 21a1a23790 [sanitizer] allow to reset the bb/edge coverage data inside the process while it is running (single-threaded). Also expose the current coverage set to the process.
llvm-svn: 227387
2015-01-28 22:39:44 +00:00
Alexey Samsonov 605f2df106 [ASan] Fix test cases: don't assume that fast unwinder can't unwind through libc.
llvm-svn: 227265
2015-01-27 23:06:48 +00:00
Kuba Brecka aa772feb8e [ASan] Use rpath in tests that produce a shared library
Modifying Darwin/interception-in-shared-lib-test.cc and suppressions-library.cc
to use rpath instead of linking against the full path to the temporary file.
NFC.

llvm-svn: 227161
2015-01-27 01:29:18 +00:00
Kuba Brecka 9a36b3e147 [compiler-rt] Ensure AsanInitFromRtl is called from a static initializer on OS X by using ASAN_DYNAMIC=1
The idea is to ensure that the ASan runtime gets initialized early (i.e.
before other initializers/constructors) even when DYLD_INSERT_LIBRARIES
is not used. In that case, the interceptors are not installed (on OS X,
DYLD_INSERT_LIBRARIES is required for interceptors to work), and therefore
ASan gets currently initialized quite late -- from the main executable's
module initializer. The following issues are a consequence of this:

  https://code.google.com/p/address-sanitizer/issues/detail?id=363
  https://code.google.com/p/address-sanitizer/issues/detail?id=357

Both of them are fixed with this patch.

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

llvm-svn: 226929
2015-01-23 19:29:19 +00:00
Kuba Brecka 405de4ae10 Fix/workaround for OS X truncated stacktraces taken by external tools
This patch is a proposed solution for https://code.google.com/p/address-sanitizer/issues/detail?id=375:

When the stacktraces are captured and printed by ASan itself, they are fine, but when the program has already printed the report (or is just printing it), capturing a stacktrace via other means is broken. "Other means" include OS X CrashReporter, debuggers or calling backtrace() within the program. For example calling backtrace() from a sanitizer_set_death_callback function prints a very truncated stacktrace.

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

llvm-svn: 226878
2015-01-22 23:36:47 +00:00