Commit Graph

4347 Commits

Author SHA1 Message Date
Timur Iskhodzhanov d6ac15dd5f Quick-fix a copy-and-paste mistake in one of the ASan test
llvm-svn: 209448
2014-05-22 15:14:05 +00:00
Kostya Serebryany e31d5b6a2c [asan] relax the test for long double
llvm-svn: 209445
2014-05-22 14:50:14 +00:00
Timur Iskhodzhanov b2eb3131f4 [ASan/Win] Make sure the list of wrappers exported by the main module and imported by the DLL thunk always matches
llvm-svn: 209444
2014-05-22 14:49:56 +00:00
Timur Iskhodzhanov 8ff177ede3 [ASan/Win] Thread more library functions from the DLL thunk to the main module
llvm-svn: 209441
2014-05-22 13:57:22 +00:00
Timur Iskhodzhanov 498e56adb6 [ASan/Win] Add more tests for operator new[]
llvm-svn: 209439
2014-05-22 13:28:27 +00:00
Timur Iskhodzhanov 0c7c78f1d1 [ASan/Win] Use the new function interception approach to handle function wrappers too; wrap strlen() in DLLs
Reviewed at http://reviews.llvm.org/D3871

llvm-svn: 209427
2014-05-22 12:03:40 +00:00
Timur Iskhodzhanov 94ffc5bc12 [ASan/Win] Don't use INTERCEPTOR_ATTRIBUTE for operator new/delete on Windows
Reviewed at http://reviews.llvm.org/D3870

llvm-svn: 209416
2014-05-22 11:31:21 +00:00
Timur Iskhodzhanov 818b2e8f71 [ASan/Win] Add a comment about DCL-using-static vs threads
llvm-svn: 209414
2014-05-22 10:24:48 +00:00
Sergey Matveev 162d7cb9d1 [sanitizer] Attempt to fix test.
llvm-svn: 209301
2014-05-21 14:36:05 +00:00
Sergey Matveev 83f91e786c [sanitizer] Add __sanitizer_maybe_open_cov_file().
Summary: Add a new interface function required for coverage sandboxing support.
llvm-svn: 209298
2014-05-21 13:43:52 +00:00
Kostya Serebryany 301a38b0b7 [asan] add a test which ensures that we dump coverage after SEGV
llvm-svn: 209295
2014-05-21 13:20:14 +00:00
Dmitry Vyukov 96ebc5d7db tsan: deflake test
llvm-svn: 209290
2014-05-21 12:02:08 +00:00
Evgeniy Stepanov bce21acf25 [msan] Implement MSAN_OPTIONS=print_stats=1.
llvm-svn: 209287
2014-05-21 09:56:28 +00:00
Evgeniy Stepanov f77f2ece71 [tsan] Fix gotsan build.
llvm-svn: 209286
2014-05-21 09:42:56 +00:00
Evgeniy Stepanov 208aae8ee0 [msan] Chained origins re-design.
Generalize StackDepot and create a new specialized instance of it to
efficiently (i.e. without duplicating stack trace data) store the
origin history tree.

This reduces memory usage for chained origins roughly by an order of
magnitude.

Most importantly, this new design allows us to put two limits on
stored history data (exposed in MSAN_OPTIONS) that help avoid
exponential growth in used memory on certain workloads.

See comments in lib/msan/msan_origin.h for more details.

llvm-svn: 209284
2014-05-21 09:02:13 +00:00
Kostya Serebryany e88161626f [lsan] disable lsan if wordsize is not 64
llvm-svn: 209283
2014-05-21 08:30:18 +00:00
Evgeniy Stepanov 687933f55d [asan] Fix x86 asm instrumentation to preserve flags.
This change also enables asm instrumentation in asan tests that was
accidentally disabled yearlier, and adds a sanity test for that.

Patch by Yuri Gorshenin.

llvm-svn: 209282
2014-05-21 08:21:14 +00:00
Kostya Serebryany b9aa538db1 [sanitizer] fix linux_dirent for SANITIZER_X32; based on patch by H.J. Lu
llvm-svn: 209281
2014-05-21 08:21:13 +00:00
Kostya Serebryany b4e24fccd1 [sanitizer] define SANITIZER_X32 and use it in ThreadDescriptorSize; partially based on patch by H.J. Lu
llvm-svn: 209279
2014-05-21 08:01:44 +00:00
Kostya Serebryany 84019ff7e5 Cast pointers to uptr when calling internal_syscall
For Linux/x86-64, pointers passed to internal_syscall should be casted
to uptr first.  Otherwise, they won't be properly extended to 64-bit for
x32.
Patch by H.J. Lu

llvm-svn: 209278
2014-05-21 07:49:03 +00:00
Kostya Serebryany 6c9eacb384 Use 64-bit pointer to unwind stack for x86-64
X32 uses ILP32 data model in 64-bit hardware mode.  This patch always
uses 64-bit pointer to unwind stack for x86-64.
Patch by H.J. Lu

llvm-svn: 209277
2014-05-21 07:34:03 +00:00
Greg Fitzgerald 1733b5e263 XFAIL ptrace test on arm
The patch adds better target_triple and target_arch defaults for lit tests,
which allows us to XFAIL tests based on architecture.

Was:
  target_triple = LLVM_DEFAULT_TARGET_TRIPLE
  target_arch = HOST_ARCH

Now:
  target_triple = COMPILER_RT_TEST_TARGET_TRIPLE
                , otherwise LLVM_DEFAULT_TARGET_TRIPLE
  target_arch = first item in COMPILER_RT_TEST_TARGET_TRIPLE

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

llvm-svn: 209256
2014-05-20 23:31:26 +00:00
Greg Fitzgerald 38ff567743 [ubsan] fix vptr test on ARM
Differential Revision: http://reviews.llvm.org/D3751

llvm-svn: 209249
2014-05-20 22:07:58 +00:00
Greg Fitzgerald 40a6401b1f Run common and profile tests in cross-compiled builds.
Route target_cflags to common and profile tests

llvm-svn: 209248
2014-05-20 22:04:27 +00:00
Joerg Sonnenberger b1cc6d5603 Go via uintptr_t when casting away constness, otherwise GCC will warn
when using -Wcast-qual.

llvm-svn: 209214
2014-05-20 16:37:07 +00:00
Timur Iskhodzhanov e7894f3b14 [ASan Win] Simplify and improve the way we forward ASan interface calls from DLLs
Reviewed at http://reviews.llvm.org/D3848

llvm-svn: 209210
2014-05-20 14:26:19 +00:00
Sergey Matveev 6d8b9a747c [sanitizer] Fix go build following r209121.
llvm-svn: 209136
2014-05-19 16:08:53 +00:00
Joerg Sonnenberger 5c29582d53 Revert use of 128bit support on 32bit PPC, it breaks build at least with
GCC and that doesn't expose any *ti* functions either.

llvm-svn: 209133
2014-05-19 15:48:46 +00:00
Sergey Matveev 6cb47a083b [sanitizer] Support sandboxing in sanitizer coverage.
Summary:
Sandboxed code may now pass additional arguments to
__sanitizer_sandbox_on_notify() to force all coverage data to be dumped to a
single file (the default is one file per module). The user may supply a file or
socket to write to. The latter option can be used to broker out the file writing
functionality. If -1  is passed, we pre-open a file.

