Commit Graph

1976 Commits

Author SHA1 Message Date
Chandler Carruth 6db6efd40c Make this REQUIRES match the other REQUIRES lines that mention requiring
a darwin system.

llvm-svn: 290152
2016-12-20 01:57:31 +00:00
Kuba Mracek 0722cd0815 Fixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how to make it work on Linux.
llvm-svn: 290129
2016-12-19 18:54:34 +00:00
Kuba Mracek 05bf3ec4c4 More fixup for r290119: Make the ifdef work.
llvm-svn: 290126
2016-12-19 18:27:26 +00:00
Kuba Mracek 7384738362 Another fix-up for r290119: Include stdint.h so we have uint64_t on Linux.
llvm-svn: 290124
2016-12-19 18:09:18 +00:00
Kuba Mracek 866310fcbc Fix-up for r290119 - don't check global size, it might not be available when using atos
llvm-svn: 290123
2016-12-19 18:06:49 +00:00
Kuba Mracek 1187cbd20f [tsan] Implement __tsan_get_alloc_stack and __tsan_locate_address to query pointer types and allocation stacks of heap pointers
In ASan, we have __asan_locate_address and __asan_get_alloc_stack, which is used in LLDB/Xcode to show the allocation backtrace for a heap memory object. This patch implements the same for TSan.

Differential Revision: https://reviews.llvm.org/D27656

llvm-svn: 290119
2016-12-19 17:52:20 +00:00
Kuba Mracek 79b4f0ad9c Follow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future.mm testcase.
Turns out 1000 unjoined threads are a bit too rough in certain environments.

llvm-svn: 289971
2016-12-16 18:44:01 +00:00
Evgeniy Stepanov 40f05dcec9 [msan] Intercept getutent and friends.
Differential Revision: https://reviews.llvm.org/D27791

llvm-svn: 289878
2016-12-15 22:00:14 +00:00
Hans Wennborg 603679849d Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)"
It breaks programs on Mac. See comments on the code review for details.

llvm-svn: 289864
2016-12-15 20:11:12 +00:00
Mike Aizatsky 94752697ee [sanitizers] dont dump coverage if not asked to
llvm-svn: 289835
2016-12-15 17:30:58 +00:00
Kuba Mracek 659949cb03 [tsan] Add interceptor for libcxx __shared_count::__release_shared()
We already have an interceptor for __shared_weak_count::__release_shared, this patch handles __shared_count::__release_shared in the same way. This should get rid of TSan false positives when using std::future.

Differential Revision: https://reviews.llvm.org/D27797

llvm-svn: 289831
2016-12-15 16:45:28 +00:00
Kostya Serebryany 6bca8423c9 [sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)
llvm-svn: 289690
2016-12-14 19:10:17 +00:00
Dmitry Vyukov 963f5490e2 tsan: allow Java VM iterate over allocated objects
Objects may move during the garbage collection, and JVM needs
to notify ThreadAnalyzer about that. The new function
__tsan_java_find eliminates the need to maintain these
objects both in ThreadAnalyzer and JVM.

Author: Alexander Smundak (asmundak)
Reviewed in https://reviews.llvm.org/D27720

llvm-svn: 289682
2016-12-14 18:20:18 +00:00
Kostya Kortchinsky a37860acee [scudo] Relax the memalign test
Summary:
Now that we are not rounding up the sizes passed to the secondary allocator,
the memalign test could run out of aligned addresses to return for larger
alignments. We now reduce the size of the quarantine for that test, and
allocate less chunks for the larger alignments.

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27760

llvm-svn: 289665
2016-12-14 16:38:11 +00:00
Mike Aizatsky f775dbb5f4 [sanitizers] -DAG is order-independent check
llvm-svn: 289606
2016-12-13 22:26:04 +00:00
Ulrich Weigand 50d4ec66d4 [sancov] Disable failing test on SystemZ as well
This doesn't work at all on big-endian systems, even just reading in the
magic bytes in the binary .sancov file header gets byte order wrong.

