Commit Graph

4347 Commits

Author SHA1 Message Date
Alexey Samsonov cd0a4aaba3 Don't check lint for SpecialCaseList.cpp
llvm-svn: 212642
2014-07-09 19:29:10 +00:00
Dmitry Vyukov 67ccf9851c tsan: reapply 212531 and 212532 with a fix
don't reset s->addr as well

llvm-svn: 212565
2014-07-08 20:37:16 +00:00
Alexey Samsonov 047ea1717b [TSan] Revert r212531 and r212532.
They cause "check-tsan" command to hang. Details in r212532 review thread.

llvm-svn: 212562
2014-07-08 20:17:19 +00:00
Dmitry Vyukov 3f5ad1a98e tsan: allow memory overlap in __tsan_java_move
JVM actually moves memory between overlapping ranges.

llvm-svn: 212560
2014-07-08 20:01:12 +00:00
Evgeniy Stepanov eb893a1fd6 [msan] Fix out of bounds access in origin copying.
llvm-svn: 212534
2014-07-08 14:15:23 +00:00
Kostya Serebryany 6136aae323 [tsan] Enable tsan's deadlock detector by default.
The tsan's deadlock detector has been used in Chromium for a while;
it found a few real bugs and reported no false positives.
So, it's time to give it a bit more exposure.

llvm-svn: 212533
2014-07-08 13:40:08 +00:00
Dmitry Vyukov edbb54d60c tsan: fix a potential hang
idx0 is not updated in the branch,
so if we take that branch idx0 will stay updated forever

llvm-svn: 212532
2014-07-08 13:36:59 +00:00
Dmitry Vyukov a480d3013a tsan: fix a bug in metamap
The bug happens in the following case:
Mutex is located at heap block beginning,
when we call MutexDestroy, s->next is set to 0,
so free can't find the MBlock related to the block.

llvm-svn: 212531
2014-07-08 13:28:01 +00:00
Kostya Serebryany 3d570b960e [tsan] fix deadlock detector's interoperation with java locks (https://code.google.com/p/thread-sanitizer/issues/detail?id=67)
llvm-svn: 212529
2014-07-08 13:16:03 +00:00
Dmitry Vyukov b0250948c6 tsan: remove unnecessary line split
llvm-svn: 212527
2014-07-08 13:07:23 +00:00
Kostya Serebryany 7e49b06446 [tsan] fix pthread_rwlock_tryrdlock interceptor, don't try to detect deadlocks when reporting bad unlock
llvm-svn: 212526
2014-07-08 12:46:30 +00:00
Viktor Kutuzov cc02abbb20 Support building floating-point facilities on FreeBSD 9.2 in 32-bit mode
Differential Revision: http://reviews.llvm.org/D3909