llvm-svn: 209121
2014-05-19 12:53:03 +00:00
Sergey Matveev 73f64a8f9f [asan] Make the coverage tests clean up after themselves.
llvm-svn: 209119
2014-05-19 11:34:35 +00:00
Kostya Serebryany 6c039b3459 [asan] update asan_symbolize.py to use the new llvm-symbolizer flag syntax
llvm-svn: 209116
2014-05-19 08:30:51 +00:00
Timur Iskhodzhanov 930ffe94aa [Sanitizer tests] Don't need to use -lstdc++ thanks to --driver-mode=g++
Reviewed at http://reviews.llvm.org/D3796

llvm-svn: 209115
2014-05-19 08:19:38 +00:00
Saleem Abdulrasool 44a8c7233a profile: explicitly initialize file name in the test
The instrprofile-write-file-only test was failing on the builtbots.  The runtime
library initialization is explicitly being discarded to avoid the atexit hook.
However, this would also prevent the filename from being initialized.  Thus,
when the write file was invoked, the filename would not be setup, and the test
would fail as the profiling data would never be written out.  Explicitly
initialize the filename to ensure that the data is written out when requested.
This should hopefully finally get the build bots all green again.

llvm-svn: 209099
2014-05-18 20:05:35 +00:00
Saleem Abdulrasool b2aa4726d2 profile: adjust flags for libdl
dlopen expects that the flags contains RTLD_LAZY or RTLD_NOW.  RTLD_LAZY will
resolve the symbol on first use, and is generally preferred due to efficiency.
Add this to fix the test failure on the build bots.

llvm-svn: 209098
2014-05-18 19:33:39 +00:00
Saleem Abdulrasool 1d338a3406 profile: add logging on failure
Add logging to report any failures that may occur on calls to libdl.  Without
this, it is difficult to identify the actual problem if the test fails.

llvm-svn: 209097
2014-05-18 19:33:37 +00:00
Saleem Abdulrasool 864e0740c0 profile: explicitly link against libdl
Add an explicit link against libdl.  libdl may not be indirectly pulled on some
Linux hosts.  Explicitly link against it.  This should hopefully improve the
state of the build bots.

llvm-svn: 209096
2014-05-18 18:39:19 +00:00
Saleem Abdulrasool dd9b0344cd assembly: support symbol definitions for COFF
Extend the function definition macros further to support COFF object emission.
The function definition in COFF includes the type and storage class in the
symbol definition context.  This is needed to make the assembly routines
possible to be built for COFF environments (i.e. Windows).

llvm-svn: 209095
2014-05-18 18:39:15 +00:00
Saleem Abdulrasool 9a614bd488 assembly: rework HIDDEN_DIRECTIVE to accomodate COFF
Rename the HIDDEN_DIRECTIVE macro to HIDDEN and give it a parameter providing
the name of the symbol to be given hidden visibility.  This makes the macros
more amenable to COFF.

llvm-svn: 209094
2014-05-18 18:39:10 +00:00
Duncan P. N. Exon Smith 55e4d66f0c InstrProf: Support profiling dlopen'd shared libraries
Shared objects are hard.  After this commit, we do the right thing when
profiling two separate shared objects that have been dlopen'd with
`RTLD_LOCAL`, when the main executable is *not* being profiled.

This mainly simplifies the writer logic.

  - At initialization, determine the output filename and truncate the
    file.  Depending on whether shared objects can see each other, this
    may happen multiple times.

  - At exit, each executable writes its own profile in append mode.

<rdar://problem/16918688>

llvm-svn: 209053
2014-05-17 01:27:30 +00:00
Alexey Samsonov 41c7302888 [TSan] Improve support for running TSan test suite with GCC-TSan.
Test results with GCC-4.9.0: 78 expected passes, 74 unexpected failures.

llvm-svn: 209014
2014-05-16 20:33:56 +00:00
Alexey Samsonov 995bdd43f8 Exclude several ASan tests from test suite if we're using GCC
llvm-svn: 209013
2014-05-16 20:12:27 +00:00
Alexey Samsonov 36132035ca [CMake] Don't build libcxx_tsan with compilers other than Clang
llvm-svn: 209003
2014-05-16 18:22:04 +00:00
Timur Iskhodzhanov 37c00b4b19 [ASan/Win] Refactor __interception::OverrideFunction a bit, allow the orig_old_func parameter to be zero
Reviewed at http://reviews.llvm.org/D3798

llvm-svn: 208989
2014-05-16 14:04:57 +00:00
Saleem Abdulrasool da2c2ce6ce clang-format assembly.h
Reformat assembly.h with clang-format.  NFC.

llvm-svn: 208950
2014-05-16 06:16:21 +00:00
Duncan P. N. Exon Smith 870b77cd4d InstrProf: Create a PIC version of the profile runtime
These tests were XPASS-ing on Linux bots creating Mach-O, which makes
sense, since the real difference is the object format.

I'm hoping a short-term fix to get these tests passing on ELF is to
create two copies of the runtime -- one built with -fPIC, and one
without.  A follow-up patch will change clang's driver to pick between
them depending on whether `-shared` is specified.

llvm-svn: 208947
2014-05-16 04:07:09 +00:00
Duncan P. N. Exon Smith f6366cbeff InstrProf: XFAIL tests from r208940 on Linux
According to the buildbots, the new features for shared objects don't
work on ELF since it requires an -fPIC when building the profile
library.  XFAIL these tests for now.

It's possible we'll have to build two versions of the profile library on
Linux (one with -fPIC and one without), but it's not clear to me exactly
how to resolve this.

llvm-svn: 208946
2014-05-16 02:53:19 +00:00
Duncan P. N. Exon Smith 084398857a InstrProf: Fix shared object profiling
Change the API of the instrumented profiling library to work with shared
objects.

  - Most things are now declared hidden, so that each executable gets
    its own copy.

  - Initialization hooks up a linked list of writers.

  - The raw format with shared objects that are profiled consists of a
    concatenated series of profiles.  llvm-profdata knows how to deal
    with that since r208938.

<rdar://problem/16918688>

llvm-svn: 208940
2014-05-16 01:30:24 +00:00
Greg Fitzgerald f42b49787b cleanup and test litlint
llvm-svn: 208907
2014-05-15 18:52:11 +00:00
Chandler Carruth 332e1b1909 Exclude MSVC to try to unbreak their builds. We have a bad skew between
how CMake drives a windows link and how our custom command does.

llvm-svn: 208903
2014-05-15 16:33:58 +00:00
Timur Iskhodzhanov bd6cee7cc3 [ASan/Win tests] Add memcpy/strdup/strlen interception tests
llvm-svn: 208899
2014-05-15 16:02:56 +00:00
Chandler Carruth 57e0ec7d20 Teach the compiler-rt custom compilation and linking CMake rules used
for sanitizers to pass the C++ compilation and exe linking flags through
from the host CMake configuration. We pass the target flags afterward,
allowing them to trump flags as needed. This is particularly important
when the flags direct Clang, even the just-built-Clang, toward the
standard library, linker, and other tools to use.

