[asan] Relax stack-overflow test.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201571 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] make sure the deadlock detector survives the change of epochs; add a test and a comment

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201572 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Rename several variables

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201575 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] when reporting a deadlock also report the lock cycle

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201576 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan/Win] Add a couple more DLL thunks

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201580 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Rudimentary support for standalone CompilerRT build system.

This change allows to build compiler-rt libraries separately from
LLVM/Clang (path to LLVM build directory should be specified at
configure time). Running tests is not yet supported.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201647 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Added assembly functions for x86/amd64 asan.

These are runtime support functions for inline assembly instrumentation.
This is a re-submit of r201402.

Patch by Yuri Gorshenin.



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201650 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Fix build on ARM.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201652 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Disable asm instrumentation and tests on Mac.

Move asm tests to their own file.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201653 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Add the way to run tests in standalone build.

1) Depend on llvm-config (configured in LLVM_CONFIG_PATH) to
get necessary LLVM source/binary directories.
2) Add basic support for running lit tests (check-xsan commands).
For now this "support" is far from what we want:
  * unit tests are not built currently.
  * lit tests use Clang/compiler-rt from LLVM build directory,
    not the host compiler or just-built compiler-rt libraries.

We should make a choice on the way we intend ti run compiler-rt lit testsuite:
a) use either Clang from LLVM build tree, or the host compiler.
b) use either just-built runtimes, or the runtimes shipped with the
host compiler.

Using just-built runtimes is tricky - we have to know where to put them, so that
Clang/GCC driver would pick them up (and not overwrite the existing runtimes).
Using a host compiler instead of Clang from LLVM build tree will give us a chance to
run lit tests under GCC (which already has support for several sanitizers).

That is, I tend to make the following choice: if we're in a standalone compiler-rt
build, use host compiler with its set of runtime libraries to run lit tests.
This will effectively decouple "make compiler-rt" and "make check-compiler-rt" in
a standalone build - the latter wouldn't invoke the former. Note that if we decide
to fix LLVM/Clang/compiler-rt build system so that it would configure/build
compiler-rt with just-built Clang (as we do in Makefile-based build), this will not
be a problem - we can add a dependency to ensure that clang/compiler-rt are rebuilt
before running compiler-rt tests.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201656 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Improve stack overflow detection.

There are more cases when those manifest as an access below SP.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201664 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201666 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Ensure that stack is limited before attempting to overflow it.

Very bad things happen otherwise.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201670 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Use host compiler to build unittests in standalone mode

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201672 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] A different way of detectinb stack overflow.

Instead of checking stack limits that are not well defined for the main thread,
we rely on siginfo::si_code and distance from SP.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201673 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Use host compiler to run lit tests in standalone mode

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201674 91177308-0d34-0410-b5e6-96231b3b80d8
[tsan] when printing a mutex, also print its address. Properly print the deadlock report.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201675 91177308-0d34-0410-b5e6-96231b3b80d8
[tsan] improve the test that checks for lock inversion with 3 locks

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201676 91177308-0d34-0410-b5e6-96231b3b80d8
Add rudimentary support for running compiler-rt lit tests with GCC

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201680 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Do all calls to __asan_report_* through PLT.

This matters when runtime is built as a shared library. Even though calling
code is itself part of the same library, these symbols are public and can
(theoretically) be interposed.

It might be better to declare hidden aliases for asan_report_* and call them
directly, but
  (a) they are (noreturn), so performance does not matter, and
  (b) it may be potentially less portable.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201764 91177308-0d34-0410-b5e6-96231b3b80d8