llvm-svn: 212518
2014-07-08 08:52:57 +00:00
Alexey Samsonov 1ce0929465 [MSan] Make one more test standalone
llvm-svn: 212487
2014-07-07 20:59:10 +00:00
Alexey Samsonov efe7828c69 [MSan] Use a single file for dso-origin test
llvm-svn: 212484
2014-07-07 20:37:12 +00:00
Alexey Samsonov c1856835d1 [Sanitizer] Move test for malloc/free hooks under test/sanitizer_common
llvm-svn: 212474
2014-07-07 18:47:29 +00:00
Alexey Samsonov 58a046fe56 [ASan] Clean up leftovers from assembly instrumentation helpers
llvm-svn: 212471
2014-07-07 18:11:24 +00:00
Alexey Samsonov 91bb8e0e3a Generalize sanitizer allocator public interface.
Introduce new public header <sanitizer/allocator_interface.h> and a set
of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc.
that will eventually replace their tool-specific equivalents
(__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific
functions are now deprecated and implemented as stubs redirecting
to __sanitizer_ versions (which are implemented differently in each tool).

Replace all uses of __xsan_ versions with __sanitizer_ versions in unit
and lit tests.

llvm-svn: 212469
2014-07-07 17:39:31 +00:00
Timur Iskhodzhanov 575180dbd2 [ASan/Win] Unbreak the build after r211216
llvm-svn: 212465
2014-07-07 16:22:04 +00:00
Evgeniy Stepanov 86c077b3a2 [asan] Remove runtime assembly helpers.
Remove helper functions that were used in assembly instrumentation.

Patch by Yuri Gorshenin.

llvm-svn: 212456
2014-07-07 13:59:12 +00:00
Evgeniy Stepanov f0831ee8d2 [msan] Increase hash table size for chained origins.
llvm-svn: 212448
2014-07-07 10:45:15 +00:00
Evgeniy Stepanov 037f77092e [msan] Better hash function for chained origins.
llvm-svn: 212440
2014-07-07 08:31:55 +00:00
Evgeniy Stepanov 50498e114f [msan] Reformat one source file.
llvm-svn: 212329
2014-07-04 10:07:39 +00:00
Kostya Serebryany 7c163a44aa [sanitizer] support c11 aligned_alloc, Linux only for now
llvm-svn: 212322
2014-07-04 07:30:34 +00:00
Evgeniy Stepanov 4af9c0ea80 [asan] i686-linux-android support.
Large part of this change is required due to
  https://code.google.com/p/android/issues/detail?id=61799
dlsym() crashes when symbol resolution fails, which means
we have to limit the interceptor list instead of relying on
runtime detection.

There are minor differencies in system headers, too.

llvm-svn: 212273
2014-07-03 14:20:56 +00:00
Evgeniy Stepanov 7c2d32bf87 [asan] Fix unused variable warning.
llvm-svn: 212272
2014-07-03 14:14:59 +00:00
Evgeniy Stepanov 174242c74c [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.

llvm-svn: 212268
2014-07-03 11:56:30 +00:00
Evgeniy Stepanov e1a5a1f7a8 Revert of r212265.
llvm-svn: 212266
2014-07-03 11:35:08 +00:00
Evgeniy Stepanov cfc40ef98a [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.

llvm-svn: 212265
2014-07-03 11:18:48 +00:00
Alexey Samsonov cf009f8a53 XFAIL test on Android (this is a known issue)
llvm-svn: 212211
2014-07-02 20:18:41 +00:00
Alexey Samsonov 4f319cca42 [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.

llvm-svn: 212188
2014-07-02 16:54:41 +00:00
Alexey Samsonov e3a401a12b [MSan] Fixup r212082: enable tests for _mm_ intrinsics if and only if the
unit test source file is compiled with Clang.

llvm-svn: 212121
2014-07-01 19:58:41 +00:00
Alexey Samsonov 06ff6cbf4d [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.

llvm-svn: 212112
2014-07-01 18:01:20 +00:00
Alexey Samsonov c0fda339e2 Add the way to disable MSan unit tests for _mm_* intrinsics
llvm-svn: 212082
2014-07-01 01:38:52 +00:00
Alexey Samsonov cffaa1c298 Fix apparent thinko in r209744: allocator stats can be zero
llvm-svn: 212071
2014-06-30 22:40:58 +00:00
Evgeniy Stepanov 4e2d5edb0c [msan] Limit stack origin chain length.
Stack origins were created with unlimited length by mistake.

llvm-svn: 212036
2014-06-30 11:22:42 +00:00
Dmitry Vyukov 9507af2d89 tsan: fix and re-enable a test
llvm-svn: 211966
2014-06-27 22:27:02 +00:00
Evgeniy Stepanov c935ca8c3c [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.

llvm-svn: 211896
2014-06-27 12:48:01 +00:00
Evgeniy Stepanov 63338af398 [tsan] Disable a failing test.
java_finalizer is failing on all sanitizer bots since it was added in r211829.

llvm-svn: 211882
2014-06-27 08:10:27 +00:00
Evgeniy Stepanov 7d3c68a9cf [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.

llvm-svn: 211878
2014-06-27 07:32:08 +00:00
Dmitry Vyukov fb251f51a9 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.

llvm-svn: 211829
2014-06-27 00:47:38 +00:00
Alexander Potapenko b1b8231c8b [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.

llvm-svn: 211713
2014-06-25 15:43:19 +00:00
Evgeniy Stepanov b163f0276f [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.

llvm-svn: 211700
2014-06-25 14:41:57 +00:00
Evgeniy Stepanov 0b2d93c4f0 [sanitizer] Fix build on platforms where dtls support is disabled.
llvm-svn: 211684
2014-06-25 11:43:46 +00:00
Evgeniy Stepanov 7ad0bde843 [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

llvm-svn: 211683
2014-06-25 11:30:35 +00:00
Greg Fitzgerald 7c8bfd804b Remove ARM XFAIL from passing test
llvm-svn: 211608
2014-06-24 16:58:59 +00:00
Daniel Sanders 4dc8a78b04 [asan] adding support of 32-bit address sanitizer for MIPS
Summary: The patch supports both the clang cross-compiler and native compiler

Patch by Kumar Sukhani <Kumar.Sukhani@imgtec.com>

Test Plan:
Kumar had the following asan test results when compiled on a MIPS board:

  Expected Passes    : 96
  Expected Failures  : 2
  Unsupported Tests  : 84
  Unexpected Passes  : 4
  Unexpected Failures: 19

The list of unexpected failures can be found in the review.

Reviewers: kcc, petarj, dsanders

Reviewed By: kcc

Subscribers: farazs, kcc, llvm-commits

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

llvm-svn: 211587
2014-06-24 12:08:18 +00:00
Evgeniy Stepanov 8717fec9af [msan] Fix origin copying.
Conditions for the first and the last origin value in range were wrong.

llvm-svn: 211585
2014-06-24 11:50:26 +00:00
Evgeniy Stepanov ad8065f01a [msan] Print stats even on successful run with atexit=1.
llvm-svn: 211574
2014-06-24 09:04:06 +00:00
Dmitry Vyukov 9eaae3d8f6 tsan: fix code formatting
llvm-svn: 211429
2014-06-21 02:10:17 +00:00
Saleem Abdulrasool d0d1638f96 builtins: assembly routines are not static
Storage Class 3 is static storage.  These symbols need to be marked as external
(storage class 2) so that they can be referenced.  Note that this external is
not the same as ELF "external" visibility, which is indicated by DLL Storage
Class (i.e. __declspec(dllexport) or __declspec(dllimport)).

llvm-svn: 211428
2014-06-21 01:41:21 +00:00