llvm-svn: 208896
2014-05-15 15:21:11 +00:00
Timur Iskhodzhanov 5910d6d126 [ASan/Win tests] Add more DLL tests
llvm-svn: 208893
2014-05-15 15:13:06 +00:00
Timur Iskhodzhanov e23889692b [ASan/Win tests] Add more DLL tests: malloc & friends
llvm-svn: 208889
2014-05-15 14:42:41 +00:00
Timur Iskhodzhanov 3bd2c2fe90 [ASan/Win tests] Add the first DLL test
llvm-svn: 208884
2014-05-15 14:27:46 +00:00
Timur Iskhodzhanov 130b5651d1 [ASan/Win tests] Add tests for malloc/calloc/realloc
llvm-svn: 208881
2014-05-15 13:50:12 +00:00
Dmitry Vyukov 547089e2a5 tsan: allow to disable history collection
The mode is enabled with -DTSAN_NO_HISTORY=1 flag.
Intended mostly for research purposes (how fast can it go w/o history).

llvm-svn: 208878
2014-05-15 12:51:48 +00:00
Timur Iskhodzhanov a357badc58 [ASan/Win tests] Add tests for stack array manipulation, as well as a use-after-return test
llvm-svn: 208873
2014-05-15 12:09:45 +00:00
Timur Iskhodzhanov 2dbedf5e93 [ASan/Win tests] Add tests for operator new/new[]/delete/delete[]
llvm-svn: 208871
2014-05-15 11:55:40 +00:00
Timur Iskhodzhanov dd2d84a223 [ASan/Win tests] Add tests for downcast-related overflows, as well as CRT initiazliers
llvm-svn: 208865
2014-05-15 11:14:00 +00:00
Timur Iskhodzhanov f32b690f69 [ASan/Win tests] Add tests for aligned mallocs, bitfields and global strings
llvm-svn: 208859
2014-05-15 10:58:35 +00:00
Timur Iskhodzhanov 8bf36cae28 [ASan tests] Add ASan Windows threading tests
llvm-svn: 208854
2014-05-15 09:12:55 +00:00
Evgeniy Stepanov f532c5bfd5 [sanitizer] Remove the definition of xdr_ops.
User-visible instances of xdr_ops always seem to be allocated statically, and
don't need unpoisoning. Also, it's size differs between platforms.

llvm-svn: 208851
2014-05-15 07:18:34 +00:00
Alp Toker 1ee7fc7a1a Fix typos
llvm-svn: 208841
2014-05-15 02:22:34 +00:00
Greg Fitzgerald ceae1fbafd migrate litlint from argparse to optparse. reenabled
llvm-svn: 208826
2014-05-14 23:31:20 +00:00
Greg Fitzgerald 73bd03cee9 Disabled litlint. It requires Python 2.7 or later
llvm-svn: 208823
2014-05-14 23:20:30 +00:00
Greg Fitzgerald a310d98ff1 add script to ensure lit test contains %run
llvm-svn: 208819
2014-05-14 22:49:46 +00:00
Timur Iskhodzhanov 07109b4161 [ASan/Win tests] Add a PR reference for the FileCheck bug
llvm-svn: 208807
2014-05-14 19:47:58 +00:00
Timur Iskhodzhanov 78dccb0822 Remove an unneeded stderr redirection
llvm-svn: 208805
2014-05-14 19:34:13 +00:00
Timur Iskhodzhanov 3653790410 Remove --check-prefix=CHECK as it's useless
llvm-svn: 208803
2014-05-14 19:31:56 +00:00
Timur Iskhodzhanov 2bdca20069 [ASan tests] Add the first Windows-only lit test
Reviewed at http://reviews.llvm.org/D3767

llvm-svn: 208802
2014-05-14 19:10:43 +00:00
Timur Iskhodzhanov 9de6fe7b83 [ASan tests] Get rid of SharedLibs/
llvm-svn: 208780
2014-05-14 14:41:38 +00:00
Timur Iskhodzhanov b2e723e448 [ASan tests] Update relative paths from POSIX-only tests to their shared libraries
llvm-svn: 208778
2014-05-14 14:16:09 +00:00
Timur Iskhodzhanov 6a9121904d [ASan tests] Create a Posix/ directory for tests that we don't plan to run on Windows
llvm-svn: 208777
2014-05-14 14:12:02 +00:00
Kostya Serebryany b9e31d7fcd [asan] use some LIKELY/UNLIKELY
llvm-svn: 208776
2014-05-14 14:03:31 +00:00
Timur Iskhodzhanov 86e2470a5b [ASan/Win] Enable demangling of global variable names
llvm-svn: 208775
2014-05-14 13:55:59 +00:00
Evgeniy Stepanov 99d3791a88 [sanitizer] Fix crash in getgrnam_r and similar interceptors.
When no matching record is found, getgrnam_r return 0 but sets result to NULL.
Should fix PR19734.

llvm-svn: 208773
2014-05-14 12:32:40 +00:00
Alexander Potapenko 04e2f43756 [libsanitizer] Notify the runtime about file being closed before the actual call to fclose().
This shall fix spurious false positive race reports between fclose() and fopen64().

llvm-svn: 208772
2014-05-14 11:48:37 +00:00
Kostya Serebryany d5e1091c73 [asan] tyring to fix the Android build
llvm-svn: 208763
2014-05-14 09:21:22 +00:00
Kostya Serebryany 7534a60753 [asan] Respect personality in kernel area detector, patch by Yuri Gribov
llvm-svn: 208760
2014-05-14 08:13:11 +00:00
Evgeniy Stepanov adc3ff9f48 [sanitizer] Move open_memstream test under Linux.
llvm-svn: 208755
2014-05-14 07:27:18 +00:00
Greg Fitzgerald 5a1cf70ac3 removed redundant lit variable
Thanks Alexey!

llvm-svn: 208747
2014-05-14 01:04:17 +00:00
Greg Fitzgerald 320713ffbe Add target flags to ubsan tests
llvm-svn: 208746
2014-05-14 00:46:01 +00:00
Greg Fitzgerald 07c88a16e8 Enable CAN_EXECUTE_TESTS if an EMULATOR is provided
llvm-svn: 208745
2014-05-14 00:36:15 +00:00
Greg Fitzgerald 1402830dc5 Add %run to tests that used %T/name.exe
llvm-svn: 208744
2014-05-14 00:32:15 +00:00
Alexey Samsonov 5716928ae2 [TSan] Build TSan-instrumented version of libcxx and use it in lit tests.
TSan can produce false positives in code that uses C++11 threading,
as it doesn't see synchronization inside standard library. See
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035408.html
for an example of such case.

We may build custom TSan-instrumented version libcxx to fight with that.
This change adds build rules for libcxx_tsan and integrates it into
testing infrastructure.

llvm-svn: 208737
2014-05-13 22:30:16 +00:00
Alexander Potapenko 291b827890 [libsanitizer] Fix the return type of internal_fork
llvm-svn: 208714
2014-05-13 17:31:09 +00:00
Alexander Potapenko 4a6cac4382 [libsanitizer] Use internal_fork() to spawn the symbolizer process.
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61