llvm-svn: 289539
2016-12-13 14:44:25 +00:00
Renato Golin 08c2563cb1 [sancov] Mark as unstable on ARM, not XFAIL, since it does pass on some config
llvm-svn: 289526
2016-12-13 10:22:49 +00:00
Mike Aizatsky f723811972 [sanitizers] dso order is random, test shouldnt depend on it
llvm-svn: 289516
2016-12-13 05:24:57 +00:00
Mike Aizatsky b67efec03b [sanitizers] powerpc4 is also unsupported platform
llvm-svn: 289515
2016-12-13 05:21:19 +00:00
Mike Aizatsky df80572d1f [sanitizers] disabling dso test as well where appropriate
llvm-svn: 289508
2016-12-13 01:11:46 +00:00
Mike Aizatsky e20a4c8859 [sanitizers] trace-pc-guard doesn't work on mac as well
fatal error: error in backend: Global variable '__sancov_gen_' has an
invalid section specifier '__sancov_guards': mach-o section specifier
requires a segment and section separated by a comma.

llvm-svn: 289507
2016-12-13 01:10:21 +00:00
Mike Aizatsky 1e2f30e957 [sanitizers] sancov really works on x86 only
llvm-svn: 289505
2016-12-13 00:34:33 +00:00
Mike Aizatsky aaa637001a [sancov] __sanitizer_dump_coverage api
Subscribers: kubabrecka, mgorny

Differential Revision: https://reviews.llvm.org/D26758

llvm-svn: 289498
2016-12-12 23:45:38 +00:00
Petr Hosek 627f686ffc [XRay][CMake] Check target for XRay Flight Data Recorder
This target doesn't currently do anything, but it is required by
the runtimes build.

Differential Revision: https://reviews.llvm.org/D27640

llvm-svn: 289420
2016-12-12 05:18:36 +00:00
Kuba Mracek b93f78128f [sanitizer] Handle malloc_destroy_zone() on Darwin
We currently have a interceptor for malloc_create_zone, which returns a new zone that redirects all the zone requests to our sanitizer zone. However, calling malloc_destroy_zone on that zone will cause libmalloc to print out some warning messages, because the zone is not registered in the list of zones. This patch handles this and adds a testcase for that.

Differential Revision: https://reviews.llvm.org/D27083

llvm-svn: 289375
2016-12-11 08:42:42 +00:00
Renato Golin 3bdc0f165b [DFSAN] Another unstable test in AArch64 breaking bots unnecessarily
llvm-svn: 289253
2016-12-09 19:02:04 +00:00
Vitaly Buka 6eead19ce4 [asan] Add test which detects bugs undetectable before r288563
Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D27583

llvm-svn: 289090
2016-12-08 19:13:13 +00:00
Sagar Thakur 76a878b8f8 [MSAN][MIPS] Fix fork.cc test on MIPS
Summary: For platforms which support slow unwinder only, we restrict the store context size to 1, basically only storing the current pc. We do this because the slow unwinder which is based on libunwind is not async signal safe and causes random freezes in forking applications as well as in signal handlers.

Reviewed by eugenis.
Differential: D23107

llvm-svn: 289027
2016-12-08 06:30:58 +00:00
Serge Rogatch 3c265b55fc [XRay][AArch64] Disable the unstable test XRay-aarch64-linux::patching-unpatching.cc
Summary:
The test `XRay-aarch64-linux::patching-unpatching.cc` sometimes passes, sometimes fails on buildbots.
This patch disables test `patching-unpatching.cc` for AArch64 targets.

Reviewers: rengolin, dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

Differential Revision: https://reviews.llvm.org/D27528

llvm-svn: 288988
2016-12-07 22:00:02 +00:00
Renato Golin cb2443e80c [asan] Disable yet another unstable test under AArch64
llvm-svn: 288953
2016-12-07 18:37:49 +00:00
Evgeniy Stepanov 74cf034805 Replace "|&" with "2>&1 |" to support bash pre-4
Summary: Old bash release (3.2) on SLES11 chokes on new redirection shortcut.

Patch by Brian Cain.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D27443

llvm-svn: 288854
2016-12-06 22:02:21 +00:00
Dean Michael Berris 406200eae6 [XRay][compiler-rt] Only add unit tests if we're building XRay.
As constructed before this patch, in case we run into case where we
don't actually build the XRay library, we really ought to not be adding
the unit test runs. This should fix the bootstrap build failures.

This is a follow-up further to D26232.

llvm-svn: 288788
2016-12-06 09:43:44 +00:00
Dean Michael Berris dcd2748a34 [XRay][compiler-rt] CMake fixes for XRay -- take 2.
The bootstrap buildbot complains about not being able to find the
unittests for XRay, when the conditionals to include or not include
tests and unit tests don't match.

