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