llvm-svn: 208707
2014-05-13 16:17:54 +00:00
Timur Iskhodzhanov b9bd76b85d Enable sanitizer tests (check-sanitizer, check-asan) on Windows
llvm-svn: 208701
2014-05-13 14:25:49 +00:00
Timur Iskhodzhanov 5ce3937ed4 [Sanitizer tests] Define 16- and 64-bit versions of atomic_compare_exchange_strong on Windows
Reviewed at http://reviews.llvm.org/D3745

llvm-svn: 208700
2014-05-13 14:23:25 +00:00
Timur Iskhodzhanov 5812350591 [Sanitizer tests] Exclude three tests that fail on Windows
llvm-svn: 208698
2014-05-13 13:34:00 +00:00
Timur Iskhodzhanov e33158bcd1 [Sanitizer tests] Land the sanitizer twin of the asan-only change r208682
llvm-svn: 208697
2014-05-13 13:29:11 +00:00
Timur Iskhodzhanov 339e8c98f8 [Sanitizer tests] Add sanitizer_test_config.h to make the inclusion of gtest.h conditional
Reviewed at http://reviews.llvm.org/D3744

llvm-svn: 208696
2014-05-13 13:25:12 +00:00
Timur Iskhodzhanov 2e9136c2da [Sanitizer/ASan tests] Automatically detect the presence of libstdc++
llvm-svn: 208695
2014-05-13 12:57:50 +00:00
Evgeniy Stepanov 68d7f43e38 [sanitizer] Disable fopen64 interceptor on osx.
llvm-svn: 208693
2014-05-13 12:05:38 +00:00
Timur Iskhodzhanov e5e92fac4a [Sanitizer tests] Fix most of the build problems on Windows
E.g. use the pthread helpers introduced in r208674

llvm-svn: 208692
2014-05-13 12:02:53 +00:00
Evgeniy Stepanov 7bd7063db0 [sanitizer] Mark several functions as possibly unused.
llvm-svn: 208686
2014-05-13 11:18:22 +00:00
Timur Iskhodzhanov 7d07fe20a0 [ASan tests] Add Windows-specific flags to lib/asan/tests/CMakeLists.txt
Reviewed at http://reviews.llvm.org/D3720

llvm-svn: 208682
2014-05-13 10:33:42 +00:00
Evgeniy Stepanov 4d16c1df0c [sanitizer] Delete an unused function.
llvm-svn: 208678
2014-05-13 09:03:45 +00:00
Evgeniy Stepanov 6b21d560c9 [sanitizer] Fix windows build.
llvm-svn: 208677
2014-05-13 08:47:40 +00:00
Evgeniy Stepanov 5680a26b0b [msan] Better open_memstream support.
Move fflush and fclose interceptors to sanitizer_common.
Use a metadata map to keep information about the external locations
that must be updated when the file is written to.

llvm-svn: 208676
2014-05-13 08:36:31 +00:00
Timur Iskhodzhanov 711269966c [Sanitizer tests] Make simple pthread tests compile and pass on Windows
Reviewed at http://reviews.llvm.org/D3725

llvm-svn: 208674
2014-05-13 08:07:09 +00:00
Kostya Serebryany 0d00675df2 [sanitizer] fix for ARM Linux, patch by Maxim Ostapenko
llvm-svn: 208673
2014-05-13 08:01:59 +00:00
Kostya Serebryany b7a7e55dc5 [sanitizer] define __sanitizer_time_t
llvm-svn: 208671
2014-05-13 07:49:39 +00:00
Alexey Samsonov 79b8fb5d2c Mark ptrace test as Linux-specific
llvm-svn: 208643
2014-05-13 00:02:18 +00:00
Alexey Samsonov b51d6081f3 Restrict the set of sanitizers that should run tests from test/sanitizer_common
llvm-svn: 208639
2014-05-12 22:48:29 +00:00
Alexey Samsonov 5af5f8f0b5 [CMake] Log output of configure/build/install steps for instrumented libcxx to reduce noise
llvm-svn: 208632
2014-05-12 21:07:28 +00:00
Alexey Samsonov 53363b53db [CMake] Fix standalone build after r208526
llvm-svn: 208629
2014-05-12 20:48:29 +00:00
Greg Fitzgerald fb1d83a978 Add %run to new lit test
llvm-svn: 208624
2014-05-12 20:17:14 +00:00
Alexey Samsonov 1866b58885 [ASan] Split static ASan runtime in two parts: asan and asan_cxx.
asan_cxx containts replacements for new/delete operators, and should
only be linked in C++ mode. We plan to start building this part
with exception support to make new more standard-compliant.

See https://code.google.com/p/address-sanitizer/issues/detail?id=295
for more details.

llvm-svn: 208609
2014-05-12 18:39:22 +00:00
Jonathan Roelofs b351c1aba2 Move .subsections_via_symbols directives into DEFINE_COMPILERRT_PRIVATE_FUNCTION
llvm-svn: 208603
2014-05-12 17:38:36 +00:00
Timur Iskhodzhanov 1ac44dd087 [Sanitizer tests] Fix a comment that got out of sync with the #if
llvm-svn: 208602
2014-05-12 17:33:00 +00:00
Saleem Abdulrasool a374f43ec8 builtins: add missing file
Add (missing) definition of COMPILER_RT_EXPORT which is meant to be used for
decorating functions that are meant to be exported.  This is useful for
platforms where exports and imports must be decorated explicitly (i.e. Windows).

llvm-svn: 208593
2014-05-12 16:47:01 +00:00
Saleem Abdulrasool c17450236e __clear_cache: decorate with COMPILER_RT_EXPORT
Use COMPILER_RT_EXPORT rather than COMPILER_RT_ABI for this function.  Adding an
explicit PCS standard to the function causes a mismatch between the
declarations.  Furthermore, the function is implemented in C, and should take
the CC based on the target triple.

llvm-svn: 208591
2014-05-12 16:28:11 +00:00
Saleem Abdulrasool 2e3ad036a2 CompilerRT: .align was supposed to be power-of-aligned in this case
Use .balign instead of .p2align 3.  This should fix the buildbots.

llvm-svn: 208585
2014-05-12 16:06:11 +00:00
Saleem Abdulrasool 310874ae3c [CompilerRT] use .p2align, .balign instead of .align
The .align statements in ARM assembly routines is actually meant to be a power
of 2 alignment (e.g. .align 2 == 4 byte alignment, not 2).  Switch to using
.p2align.  .p2align is guaranteed to be a power-of-two alignment always and much
more explicit.

The .align in the case of x86_64 is byte alignment, use .balign instead of
.align.

llvm-svn: 208578
2014-05-12 15:23:37 +00:00
Timur Iskhodzhanov a9e9e9d640 [ASan tests] Don't define __asan_default_options in tests on Windows as it is not supported
llvm-svn: 208575
2014-05-12 15:12:44 +00:00
Timur Iskhodzhanov 90278c626f [ASan] Add references to the issue tracker about malloc/free/new/delete mismatch check on Mac and Windows
llvm-svn: 208574
2014-05-12 15:06:59 +00:00
Timur Iskhodzhanov d5d5f6a8b9 [ASan tests] Exclude/simplify a bunch of tests to make them build on Windows
(This also requires D3720, D3725 and a few more small changes to land)