This is a follow-up to D26232.

llvm-svn: 288786
2016-12-06 08:40:16 +00:00
Dean Michael Berris d94c0bf4be [XRay][compiler-rt] Fix unit test adding logic.
Before this change we would add the unit tests potentially even if we
don't actually include the unit tests.

This is a follow-up on D26232.

llvm-svn: 288785
2016-12-06 08:22:31 +00:00
Dean Michael Berris abe04e3295 [XRay][compiler-rt] XRay Buffer Queue
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

This is a re-roll of the previous attempt to submit, because it caused
failures in arm and aarch64.

Reviewers: majnemer, echristo, rSerge

Subscribers: tberghammer, danalbert, srhines, modocache, mehdi_amini, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26232

llvm-svn: 288775
2016-12-06 06:24:08 +00:00
Mike Aizatsky 48ee418f88 [sanitizers] mac prints null differently
llvm-svn: 288726
2016-12-05 23:06:07 +00:00
Mike Aizatsky 0d98da7c1f [sanitizers] __sanitizer_get_module_and_offset_for_pc interface function
Summary: The function computes full module name and coverts pc into offset.

Reviewers: kcc

Subscribers: kubabrecka

Differential Revision: https://reviews.llvm.org/D26820

llvm-svn: 288711
2016-12-05 21:45:14 +00:00
Filipe Cabecinhas 8c1c8e5d7c Revert "Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)"
This reverts commit r288504.

clang-bpf-build fails with no details:
******************** TEST 'AddressSanitizer-x86_64-linux ::
TestCases/masked-ops.cpp' FAILED ********************
Script:
--
/mnt/buildbot/slave-root/clang-bpf-build/stage1/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -o /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp -mavx -O1
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l1 2>&1 | FileCheck -check-prefix=CHECK-L1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l6 2>&1 | FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp la 2>&1 | FileCheck -check-prefix=CHECK-LA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s1 2>&1 | FileCheck -check-prefix=CHECK-S1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s6 2>&1 | FileCheck -check-prefix=CHECK-S6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp sa 2>&1 | FileCheck -check-prefix=CHECK-SA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
--
Exit Code: 2

Command Output (stderr):
--
FileCheck error: '-' is empty.
FileCheck command line:  FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp

--

********************

llvm-svn: 288507
2016-12-02 16:19:14 +00:00
Filipe Cabecinhas 2f461bf24a Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)
Summary:
Unfortunately, there is no way to emit an llvm masked load/store in
clang without optimizations, and AVX enabled. Unsure how we should go
about making sure this test only runs if it's possible to execute AVX
code.

Reviewers: kcc, RKSimon, pgousseau

Subscribers: kubabrecka, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D26506

llvm-svn: 288504
2016-12-02 15:33:04 +00:00
NAKAMURA Takumi 5ce101a848 compiler-rt/test/profile/Linux/lit.local.cfg: [Py3] Use text mode (universal_newlines=True).
llvm-svn: 288490
2016-12-02 08:17:17 +00:00
Kostya Kortchinsky 1148dc5274 [scudo] 32-bit and hardware agnostic support
Summary:
This update introduces i386 support for the Scudo Hardened Allocator, and
offers software alternatives for functions that used to require hardware
specific instruction sets. This should make porting to new architectures
easier.

Among the changes:
- The chunk header has been changed to accomodate the size limitations
  encountered on 32-bit architectures. We now fit everything in 64-bit. This
  was achieved by storing the amount of unused bytes in an allocation rather
  than the size itself, as one can be deduced from the other with the help
  of the GetActuallyAllocatedSize function. As it turns out, this header can
  be used for both 64 and 32 bit, and as such we dropped the requirement for
  the 128-bit compare and exchange instruction support (cmpxchg16b).
- Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2
  instruction set is supported, use the 32-bit CRC32 instruction, and in the
  XorShift128, use a 32-bit based state instead of 64-bit.
- Add software support for CRC32: if SSE 4.2 is not supported, fallback on a
  software implementation.
- Modify tests that were not 32-bit compliant, and expand them to cover more
  allocation and alignment sizes. The random shuffle test has been deactivated
  for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't
  currently randomize chunks.

Reviewers: alekseyshl, kcc

Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache

Differential Revision: https://reviews.llvm.org/D26358

llvm-svn: 288255
2016-11-30 17:32:20 +00:00
Xinliang David Li 8b19a0a100 [Profile] Fix value profiler eviction bug
Differential Revision: https://reviews.llvm.org/D27224

