[msan] Fix false positive on dynamic tls.

Use existing DTLS code in sanitizer_tls_get_addr.{h,cc} to unpoison DTLS
blocks both on allocation and deallocation.

https://code.google.com/p/memory-sanitizer/issues/detail?id=44


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211683 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] Fix build on platforms where dtls support is disabled.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211684 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Fix bad interaction between with-calls mode and chained origin tracking.

Origin history should only be recorded for uninitialized values, because it is
meaningless otherwise. This change moves __msan_chain_origin to the runtime
library side and makes it conditional on the corresponding shadow value.

Previous code was correct, but _very_ inefficient.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211700 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] When iterating over segments on OSX, treat the segments' initial
protection level as their current protection level.
This fixes the UNIMPLEMENTED check that started to fire on OSX after r210649.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211713 91177308-0d34-0410-b5e6-96231b3b80d8
tsan: add __tsan_java_finalize interface function
It is required to prevent false positives between object ctor and finalizer,
as otherwise they look completely unsynchronized.



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211829 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Fix truncated stack trace in chained origin reports.

This is a leftover from the times when the next (chained) origin id
was stored as the last frame of a stack trace.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211878 91177308-0d34-0410-b5e6-96231b3b80d8
[tsan] Disable a failing test.

java_finalizer is failing on all sanitizer bots since it was added in r211829.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211882 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Add store_context_size= flag.

A new flag to control stack trace size for store event (in
track-origins=2 mode) independently of malloc_context_size.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211896 91177308-0d34-0410-b5e6-96231b3b80d8
tsan: fix and re-enable a test


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@211966 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Limit stack origin chain length.

Stack origins were created with unlimited length by mistake.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212036 91177308-0d34-0410-b5e6-96231b3b80d8
Fix apparent thinko in r209744: allocator stats can be zero

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212071 91177308-0d34-0410-b5e6-96231b3b80d8
Add the way to disable MSan unit tests for _mm_* intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212082 91177308-0d34-0410-b5e6-96231b3b80d8
[TSan] Equalize the behavior of __tsan_get_allocated_size and user_alloc_usable_size.

The former used to crash with a null deref if it was given a not owned pointer,
while the latter returned 0. Now they both return 0. This is still not the best possible
behavior: it is better to print an error report with a stack trace, pointing
to the error in user code, as we do in ASan.



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212112 91177308-0d34-0410-b5e6-96231b3b80d8
[MSan] Fixup r212082: enable tests for _mm_ intrinsics if and only if the
unit test source file is compiled with Clang.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212121 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Print exact source location of global variables in error reports.

See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the
original feature request.

Introduce llvm.asan.globals metadata, which Clang (or any other frontend)
may use to report extra information about global variables to ASan
instrumentation pass in the backend. This metadata replaces
llvm.asan.dynamically_initialized_globals that was used to detect init-order
bugs. llvm.asan.globals contains the following data for each global:
  1) source location (file/line/column info);
  2) whether it is dynamically initialized;
  3) whether it is blacklisted (shouldn't be instrumented).

Source location data is then emitted in the binary and can be picked up
by ASan runtime in case it needs to print error report involving some global.
For example:

  0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40

These source locations are printed even if the binary doesn't have any
debug info.

This is an ABI-breaking change. ASan initialization is renamed to
__asan_init_v4(). Pre-built libraries compiled with older Clang will not work
with the fresh runtime.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212188 91177308-0d34-0410-b5e6-96231b3b80d8
XFAIL test on Android (this is a known issue)

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212211 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Stop propagating shadow in blacklisted functions.

With this change all values passed through blacklisted functions
become fully initialized. Previous behavior was to initialize all
loads in blacklisted functions, but apply normal shadow propagation
logic for all other operation.

This makes blacklist applicable in a wider range of situations.

It also makes code for blacklisted functions a lot shorter, which
works as yet another workaround for PR17409.


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


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212266 91177308-0d34-0410-b5e6-96231b3b80d8
[msan] Stop propagating shadow in blacklisted functions.

With this change all values passed through blacklisted functions
become fully initialized. Previous behavior was to initialize all
loads in blacklisted functions, but apply normal shadow propagation
logic for all other operation.

This makes blacklist applicable in a wider range of situations.

It also makes code for blacklisted functions a lot shorter, which
works as yet another workaround for PR17409.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212268 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Fix unused variable warning.


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