llvm-svn: 208573
2014-05-12 15:04:25 +00:00
Timur Iskhodzhanov 9bd988b33b [ASan tests] Don't run FakeStack.CreateDestroy on Windows as it OOMs
llvm-svn: 208572
2014-05-12 14:49:17 +00:00
Timur Iskhodzhanov 36fc9b18b7 [ASan tests] Also define USED/UNUSED in lib/sanitizer_common/sanitizer_internal_defs.h if Clang is used on Windows
Otherwise we end up with macro redefinition warnings

llvm-svn: 208571
2014-05-12 14:44:29 +00:00
Timur Iskhodzhanov 9a205ed8ee [ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings
llvm-svn: 208568
2014-05-12 14:31:57 +00:00
Sergey Matveev f37bd92c3a [asan] Move the "coverage" flag to common flags.
The implementation lives in sanitizer_common and will need to access that flag.

llvm-svn: 208566
2014-05-12 14:27:36 +00:00
Hal Finkel 10c6c06656 Define CRT_HAS_128BIT even for PPC32
r201909, which introduced CRT_HAS_128BIT, unintentionally broke self-hosting on
PPC32. We used to define CRT_HAS_128BIT only on LP64 systems, but this is not
quite right (at least for Clang-compiled code). Even though __int128 is not
supported on PPC32, SROA can (and does) still form i128 variables at the IR
level, and operations on those variables may turn into the associated runtime
calls. As a result, we still need to compile __ashlti3, __ashrti3, __lshrti3,
and perhaps others, on PPC32.

llvm-svn: 208560
2014-05-12 13:43:29 +00:00
Kostya Serebryany 118d469660 [asan] one more attempt to enable lsan by default (PR19521)
llvm-svn: 208545
2014-05-12 12:49:48 +00:00
Viktor Kutuzov 626edb6f49 Add FreeBSD support to address sanitizer process mapping facilities
llvm-svn: 208537
2014-05-12 11:03:46 +00:00
Kostya Serebryany e61f4d5155 [tsan] force tls_model='initial-exec' for tsan's cur_thread_placeholder so that we don't depend on the compiler flags
llvm-svn: 208536
2014-05-12 10:40:33 +00:00
Sergey Matveev aeb18fc787 [asan] Further fix the test from r208333.
Remove a debug print and some copypasta.

llvm-svn: 208535
2014-05-12 10:33:31 +00:00
Kostya Serebryany 9c81b31568 [asan] define ASAN_DYNAMIC=1 if PIC is defined
llvm-svn: 208530
2014-05-12 09:45:39 +00:00
Timur Iskhodzhanov b0279d7f7d [ASan tests] Use clang-cl to build tests on Windows
Reviewed at http://reviews.llvm.org/D3680

llvm-svn: 208526
2014-05-12 08:55:20 +00:00
Kostya Serebryany d7992fc921 [asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
llvm-svn: 208525
2014-05-12 08:01:51 +00:00
Duncan P. N. Exon Smith 59ad79601b InstrProf: Remove redundant declaration
llvm-svn: 208464
2014-05-10 00:22:58 +00:00
Duncan P. N. Exon Smith b6bd2f6cf7 InstrProf: Pacify buildbots after r208460
llvm-svn: 208462
2014-05-09 23:47:49 +00:00
Duncan P. N. Exon Smith 238137294f InstrProf: Test the functions in the runtime
Check that the profile runtime works as expected.  This tests the
functions that are meant to be available to advanced users.

In particular, check that the `atexit()` hook can be disabled by
defining a custom `__llvm_profile_runtime` variable, that the libc
dependencies are optional, and that the various functions for writing
out files work for basic cases.

llvm-svn: 208460
2014-05-09 23:14:58 +00:00
Alexey Samsonov eacb4d8417 [CMake] Use ExternalProject to build MSan-ified version of libcxx for unit tests.
This change lets MSan rely on libcxx's own build system instead of manually
compiling its sources and setting up all the necessary compile flags. It would
also simplify compiling libcxx with another sanitizers (in particular, TSan).

The tricky part is to make sure libcxx is reconfigured/rebuilt when Clang or
MSan runtime library is changed. "clobber" step used in this patch works well
for me, but it's possible it would break for other configurations - will
watch the buildbots.

llvm-svn: 208451
2014-05-09 22:11:03 +00:00
Alexey Samsonov 0bef819f9f [Sanitizer] Add the machinery to run the same test under several sanitizers
llvm-svn: 208378
2014-05-09 00:28:18 +00:00
Alexey Samsonov 6dd8dfb1c4 [Sanitizer] Move lit config for sanitizer_common unit tests under Unit/ dir for consistency.
llvm-svn: 208373
2014-05-08 23:53:02 +00:00
Alexey Samsonov 35744c4753 Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET.
llvm-svn: 208363
2014-05-08 22:11:20 +00:00
Alexey Samsonov 0b9b36623a Fixup test added in r208333
llvm-svn: 208356
2014-05-08 20:21:11 +00:00
Sergey Matveev 76e02e90c5 [ASan] Fix coverage behavior when a PC belongs to an unknown address range.
This happens, e.g., when coverage data is collected for a module which is then
dlclose()'d. Currently this causes CovDump() to ignore all PCs that are greater
than the unrecognized PC. In other words, unloading a module causes ASan to
silently ignore any coverage data for modules loaded at higher addresses.
Instead we should just skip the unrecognized PCs.

llvm-svn: 208333
2014-05-08 16:09:54 +00:00
Timur Iskhodzhanov e153347cc5 [ASan tests] Fix non-Windows breakage
llvm-svn: 208332
2014-05-08 15:59:35 +00:00
Timur Iskhodzhanov 21a22d34be [ASan tests] More progress towards Windows support
llvm-svn: 208326
2014-05-08 15:13:26 +00:00
Timur Iskhodzhanov 48253ed689 [ASan tests] More progress towards Windows support
llvm-svn: 208325
2014-05-08 15:05:42 +00:00
Timur Iskhodzhanov 498052b8eb [ASan tests] More progress towards Windows support
llvm-svn: 208323
2014-05-08 15:01:29 +00:00
Timur Iskhodzhanov fddadefc33 [ASan tests] Auto-define ASAN_NEEDS_SEGV rather than hardcode it in cmake
llvm-svn: 208322
2014-05-08 14:53:59 +00:00
Timur Iskhodzhanov 76f43eecb0 [ASan] Update sanitizer_common and asan test_util headers to support building on Windows
llvm-svn: 208306
2014-05-08 12:43:33 +00:00
Evgeniy Stepanov c5e51926dc [msan] Intercept strxfrm.
llvm-svn: 208303
2014-05-08 12:04:01 +00:00
Evgeniy Stepanov ac030ffb69 [msan] Switch to common printf interceptors.
Format string parsing is disabled by default.
This is not expected to meaningfully change the tool behavior.
With this change, check_printf flag could be used to evaluate printf format
string parsing in MSan.

llvm-svn: 208295
2014-05-08 09:50:59 +00:00
Evgeniy Stepanov 9c20cb1a7c [msan] Fix potential infinite recursion in a test.
If printf is intercepted (it is not atm), REAL(printf) call in the interceptor
would get redirected back to my_lgamma, resulting in infinite recursion.

llvm-svn: 208294
2014-05-08 09:37:36 +00:00
Evgeniy Stepanov 5ee9fd5f45 [asan] Update tests for r208290.
sprintf output buffer is now always sanitized.

llvm-svn: 208291
2014-05-08 09:24:53 +00:00
Evgeniy Stepanov d31ac26230 [sanitizer] Unconditionally write to target buffer in *sprintf interceptors.
This does not change the default behavior (check_printf in on by default in all tools).
With this change, check_printf flag only affects format string parsing.

llvm-svn: 208290
2014-05-08 09:18:22 +00:00
Alexey Samsonov 9c1a57b64f [DFSan] Update build rules for Makefile build
llvm-svn: 208268
2014-05-07 23:48:59 +00:00
Alexey Samsonov 2fccdfbe70 [MSan] Fixup for r206983: MsanThread may be unavailable in signal handler: signals may be raised while thread is being destroyed
llvm-svn: 208250
2014-05-07 21:23:12 +00:00
Greg Fitzgerald dda7f8cfd0 [asan] fix i386 tests broken from r207707
llvm-svn: 208240
2014-05-07 19:22:16 +00:00
Timur Iskhodzhanov 6d58e0726d Ignore stack-buffer-overflow in std::_Find_elem<*> / std::num_get<...>::_Getifld
Reviewed at http://reviews.llvm.org/D3650

llvm-svn: 208215
2014-05-07 14:40:23 +00:00
Evgeniy Stepanov 7d46040ff2 [sanitizer] Replace a macro with a function.
llvm-svn: 208207
2014-05-07 13:24:28 +00:00
Evgeniy Stepanov 55590227f8 [sanitizer] Intercept obstack.
llvm-svn: 208196
2014-05-07 11:50:56 +00:00
Evgeniy Stepanov 8dd62dc3be [msan] Fix __msan_check_mem_is_initialized and prettify its output.
llvm-svn: 208195
2014-05-07 11:50:14 +00:00
Evgeniy Stepanov c087df0655 [asan] Include asm instrumentation source in Makefile build.
llvm-svn: 208172
2014-05-07 08:55:46 +00:00
Kostya Serebryany 7a733480c8 [asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Evgeniy Stepanov aa44aaee90 [sanitizer] Print addresses in hexadecimal.
llvm-svn: 208089
2014-05-06 14:01:13 +00:00
Timur Iskhodzhanov 7d5c81db0a [ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1
Reviewed at http://reviews.llvm.org/D3610

llvm-svn: 208070
2014-05-06 08:21:50 +00:00
Evgeniy Stepanov 06475bf752 [msan] Fix print_shadow test.
llvm-svn: 208069
2014-05-06 08:15:50 +00:00
Kostya Serebryany 98e55ef41a [sanitizer] fix build with glibc 2.4, patch by Sandra Loosemore
llvm-svn: 208066
2014-05-06 07:36:51 +00:00
Timur Iskhodzhanov 7721eb3f9d [ASan/Win] Add DLL thunks for the fake stack interface
llvm-svn: 207960
2014-05-05 12:26:04 +00:00
Dmitry Vyukov 3089608172 tsan: disable debug output in normal mode
llvm-svn: 207954
2014-05-05 07:45:54 +00:00
Reid Kleckner af6b2504f8 profile: Fix the build with gcc 4.9
GCC -pedantic warns that the initialization of Header is not constant:
InstrProfilingFile.c:31:5: error: initializer element is not computable at load time [-Werror]

LLVM defaults to enabling -pedantic.  If this warning is unhelpful, we
can consider revisiting that decision.

llvm-svn: 207784
2014-05-01 18:52:14 +00:00
Kostya Serebryany 12963b54a8 [asan] disable GetKernelStartAddress as it misbehaves in schroot
llvm-svn: 207768
2014-05-01 16:20:23 +00:00
Chandler Carruth c42ddde78a The newest versions of CMake require outputs of custom commands be in
DEPENDS rather than SOURCES. The SOURCES just end up looking on the
filesystem and not finding anything. Makes for very hard to debug build
errors. =/

llvm-svn: 207722
2014-04-30 23:31:45 +00:00
Greg Fitzgerald b8aae5405b Add %run to all lit tests
llvm-svn: 207709
2014-04-30 21:34:17 +00:00
Greg Fitzgerald 6759fd9fdd Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR:

  $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT"

llvm-svn: 207707
2014-04-30 21:32:30 +00:00
Kostya Serebryany 8b530e10a1 [asan] make AsanCoverage lock-free (and AS-safe)
llvm-svn: 207630
2014-04-30 10:40:48 +00:00
Evgeniy Stepanov fe250b0014 [msan] Prettify __msan_print_shadow.
Makes __msan_print_shadow output much more readable, adds origin info.

llvm-svn: 207622
2014-04-30 09:50:30 +00:00
Alexey Samsonov d94e87db3f [Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interceptors
llvm-svn: 207443
2014-04-28 20:40:25 +00:00
Kostya Serebryany cacbac7ba9 [asan] fix a test
llvm-svn: 207417
2014-04-28 13:18:59 +00:00
Kostya Serebryany 4f9c31a2fa [asan] split detect_odr_violation into two: =2 detects all ODR violations, =1 detects only those where the variable sizes are different. BTW, the detector seems to be working well and finding nice bugs. Early adopters are welcome.
llvm-svn: 207415
2014-04-28 12:47:58 +00:00
Viktor Kutuzov f9eba2f51d Fix building Asan and common sanitizers tests on FreeBSD 9.2
llvm-svn: 207408
2014-04-28 10:33:01 +00:00
Evgeniy Stepanov c435fb07dd [sanitizer] Limit fopen interceptor to linux.
llvm-svn: 207227
2014-04-25 13:55:29 +00:00
Evgeniy Stepanov f3d5d119a8 [sanitizer] Intercept a bunch of stdio calls.
Add move fopen/freopen interceptors from TSan to common.

llvm-svn: 207224
2014-04-25 13:26:21 +00:00
Alexander Potapenko 623c989eea [ASan] Use a non-null altstack.ss_size when disabling sigaltstack on Darwin.
llvm-svn: 207220
2014-04-25 10:39:41 +00:00
Dmitry Vyukov edae43b0a9 tsan: allow to suppress all reports
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=45

llvm-svn: 207218
2014-04-25 10:09:18 +00:00
Dmitry Vyukov 0d0107d2ef tsan: better reports for "unlock of an unlocked mutex"
llvm-svn: 207211
2014-04-25 09:01:17 +00:00
Kostya Serebryany e91930a7e6 [asan] implement an experimental detector of ODR violations. Not tested yet outside of a tiny test, may need tuning.
llvm-svn: 207210
2014-04-25 08:58:28 +00:00
Dmitry Vyukov 56a18f02ea tsan: better reports for "read lock of a write locked mutex"
llvm-svn: 207209
2014-04-25 08:58:23 +00:00
Dmitry Vyukov e296164f77 tsan: improve "read unlock of a write locked mutex" report
llvm-svn: 207208
2014-04-25 08:21:30 +00:00
Dmitry Vyukov 66dbbbc47b tsan: fix tests
failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/3747/steps/test/logs/stdio

llvm-svn: 207207
2014-04-25 08:13:45 +00:00
Dmitry Vyukov 2c87108a42 tsan: better report for bad mutex unlocks
+ fixes crashes due to races on symbolizer, see
https://code.google.com/p/thread-sanitizer/issues/detail?id=55

llvm-svn: 207206
2014-04-25 07:55:11 +00:00
Dmitry Vyukov ea014b787a tsan: add new test for commit 207204 (forget to add new file)
llvm-svn: 207205
2014-04-25 07:49:36 +00:00
Dmitry Vyukov c845decce1 tsan: better reports for "double lock of a mutex"
+ fixes crashes due to races on symbolizer, see:
https://code.google.com/p/thread-sanitizer/issues/detail?id=55

llvm-svn: 207204
2014-04-25 07:42:55 +00:00
Justin Bogner b83dd55eb6 [sanitizer] wordexp isn't available on iOS
llvm-svn: 207140
2014-04-24 20:10:31 +00:00
Peter Collingbourne 16f2f18105 Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.

Patch by Sam Kerner!

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

llvm-svn: 207131
2014-04-24 17:42:16 +00:00
Dmitry Vyukov b7ebc53772 tsan: stop background thread when sandbox is enabled
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=56

llvm-svn: 207114
2014-04-24 13:09:17 +00:00
Timur Iskhodzhanov 34ad1a1085 Add DLL thunks for recently-added memcpy, memset and memmove ASan intrinsics
llvm-svn: 207113
2014-04-24 12:58:26 +00:00
Kostya Serebryany 7afc6b2c72 [asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Alexander Potapenko a51e483846 [ASan] Move the shadow range on 32-bit iOS (and iOS Simulator)
to 0x40000000-0x60000000 to avoid address space clash with system libraries.
The solution has been proposed by tahabekireren@gmail.com in https://code.google.com/p/address-sanitizer/issues/detail?id=210
This is also known to fix some Chromium iOS tests.

llvm-svn: 207002
2014-04-23 17:14:45 +00:00
Evgeniy Stepanov 5a7c364343 [msan] Disable chained origins in signal handlers.
StackDepot is not async-signal-safe; storing a new origin to it can deadlock.

llvm-svn: 206983
2014-04-23 14:01:57 +00:00
Dmitry Vyukov ac81ee5533 tsan: fix atexit handling after fork
fixes issue http://code.google.com/p/thread-sanitizer/issues/detail?id=57

llvm-svn: 206980
2014-04-23 13:42:16 +00:00
Kostya Serebryany 8cd3d27879 [asan] disable lsan back. :( -- It appears that quite a few lit tests have leaks and they were not covered by out buildbot
llvm-svn: 206955
2014-04-23 08:15:16 +00:00
Dmitry Vyukov b1edac069e tsan: more precise check for "app memory" in COMPAT mode
this fires when a user makes mmap with fixed address (see the test)

llvm-svn: 206952
2014-04-23 07:01:02 +00:00
Dmitry Vyukov ae5c1070ba tsan: reduce number of iterations in the test
otherwise it runs for 50 seconds in debug mode

llvm-svn: 206950
2014-04-23 06:49:09 +00:00
Alexey Samsonov 01be4280be [profile] Flatten profile runtime - define platform-specific code in sources, not in the build system
llvm-svn: 206915
2014-04-22 18:49:32 +00:00
Kostya Serebryany c9db838267 [asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Alexander Potapenko 6e647c13e4 [ASan] Fixed the expectation for Darwin memset test.
Added a comment about keeping the Linux/Darwin test versions in sync.

llvm-svn: 206881
2014-04-22 10:53:57 +00:00
Kostya Serebryany 26c4e96455 [sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Evgeniy Stepanov a7f9071f25 [sanitizer] Intercept tsearch.
llvm-svn: 206755
2014-04-21 14:21:51 +00:00
Dmitry Vyukov 5e52f3a142 tsan: deflake test
ocasionally it fails with a slightly different report:

WARNING: ThreadSanitizer: signal handler spoils errno (pid=3674)
    #0 MyHandler(int, siginfo*, void*)
    ...
    #4 __tsan_free_hook
    #5 main signal_errno.cc:40
llvm-svn: 206754
2014-04-21 14:21:24 +00:00
Kostya Serebryany 38bb53b2c5 [asan] add a run-time flag detect_container_overflow=true/false
llvm-svn: 206753
2014-04-21 14:18:45 +00:00
Kostya Serebryany 632751539e [asan] add __asan_memset and friends
llvm-svn: 206748
2014-04-21 11:58:25 +00:00
Kostya Serebryany 74f8d65ae4 [asan] add one more mode to run asan tests with '-with-calls', i.e. using -mllvm -asan-instrumentation-with-call-threshold=0. This is very unfortunate since it effectively doubles the number of gunit asan tests that need to be built and run, but as long as we need out-lined calls (PR17409) I see no other way to test this workaround
llvm-svn: 206742
2014-04-21 10:31:35 +00:00
Kostya Serebryany 3d2629c514 [asan] implement __asan_loadN/__asan_storeN for out-lined asan checks
llvm-svn: 206733
2014-04-21 07:09:01 +00:00
Evgeniy Stepanov 561c4db707 [asan] Reenable tests that should pass since PR19207 is fixed.
llvm-svn: 206593
2014-04-18 13:24:03 +00:00
Evgeniy Stepanov 474011d55d [msan] Add missing quotes.
llvm-svn: 206589
2014-04-18 13:03:54 +00:00
Evgeniy Stepanov 191ebd874f [msan] Run msan_test in the new with-calls mode.
llvm-svn: 206587
2014-04-18 12:19:28 +00:00
Evgeniy Stepanov 83477cb93b [msan] Missing declarations for the new interface functions.
llvm-svn: 206586
2014-04-18 12:18:00 +00:00
Evgeniy Stepanov 8f41674719 [msan] Add new MSan callbacks for instrumentation-with-calls mode.
llvm-svn: 206584
2014-04-18 12:15:24 +00:00
Dmitry Vyukov 10d4b14a16 tsan: add benchmark that allows to investigate shadow memory consumption
llvm-svn: 206578
2014-04-18 10:37:39 +00:00
Alexander Potapenko da1c510ea6 [ASan] Change AddressSanitizer.LoadStoreCallbacks to use asan_malloc and asan_free.
Interceptors don't really work on OSX in asan_noinst_test.cc (this is more or less intentional),
so one shouldn't call intercepted functions in this test -- added a comment about this.

llvm-svn: 206477
2014-04-17 17:29:07 +00:00
Kostya Serebryany 664b1e2f9b [asan] fix a bug in outlined asan checks and in the corresponding test (ouch)
llvm-svn: 206470
2014-04-17 14:38:25 +00:00
Alexey Samsonov aefbec9dfd Move pthread_cond_* interceptors from sanitizer_common with all the ugly hacks to TSan
llvm-svn: 206423
2014-04-16 23:06:46 +00:00
Kostya Serebryany ae401ca5e7 [asan] add __asan_load1/__asan_store1/... callbacks to asan-rt; together with -mllvm -asan-instrumentation-with-call-threshold=N this will be a workaround for PR17409
llvm-svn: 206387
2014-04-16 13:52:28 +00:00
Kostya Serebryany 498b18a01e [asan] try to harden __tls_get_addr interceptor against signals (no good test still); update the comment in a test.
llvm-svn: 206367
2014-04-16 09:07:27 +00:00
Kostya Serebryany d4b1b2068e [asan] fix the alloctor code to not use opaque data structure, which was larger than needed. This was a leftover of the allocator1=>allocator2 migration; thanks Yuri Gribov for reminding
llvm-svn: 206280
2014-04-15 13:30:32 +00:00
Alexander Potapenko 65a6c57013 [ASan] Replace a CHECK for mmap_limit_mb with a RAW_CHECK.
In the case of a CHECK failure the program tries to fork and launch llvm-symbolizer,
but hangs in mz_force_lock because one of the allocator locks is already acquired.

llvm-svn: 206274
2014-04-15 11:36:18 +00:00
Kostya Serebryany b1232474b2 [asan] try fixing the mmap_limit_mb failure on buildbot (tests pass locally)
llvm-svn: 206262
2014-04-15 08:35:43 +00:00
Hans Wennborg 8f80ccc635 sanitizer_atomic_msvc.h: add atomic_fetch_{add,sub} overloads for uintptr_t
This should hopefully unbreak the MSVC build after r206178.

llvm-svn: 206200
2014-04-14 17:43:49 +00:00
Hans Wennborg ec77f619bb sanitizer_deadlock_detector.h: MSVC 2012 doesn't like compound literals
llvm-svn: 206199
2014-04-14 17:43:45 +00:00
Evgeniy Stepanov 81d80f7578 [asan] Fix mmap_limit_mb test to not use C++11.
llvm-svn: 206182
2014-04-14 15:37:02 +00:00
Evgeniy Stepanov 681016b2ea [asan] Do not use lambda in sanitizer lit tests.
We may be building with a very old C++ library.

llvm-svn: 206180
2014-04-14 15:19:07 +00:00
Evgeniy Stepanov 9ce9a6cdf6 [msan] Intercept wcsftime().
llvm-svn: 206179
2014-04-14 14:59:42 +00:00
Kostya Serebryany bcfbea6d4e [asan] added internal flag mmap_limit_mb
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany 90527cb324 [asan] don't use bool in public interface, make sure the interface headers are usable in plain C
llvm-svn: 206160
2014-04-14 11:16:53 +00:00
Kostya Serebryany f694ab1f18 [asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Dmitry Vyukov 51f5b5fd73 tsan: serialize report printing in standalone deadlock detector
otherwise reports get intermixed

llvm-svn: 206043
2014-04-11 17:54:27 +00:00
Dmitry Vyukov b5eb8f0212 tsan: fix vector clocks
the new optimizations break when thread ids gets reused (clocks go backwards)
add the necessary tests as well

llvm-svn: 206035
2014-04-11 15:38:03 +00:00
Dmitry Vyukov fa1d56c31f tsan: ignore interceptors from symbolizer
ocassionally we see races coming from symbolizer interceptors (e.g. memcmp)
reproducible only only on large complex programs

llvm-svn: 206034
2014-04-11 15:36:54 +00:00
Evgeniy Stepanov 77d8793fa6 [tsan] Fix output tests.
llvm-svn: 206031
2014-04-11 13:01:20 +00:00
Evgeniy Stepanov 652cbd7c15 [tsan] Fix false positive on xdr*_create.
llvm-svn: 206030
2014-04-11 12:29:24 +00:00
Evgeniy Stepanov d326c81117 [msan] mprotect() more memory to detect user code outside of application range.
llvm-svn: 206028
2014-04-11 12:04:29 +00:00
Viktor Kutuzov 7004b8c07c Enable building of sanitizers on FreeBSD
llvm-svn: 205919
2014-04-09 18:45:12 +00:00
Viktor Kutuzov 82185a2088 Declare _DYNAMIC and dl_phdr_info in asan_linux.cc on FreeBSD
llvm-svn: 205852
2014-04-09 13:37:19 +00:00
Manuel Klimek 0ee8505800 Update arc config to new domain.
llvm-svn: 205702
2014-04-07 10:22:41 +00:00
Evgeniy Stepanov 24c8d92fec [sanitizer] Intercept a subset of sunrpc interface (xdr_*).
llvm-svn: 205627
2014-04-04 14:51:23 +00:00
Alexey Samsonov 7dc3c0fb2b [ASan] Explicitly specify -ldl/-lpthread in RUN-lines where needed
llvm-svn: 205623
2014-04-04 12:24:46 +00:00
Dmitry Vyukov 1d66c4d5b7 tsan: improve error message in test
we've seen a flake on this test
next time it happens we will be able to gather some info

llvm-svn: 205619
2014-04-04 09:52:41 +00:00
Evgeniy Stepanov f653cda269 [msan] Introduce MsanThread. Move thread-local allocator cache out of TLS.
This reduces .tbss from 109K down to almost nothing.

llvm-svn: 205618
2014-04-04 09:47:41 +00:00
Kostya Serebryany 9f20c9b17c [asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Evgeniy Stepanov 6d8f71f928 Revert r205613.
llvm-svn: 205614
2014-04-04 08:58:16 +00:00
Evgeniy Stepanov fe82d5f849 [msan] Fix compilation of a disabled test.
llvm-svn: 205613
2014-04-04 08:39:50 +00:00
Alexey Samsonov 425314a65f [TSan] Fix a rare deadlock on multithreaded fork.
If a multi-threaded program calls fork(), TSan ignores all memory accesses
in the child to prevent deadlocks in TSan runtime. This is OK, as child is
probably going to call exec() as soon as possible. However, a rare deadlocks
could be caused by ThreadIgnoreBegin() function itself.

ThreadIgnoreBegin() remembers the current stack trace and puts it into the
StackDepot to report a warning later if a thread exited with ignores enabled.
Using StackDepotPut in a child process is dangerous: it locks a mutex on
a slow path, which could be already locked in a parent process.

The fix is simple: just don't put current stack traces to StackDepot in
ThreadIgnoreBegin() and ThreadIgnoreSyncBegin() functions if we're
running after a multithreaded fork. We will not report any
"thread exited with ignores enabled" errors in this case anyway.

Submitting this without a testcase, as I believe the standalone reproducer
is pretty hard to construct.

llvm-svn: 205534
2014-04-03 12:51:26 +00:00
Alexey Samsonov b4525218d4 [TSan] Fix a typo ThreadIgnoreSyncEnd. Found by inspection
llvm-svn: 205531
2014-04-03 12:28:16 +00:00
Alexey Samsonov 11ff0a26a4 [ASan] Fix incompatible runtimes check: don't iterate /proc/self/maps on every call to __asan_init
llvm-svn: 205418
2014-04-02 13:09:22 +00:00