llvm-svn: 288204
2016-11-29 22:00:54 +00:00
Kuba Mracek ff1bd20ded [sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

Differential Revision: https://reviews.llvm.org/D26929

llvm-svn: 288186
2016-11-29 19:25:53 +00:00
Filipe Cabecinhas c707bbf081 Revert "Compiler-rt part of D26230: Add (constant) masked load/store support"
This reverts commit r288162. Buildbot clang-bpf-build fails running tests.

llvm-svn: 288173
2016-11-29 18:08:24 +00:00
Filipe Cabecinhas bca5fd4f81 Compiler-rt part of D26230: Add (constant) masked load/store support
Summary:
Unfortunately, there is no way to emit an llvm masked load/store in
clang without optimizations, and AVX enabled. Unsure how we should go
about making sure this test only runs if it's possible to execute AVX
code.

Reviewers: kcc, RKSimon, pgousseau

Subscribers: kubabrecka, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D26506

llvm-svn: 288162
2016-11-29 16:56:59 +00:00
Evgeniy Stepanov d3305afc75 Return memory to OS right after free (not in the async thread).
Summary:
In order to avoid starting a separate thread to return unused memory to
the system (the thread interferes with process startup on Android,
Zygota waits for all threads to exit before fork, but this thread never
exits), try to return it right after free.

Reviewers: eugenis

Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

Differential Revision: https://reviews.llvm.org/D27003

llvm-svn: 288091
2016-11-29 00:22:50 +00:00
Kuba Mracek 809dea2aeb [asan] Attempt to fix the debug_double_free.cc testcase on Windows after r288065.
llvm-svn: 288067
2016-11-28 21:28:41 +00:00
Kuba Mracek 48090f5b82 [asan] Provide bug descriptions for all reports (not just ErrorGeneric)
Differential Revision: https://reviews.llvm.org/D27012

llvm-svn: 288065
2016-11-28 21:18:15 +00:00
Marcin Koscielnicki b3d93889f5 [sanitizers] Get the proper printf/scanf version when long double transition is involved.
See D19555 for rationale.  As it turns out, this treatment is also necessary
for scanf/printf.

Differential Revision: https://reviews.llvm.org/D27118

llvm-svn: 288064
2016-11-28 21:15:19 +00:00
Kuba Mracek 3a481cf0bd [tsan] Fix the lit expansion of %deflake not to eat a space
The lit expansion of "%deflake " (notice the space after) expands in a way that the space is removed, this fixes that.

Differential Revision: https://reviews.llvm.org/D27139

llvm-svn: 287989
2016-11-26 19:09:32 +00:00
Kuba Mracek 23551fa811 [asan] Support handle_sigill on Darwin
Handling SIGILL on Darwin works fine, so let's just make this feature work and re-enable the ill.cc testcase.

Differential Revision: https://reviews.llvm.org/D27141

llvm-svn: 287959
2016-11-26 01:30:31 +00:00
Kuba Mracek 073cea6128 [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV
This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag.

Differential Revision: https://reviews.llvm.org/D11365

llvm-svn: 287957
2016-11-26 00:50:08 +00:00
Dean Michael Berris 291d74bdb4 Revert "[XRay][compiler-rt] XRay Buffer Queue"
Broke the build on arm7 and aarch64.

llvm-svn: 287911
2016-11-25 03:54:45 +00:00
Dean Michael Berris 47119579c8 [XRay][compiler-rt] XRay Buffer Queue
Summary:
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

Reviewers: majnemer, rSerge, echristo

Subscribers: mehdi_amini, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26232

llvm-svn: 287910
2016-11-25 03:14:10 +00:00
Kuba Mracek b59118f6ec [tsan] Add support for GCD dispatch_suspend and dispatch_resume
GCD queues can be suspended and resumed with dispatch_suspend and dispatch_resume. We need to add synchronization between the call to dispatch_resume and any subsequent executions of blocks in the queue that was resumed. We already have an Acquire(q) before the block executes, so this patch just adds the Release(q) in an interceptor of dispatch_resume.

Differential Revision: https://reviews.llvm.org/D27112

llvm-svn: 287902
2016-11-24 21:24:54 +00:00
Vedant Kumar 3ac1d4dc10 [test] Use a helper macro to refer to MAP_ANON (NFC)
Some of our internal bots use old SDK's which don't define MAP_ANON.
Use a helper macro to pass the right flag into mmap().

llvm-svn: 287833
2016-11-23 22:23:42 +00:00
Kuba Mracek e99e8d345c [sanitizer] Fix the dedup_token_length_test.cc testcase to not fail when user's home directory contains "bar"
Differential Revision: https://reviews.llvm.org/D24605

llvm-svn: 287696
2016-11-22 20:24:26 +00:00
Dmitry Vyukov 9c5bab23ee tsan: fix build after 287632
1. Mac does not have MAP_32BIT.
Define it to 0 if it is not defined.

2. We are lacking nolibc stub for ListOfModules::init.
Add it.

llvm-svn: 287634
2016-11-22 11:09:35 +00:00
Dmitry Vyukov 5c5d4766f8 tsan: switch libignore from /proc/self/maps to dl_iterate_phdr
/proc/self/maps can't be read atomically, this leads to episodic
crashes in libignore as it thinks that a module is loaded twice.
See the new test for an example.
dl_iterate_phdr does not have this problem.
Switch libignore to dl_iterate_phdr.

llvm-svn: 287632
2016-11-22 09:49:11 +00:00
Kuba Mracek d692ea1e87 [asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deployment target of 10.11+)
The ODR detection in initialization-bug.cc now works on Darwin (due to the recently enabled "live globals" on-by-default), but only if the deployment target is 10.11 or higher. Let's adjust the testcases.

Differential Revision: https://reviews.llvm.org/D26927

llvm-svn: 287581
2016-11-21 21:48:25 +00:00
Ivan Krasin 694c28495a Add a test for vcall on a null ptr.
Summary:
Turns out that in the case of -fsanitize=null and a virtual call,
the type check was generated *after* reading from vtable, which
causes a non-interpretable segfault. The check has been moved up
in https://reviews.llvm.org/D26559 and this CL adds a test for this case.

Reviewers: pcc

Subscribers: cfe-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D26560

llvm-svn: 287578
2016-11-21 21:23:56 +00:00
Reid Kleckner 7a7477c71f [asan] Un-XFAIL Windows global dead stripping test cases
Test update for r287576

llvm-svn: 287577
2016-11-21 20:40:56 +00:00
Renato Golin 2b9d742ae7 [ARM|ASAN] Disabling more unstable ASAN tests
We're seeying these errors with GCC and Clang on different systems, while
some other identical OSs on different boards fail. Like many other ASAN
tests, there seem to be no easy way to investigate this other than someone
familiar with the sanitizer code and the ARM libraries.

At least, for now, we'll silence the bots. I'll create a bugzilla entry.

llvm-svn: 287464
2016-11-19 21:19:19 +00:00
Reid Kleckner 39950b0f92 [asan] Create a .ASAN$G(A-Z) section for global registration
Summary:
The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

The two tests added for this feature will fail until the LLVM
instrumentation change in D26770 lands, so they are marked XFAIL for
now.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D26771

llvm-svn: 287246
2016-11-17 19:02:53 +00:00
Anna Zaks 4cb4c7f4b1 [asan] Update the tests as Mach-O metadata liveness tracking is on by default
This commit reverts r274579.

llvm-svn: 287236
2016-11-17 16:56:11 +00:00
Kuba Brecka cf8d1fc3d8 [asan] Re-enable the use-after-scope-types.cc test on Darwin, now that r287028 fixed the llvm-symbolizer issue that broke this test.
Differential Revision: https://reviews.llvm.org/D26537

llvm-svn: 287029
2016-11-15 21:08:51 +00:00
Anna Zaks 71b55d92c5 [asan] Fixup to r286608 that makes the test pass on iOS.
TARGET_OS_IPHONE is defined in TargetConditionals.h. Without the include the
iOS path is never triggered.

llvm-svn: 286929
2016-11-15 01:57:29 +00:00
Vedant Kumar 8f21c0e50a [cfi] Mark tests as xfailing on Darwin
This allows them to be run on other platforms, undoing damage from
r286902.

llvm-svn: 286904
2016-11-14 23:12:52 +00:00
Vedant Kumar 4f4e522b97 [cfi] Mark some tests as requiring additional support from the MachO writer
These tests need to be marked as unsupported on Darwin:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1545

llvm-svn: 286902
2016-11-14 22:50:13 +00:00
Kuba Brecka b0dd454a1a [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), compiler-rt part
This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

Differential Revision: https://reviews.llvm.org/D26177

llvm-svn: 286894
2016-11-14 21:41:33 +00:00
Evgeniy Stepanov eee04c8f12 Temporarily relax test expectations to fix failures on ppc64.
Summary: Relax test expectations to fix failures on ppc64.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

Differential Revision: https://reviews.llvm.org/D26629

llvm-svn: 286885
2016-11-14 20:46:52 +00:00
Reid Kleckner d0c646117f Remove pwd to fix WinASan bot
It only slipped in while I was debugging the test case.

llvm-svn: 286854
2016-11-14 18:02:42 +00:00
Reid Kleckner 171a7022aa Split strncmp and strncasecmp test and XFAIL one for Windows
llvm-svn: 286850
2016-11-14 17:51:11 +00:00
Reid Kleckner e1e344ed05 [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization
Summary:
ASan needs to initialize before ucrtbase.dll so that it can intercept
all of its heap allocations. New versions of dbghelp.dll depend on
ucrtbase.dll, which means both of those DLLs will initialize before the
dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we
avoid the issue.

Eventually, I would like to remove our dbghelp.dll dependency in favor
of always using llvm-symbolizer.exe, but this seems like an acceptable
interim solution.

Fixes PR30903

Reviewers: etienneb

Subscribers: kubabrecka, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26473

llvm-svn: 286848
2016-11-14 17:37:50 +00:00
Strahinja Petrovic f10d114d43 [lsan] [aarch64] Fix printing of pointers in make check tests - update
This patch replaces fprintf with print_address function in LSAN
tests. This is necessary because of different printing of pointers
in fprintf and sanitizer's print function. 
Differential Revision: https://reviews.llvm.org/D26084.

llvm-svn: 286816
2016-11-14 11:40:56 +00:00
Vitaly Buka c557191b21 [asan] Fix strncmp and strncasecmp interceptors
Summary:
In non-strict mode we will check memory access for both strings from beginning
to either:
  1. 0-char
  2. size
  3. different chars

In strict mode we will check from beginning to either:
  1. 0-char
  2. size

Previously in strict mode we always checked up to the 0-char.

Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D26574

llvm-svn: 286708
2016-11-12 04:32:31 +00:00
Anna Zaks 03136efd1b [tsan] Test that false races from ObjC's dealloc, .cxx_destruct, and initialize are ignored
Differential Revision: https://reviews.llvm.org/D26228

llvm-svn: 286693
2016-11-12 00:46:07 +00:00
Evgeniy Stepanov ececb37e39 [tsan] Fix typo in test.
llvm-svn: 286674
2016-11-11 23:25:09 +00:00
Reid Kleckner cb03ef90bb Disable a test using posix_spawn on Android
llvm-svn: 286673
2016-11-11 23:23:33 +00:00
Evgeniy Stepanov 31f4eb5f5b Tread TSan LLVM flags to driver: unit tests.
Summary: Unit tests for the new clang flags.

Reviewers: eugenis, dvyukov

Subscribers: kubabrecka, llvm-commits

Patch by Alex Shlyapnikov.

Differential Revision: https://reviews.llvm.org/D26462

llvm-svn: 286670
2016-11-11 23:17:49 +00:00
Evgeniy Stepanov a0fb81fe37 [cfi] Test case for weak symbol handling.
llvm-svn: 286637
2016-11-11 21:39:35 +00:00
Reid Kleckner 47dc7f5550 Add a test that uses coverage and printf from a DLL
This test fails without LLVM r286615

llvm-svn: 286618
2016-11-11 19:27:52 +00:00
Evgeniy Stepanov 753953b02d [cfi] Tweak a test for the cfi-icall change.
llvm-svn: 286612
2016-11-11 18:49:15 +00:00
Reid Kleckner 359fafe74c Add missing %run to test to fix AArch64 buildbot
llvm-svn: 286609
2016-11-11 18:11:33 +00:00
Reid Kleckner 2a2bc7293e [asan/win] Fix wrong TerminateProcess exit code
Add a test for it.

llvm-svn: 286608
2016-11-11 17:51:51 +00:00
Sylvestre Ledru 3383f946ab Force the locale when executing ld gold
Summary:
If run with other locales (like French),
the decode operation might fail

This is the same change as in r246421 for llvm.

llvm-svn: 286605
2016-11-11 17:46:51 +00:00
Sagar Thakur cdfdff0b18 [MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64
Changed the kernel sigaction structure in test syscalls_sigaction.cc for MIPS according to the structure defined in kernel.

Reviewed by eugenis.
Differential: https://reviews.llvm.org/D25814

llvm-svn: 286583
2016-11-11 12:05:30 +00:00
Evgeniy Stepanov a50bc7fddb [asan] Ignore host LD_LIBRARY_PATH in device tests.
I'm not sure why is it there, but it is breaking tests on Android N
because of unexpected linker output about an empty LD_LIBRARY_PATH
entry.

llvm-svn: 286321
2016-11-09 00:33:43 +00:00
Evgeniy Stepanov fcba0d647c [asan] Disable unexpected passing test.
This test fails on some versions of Android and passes on other versions.
Replace XFAIL with UNSUPPORTED.

llvm-svn: 286320
2016-11-09 00:33:41 +00:00
Reid Kleckner d092107b0e [asan/win] Add init hooks to .CRT$XLAB
Summary:
User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
Chromium:
https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs

This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.

The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.

Reviewers: etienneb

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D26404

llvm-svn: 286290
2016-11-08 20:45:45 +00:00
Dmitry Vyukov 62f99cc486 tsan: more precise handling of atomic stores
Atomic stores terminate release sequences on the atomic variable,
and must use ReleaseStore primitive instead of Release.
This was broken in r192355 during a refactoring.
Restore correct behavior and add a test.

llvm-svn: 286211
2016-11-08 05:34:50 +00:00
Evgeniy Stepanov f95e706371 [asan] Add missing header in a test.
llvm-svn: 286191
2016-11-08 01:17:58 +00:00
Evgeniy Stepanov 4fcbb24deb [asan] Fix one test on Android N.
A fake strtol interceptor should at least make forward progress.

llvm-svn: 286187
2016-11-08 00:59:54 +00:00
Kuba Brecka c784b36fca [tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments don't have nullptr.
llvm-svn: 286166
2016-11-07 22:26:13 +00:00
Evgeniy Stepanov 5d387286d0 Use -fsanitize-recover instead of -mllvm -msan-keep-going: tests.
Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: unit tests.

Reviewers: eugenis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D26355

Patch by Aleksey Shlyapnikov.

llvm-svn: 286149
2016-11-07 21:02:56 +00:00
Kuba Brecka 19679f97ed [tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part
Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

Differential Revision: https://reviews.llvm.org/D26266

llvm-svn: 286136
2016-11-07 19:10:13 +00:00
Reid Kleckner 3501fdcb30 [asan] Add more dynamic CRT mode tests
Only tests using %clang_cl_asan were using the dynamic CRT before this.
The unit tests and lit tests using %clangxx_asan were using the static
CRT. Many cross-platform tests fail with the dynamic CRT, so I had to
add win32-(static|dynamic)-asan lit features.

Also deletes some redundant tests in TestCases/Windows that started
failing with this switch.

llvm-svn: 285821
2016-11-02 15:39:08 +00:00
Kuba Brecka be0f80a284 [tsan] Enable the tsan/libcxx/ testcase(s) on Darwin
Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it.

Differential Revision: https://reviews.llvm.org/D26162

llvm-svn: 285634
2016-10-31 20:50:15 +00:00
Kuba Brecka bf6e7848a0 [asan] Move instrumented null-terminated strings to a special section, compiler-rt part
On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

Differential Revision: https://reviews.llvm.org/D25026

llvm-svn: 285620
2016-10-31 18:52:32 +00:00
Kuba Brecka 0222eacf0f [tsan] Add support for GCD target queues
GCD (libdispatch) has a concept of “target queues”: Each queue has either an implicit or explicit target queue, where the task is handed over to when it’s time to execute it. For example, a concurrent queue can have a serial target queue (effectively making the first queue serial), or multiple queues can have the same serial target queue (which means tasks in all the queues are mutually excluded). Thus we need to acquire-release semantics on the full “chain” of target queues.

This patch changes the way we Acquire() and Release() when executing tasks in queues. Now we’ll walk the chain of target queues and synchronize on each queue that is serial (or when dealing with a barrier block). This should avoid false positives when using dispatch_set_target_queue().

Differential Revision: https://reviews.llvm.org/D25835

llvm-svn: 285613
2016-10-31 18:28:02 +00:00