Commit Graph

5452 Commits

Author SHA1 Message Date
Sergey Matveev 4a792988b3 [asan] Allow users of asan_symbolize.py to forbid fallback to atos/addr2line.
llvm-svn: 231492
2015-03-06 17:05:28 +00:00
Kuba Brecka 9930aaa9ed Symbolizer refactoring: Make WinSymbolizer use SymbolizerTool interface
Reviewed at http://reviews.llvm.org/D8089

llvm-svn: 231478
2015-03-06 14:33:56 +00:00
Dmitry Vyukov 0fc13a9a82 asan: fix comment formatting
As per comments in http://reviews.llvm.org/D8032

llvm-svn: 231457
2015-03-06 08:43:44 +00:00
Kuba Brecka da0204d05f Add a symbolizer testcase for closed stdin/stdout
Reviewed at http://reviews.llvm.org/D7973

llvm-svn: 231429
2015-03-05 23:41:47 +00:00
Kuba Brecka 334f9c4ed8 Print out which symbolizer are we using when verbosity >= 2
Reviewed at http://reviews.llvm.org/D8087

llvm-svn: 231428
2015-03-05 23:38:23 +00:00
Kostya Serebryany 769ddaa2d4 [sanitizer] Reconstruct the function that dumps block/edge coverage, hopefully making it more robust. Also increase the allowed coverage size on 32-bit.
llvm-svn: 231413
2015-03-05 22:19:25 +00:00
Alexey Samsonov 4833452c0c Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent."
The test case fails on AArch64.

llvm-svn: 231410
2015-03-05 21:57:47 +00:00
Joerg Sonnenberger 8a1f0446c0 Move use of __builtin_longjmp under the same conditions as the only
caller of the function.

llvm-svn: 231402
2015-03-05 20:17:05 +00:00
Dmitry Vyukov 72f169797e tsan: fix signal handling during stop-the-world
Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

This is reincarnation of reverted r229678 (http://reviews.llvm.org/D7722).
Changed:
- execute TracerThreadDieCallback only on tracer thread
- reset global data in TracerThreadSignalHandler/TracerThreadDieCallback
- handle EINTR from waitpid

Add 3 new test:
- SIGSEGV during leak checking
- StopTheWorld operation during signal storm from an external process
- StopTheWorld operation when the program generates and handles SIGSEGVs

http://reviews.llvm.org/D8032

llvm-svn: 231367
2015-03-05 14:37:28 +00:00
Kuba Brecka 5c4ce05d6a Symbolizer refactoring: Link symbolizer tools into a fallback chain
Reviewed at http://reviews.llvm.org/D8049

llvm-svn: 231361
2015-03-05 09:47:13 +00:00
Kostya Serebryany c1d6ab9a1e [sanitizer] add a run-time flag to dump the coverage counter bitset
llvm-svn: 231343
2015-03-05 02:48:51 +00:00
Kostya Serebryany c89aa6d697 [sanitizer] use simpler symbolizer interface (GetModuleNameForPc) where applicable
llvm-svn: 231337
2015-03-05 01:30:36 +00:00
Alexey Samsonov f3761c36f2 [ASan] Fix asan-(32|64)-bits lit tests feature.
It broke down at some point, and all tests with
  REQUIRES: asan-(32|64)-bits
line stopped being executed. Restore the intended behavior.

llvm-svn: 231325
2015-03-05 00:33:11 +00:00
Kostya Serebryany 07aee9c2c6 [sanitizer] when dumping coverage bitset, dump seperate file for every module, instead of dumping a single combined bitset
llvm-svn: 231319
2015-03-04 23:41:55 +00:00
Alexey Samsonov 27f4571a5a [Sanitizer] Fix/suppress compiler warnings in unit tests.
llvm-svn: 231293
2015-03-04 21:54:20 +00:00
Alexey Samsonov 00fb6c9da0 Exclude LLVM sources from lint check.
Checking files from different repository is not nice, and LLVM code
follows its own style guide anyway.

llvm-svn: 231289
2015-03-04 21:38:10 +00:00
Kostya Serebryany 46e5d5c669 [sanitizer] Since x32 runs under 64-bit kernel, GetKernelAreaSize should return 0
llvm-svn: 231283
2015-03-04 20:32:06 +00:00
Kostya Serebryany 4bdf5ada18 [asan] more fixes for x32, patches by H.J. Lu
llvm-svn: 231174
2015-03-03 23:46:40 +00:00
Kostya Serebryany 92b8ab502c [asan] attempting to fix the windows build
llvm-svn: 231171
2015-03-03 23:38:24 +00:00
Kostya Serebryany be5e0ed919 [sanitizer/coverage] Add AFL-style coverage counters (search heuristic for fuzzing).
Introduce -mllvm -sanitizer-coverage-8bit-counters=1
which adds imprecise thread-unfriendly 8-bit coverage counters.

The run-time library maps these 8-bit counters to 8-bit bitsets in the same way
AFL (http://lcamtuf.coredump.cx/afl/technical_details.txt) does:
counter values are divided into 8 ranges and based on the counter
value one of the bits in the bitset is set.
The AFL ranges are used here: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+.

These counters provide a search heuristic for single-threaded
coverage-guided fuzzers, we do not expect them to be useful for other purposes.

Depending on the value of -fsanitize-coverage=[123] flag,
these counters will be added to the function entry blocks (=1),
every basic block (=2), or every edge (=3).

Use these counters as an optional search heuristic in the Fuzzer library.
Add a test where this heuristic is critical.

llvm-svn: 231166
2015-03-03 23:27:02 +00:00
Kuba Brecka b126894b96 Symbolizer refactoring: Unify access to symbolizer tools from POSIXSymbolizer
Reviewed at http://reviews.llvm.org/D8029

llvm-svn: 231162
2015-03-03 23:13:02 +00:00
Alexey Samsonov 987666d57c [UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.
llvm-svn: 231151
2015-03-03 22:15:44 +00:00
Kuba Brecka e87a26c0ed Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfo
Reviewed at http://reviews.llvm.org/D8020

llvm-svn: 231061
2015-03-03 09:18:44 +00:00
Kostya Serebryany 3e7825efb5 [asan] Since x32 has 32-bit pointers, it should use the same code sequence as ia32 for AddressSanitizer asm_flags test. Patch by H.J. Lu
llvm-svn: 231052
2015-03-03 02:45:21 +00:00
Kuba Brecka 249a9e3a7f Symbolizer refactoring: Make LibbacktraceSymbolizer adopt the SymbolizerTool interface
Reviewed at http://reviews.llvm.org/D7971

llvm-svn: 231032
2015-03-02 22:56:25 +00:00
Kuba Brecka 59e8c3b342 Symbolizer refactoring: ExtractToken and friends
Reviewed at http://reviews.llvm.org/D7867

llvm-svn: 231027
2015-03-02 22:15:14 +00:00
Alexey Samsonov 990864018f [Sanitizer] Run test/sanitizer_common lit tests on all supported architectures.
llvm-svn: 231025
2015-03-02 22:03:52 +00:00
Kuba Brecka 898270513d Symbolizer refactoring: Move internals to separate files
Reviewed at http://reviews.llvm.org/D7972

llvm-svn: 231014
2015-03-02 21:15:09 +00:00
Renato Golin 26af9c9024 Allow compiler-rt build on Bitrig
This is the only patch Bitrig uses for compiler-rt. It adds support
for Bitrig/arm in the clear cache code.

Patch by Patrick Wildt.

llvm-svn: 231012
2015-03-02 21:02:43 +00:00
Timur Iskhodzhanov 18cfba9fa4 [ASan/Win] Work around PR22545: call LLVM global_dtors in the MD atexit()
llvm-svn: 231000
2015-03-02 19:41:09 +00:00
Alexey Samsonov d06aa3dc00 [MSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230999
2015-03-02 19:34:27 +00:00
Alexey Samsonov 3e40703ab5 [DFSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230997
2015-03-02 19:34:06 +00:00
Alexey Samsonov 1ce8745b77 [Sanitizer] Restrict open_memstream to x86_64. Fixes PR22714.
llvm-svn: 230996
2015-03-02 19:34:02 +00:00
Alexey Samsonov 1be519876d [Sanitizer] Fix StripPathPrefix function and improve test case.
llvm-svn: 230986
2015-03-02 18:55:46 +00:00
Dmitry Vyukov df01bdca70 asan: fix windows build after commit 230978
llvm-svn: 230980
2015-03-02 17:45:18 +00:00
Dmitry Vyukov b79ac88155 asan: fix signal handling during stoptheworld
The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler.
Add SA_RESTORER flag when setting up handlers.
Add a test that causes SIGSEGV in stoptheworld callback.
Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread.

http://reviews.llvm.org/D8005

llvm-svn: 230978
2015-03-02 17:36:02 +00:00
Sergey Matveev 348800b3d9 [asan] Demote "trying to poison/unpoison memory region" messages...
... to verbosity level 3. Because log spam.

llvm-svn: 230974
2015-03-02 17:13:38 +00:00
Timur Iskhodzhanov 45ddd694fd [ASan/Win] Rename a test.
I came up with the original name trying to test a different issue and forgot to rename afterwards

llvm-svn: 230961
2015-03-02 14:49:44 +00:00
Hans Wennborg 521a941074 Revert r229678 "tsan: fix signal handling during stop-the-world"
This was causing Chromium's browser_tests to flakily segfault during
leak check.

llvm-svn: 230874
2015-02-28 22:18:11 +00:00
Saleem Abdulrasool 06609c64d7 build: remove the stub linux SDK
The SDK is insufficient to really build much.  The builtins can be built
standalone now which is what the stub SDK was meant to permit.  Remove the
unnecessary files.

llvm-svn: 230869
2015-02-28 20:30:11 +00:00
Kuba Brecka ca48abc9b3 Fix OS X build failure with Command Line Tools and without full Xcode installation
On OS X, if you don't have a full Xcode installation, but just the Command Line Tools package, xcrun and xcodebuild don't return a valid SDK root path. In these cases, let's use "/" as the SDK root (which is where the headers and libraries are installed).

Reviewed at http://reviews.llvm.org/D7641

llvm-svn: 230847
2015-02-28 12:25:10 +00:00
Kuba Brecka 8f23ce244c Symbolizer refactoring: SymbolizerTool and better interface
Reviewed at: http://reviews.llvm.org/D7936

llvm-svn: 230842
2015-02-28 09:39:05 +00:00
Petar Jovanovic 9ef0d1c145 [MIPS] Add missing header for syscall
The syscall function itself is declared in <unistd.h>
Compiling compiler-rt with -Werror-implicit-function-declaration will
cause a build failure. This change fixes it.

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

llvm-svn: 230838
2015-02-28 02:32:55 +00:00
Alexey Samsonov 34dc40730a [ASan] debug_stacks.cc was passing on ARM by accident, disable this test there for now.
llvm-svn: 230833
2015-02-28 01:35:46 +00:00
Timur Iskhodzhanov 342f5dead0 [ASan/Win] Update test expectations after r230724
llvm-svn: 230755
2015-02-27 14:29:53 +00:00
Kuba Brecka 1cd77d4f13 [compiler-rt] Symbolizer refactoring: Abstract SymbolizerProcess better
Reviewed at http://reviews.llvm.org/D7889

llvm-svn: 230749
2015-02-27 11:11:05 +00:00
Anna Zaks 2249049db2 [compiler-rt] Allow suppression file to be relative to the location of the executable
The ASanified executable could be launched from different locations. When we
cannot find the suppression file relative to the current directory, try to
see if the specified path is relative to the location of the executable.

llvm-svn: 230723
2015-02-27 03:12:19 +00:00
Alexey Samsonov 0b0cafc8fc [Sanitizer] Print column number in SUMMARY line if it's available.
llvm-svn: 230721
2015-02-27 02:29:25 +00:00
Alexey Samsonov 655bd0200c [CMake] Effectively revert r230683.
Clang in 32-bit mode may choose to target different architecture
than host compiler.

llvm-svn: 230709
2015-02-27 00:07:04 +00:00
Alexey Samsonov a716618927 [CMake] Make sure we built one variant of i386/i686 runtime libraries.
llvm-svn: 230683
2015-02-26 21:03:41 +00:00
Alexey Samsonov 1c915782b9 [UBSan] Run all UBSan tests in 32-bit mode as well.
We build and support UBSan on 32-bit platforms. We should run tests
there as well. Fixes PR22683.

llvm-svn: 230662
2015-02-26 19:19:44 +00:00
Evgeniy Stepanov 504f0987fe [msan] Fix MsanTest to pass in track_origins=2 mode.
llvm-svn: 230639
2015-02-26 15:19:33 +00:00
Sergey Matveev b0caac77dd [lsan] Fix indent.
llvm-svn: 230633
2015-02-26 14:25:25 +00:00
Sergey Matveev c9b2cd5c8c LSan: fix a deadlock caused by dl_iterate_phdr().
Wrap the StopTheWorld call in a dl_iterate_phdr() callback. This ensures that no
other threads are holding the libdl lock, and we can safely reenter it in the
tracer thread.

llvm-svn: 230631
2015-02-26 14:01:08 +00:00
Kostya Serebryany ba9422971c [asan] reenable odr-violation.cc test on non-x86-64 after confirming that it's fixed. PR22699
llvm-svn: 230573
2015-02-25 23:23:01 +00:00
Alexey Samsonov 819045cdd6 [CMake] Properly detect whether we're building runtime for i386 or i686.
llvm-svn: 230569
2015-02-25 23:07:32 +00:00
Kuba Brecka 71b3a69433 Fix >80 line after r230530.
llvm-svn: 230541
2015-02-25 20:56:04 +00:00
Kostya Serebryany 497eeb598b [asan] restict no_asan_gen_globals.c test to 64-bit due to PR22682
llvm-svn: 230537
2015-02-25 20:19:23 +00:00
Peter Collingbourne 4be9b40091 CFI: Add a check-cfi-and-supported rule.
This rule works like check-cfi, but fails if the tests are unsupported.
This is useful to run on bots if we want to be sure that the tests aren't
silently being skipped.

llvm-svn: 230536
2015-02-25 20:14:05 +00:00
Kuba Brecka 8f12ce0825 [compiler-rt] Symbolizer refactoring: Move SymbolizerProcess interface to header
Reviewed at http://reviews.llvm.org/D7868

llvm-svn: 230530
2015-02-25 19:50:38 +00:00
Kuba Brecka d831a73b32 [compiler-rt] Symbolizer refactoring: Move string parsing into separate functions
Reviewed at http://reviews.llvm.org/D7869

llvm-svn: 230529
2015-02-25 19:35:08 +00:00
Kostya Serebryany 2a102cbc77 [asan] temporary disable the test on non-x86-64 while we are investigating PR22699
llvm-svn: 230516
2015-02-25 18:03:03 +00:00
Timur Iskhodzhanov 5c3f1c91f2 Address post-commit feedback on r230344: Don't use weak hooks on Sanitizer Go build for Windows
llvm-svn: 230507
2015-02-25 17:19:42 +00:00
Timur Iskhodzhanov 40d72d9a1f Reland r230019 - [ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand
This incorporates the fix for ARM architecture suggested by Renato Golin.

llvm-svn: 230506
2015-02-25 17:03:34 +00:00
Timur Iskhodzhanov 73e5951ed9 Fix duplicate test code introduced by running "patch -p0" twice
Sorry, SVN had some weird problems so I had to revert and reapply the patch
locally a couple of times and didn't notice I've added file contents to the same
file....

llvm-svn: 230505
2015-02-25 17:01:09 +00:00
Timur Iskhodzhanov 5c62af5bb1 Reland r230419 - add __asan_default_suppressions() hook with a fix for Windows
llvm-svn: 230501
2015-02-25 16:00:26 +00:00
Vasileios Kalintiris c9c7a3e4e5 InstrProf: Fix warnings for mixed declarations and code. NFC.
llvm-svn: 230494
2015-02-25 13:50:18 +00:00
Nico Weber d70bb8d8cb Revert 230419, 230425, 230432.
They don't build on Windows.
http://lab.llvm.org:8011/builders/sanitizer-windows/ went red for example.

llvm-svn: 230461
2015-02-25 04:39:21 +00:00
Kostya Serebryany 63419712f8 [asan] one more attempt to fix windows build
llvm-svn: 230432
2015-02-25 02:00:26 +00:00
Kostya Serebryany a54860e058 [asan] attempting to fix the windows build
llvm-svn: 230425
2015-02-25 01:41:42 +00:00
Kostya Serebryany 74dc7ea2e9 [asan] add __asan_default_suppressions() hook
llvm-svn: 230419
2015-02-25 01:15:37 +00:00
Kostya Serebryany efa60dfd34 [asan] add suppressions for odr violations
llvm-svn: 230409
2015-02-25 00:49:12 +00:00
Kostya Serebryany c1d8a371bf [asan] fix odr-violation.cc test to always use slow unwinding (hopefully fixes the ARM bot)
llvm-svn: 230356
2015-02-24 18:52:38 +00:00
Timur Iskhodzhanov 6ba66b95d1 [ASan/Win] Add support for sanitizer allocator hooks, __asan_default_options and __asan_on_error
llvm-svn: 230344
2015-02-24 17:07:22 +00:00
Renato Golin 9b1e758a55 Allow sanitizer to work with "old" kernel headers
Sanitizers work on ancient kernels and were depending on types existing.
When those types were removed, the sanitizer build broke. See bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59009 for more information.

This patch fixes it by isolating the need for those types only when the
feature is actually needed, thus allowing one to compile the kernel with
or without that change, irrespective of its version.

Patch by Christophe Lyon.

llvm-svn: 230324
2015-02-24 11:38:41 +00:00
Kuba Brecka 90c8b0e092 Try to unbreak sanitizer-x86_64-linux-autoconf after r230318
The buildbot failed to build with

    error: variable ‘enable_fp’ set but not used [-Werror=unused-but-set-variable]

let's add a `(void)enable_fp;`.

llvm-svn: 230323
2015-02-24 11:12:44 +00:00
Kuba Brecka 987bf0400d Fix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On
In debug mode (COMPILER_RT_DEBUG=On), we still build with -fomit-frame-pointer and wrap_ioctl doesn't set up a proper stack frame.  In release mode it does, because ioctl_common_pre gets inlined into wrap_ioctl and it uses the COMMON_INTERCEPTOR_READ_RANGE macro which in the end calls GET_CURRENT_FRAME and that forces the compiler to generate a stack frame for the function.

Not having a proper stack frame breaks the unwinder.  This patch forces to generate a frame pointer (via ENABLE_FRAME_POINTER macro).

Reviewed at http://reviews.llvm.org/D7815

llvm-svn: 230318
2015-02-24 10:10:25 +00:00
Kuba Brecka e4ac10179c Fix alloca_instruments_all_paddings.cc test to work under higher -O levels (compiler-rt part)
When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca.  This patch fixes that.

Reviewed at http://reviews.llvm.org/D7810

llvm-svn: 230317
2015-02-24 09:47:33 +00:00
Alexey Samsonov f535d33fee [ASan] Disable strict init-order checking if dlopen() is called.
Revise the fix to https://code.google.com/p/address-sanitizer/issues/detail?id=178:
always disable strict init-order checking the first time dlopen() is
called: at this point shared library is allowed to access globals
defined in the main executable, as they are guaranteed to be
initialized. Revise the test cases:
* simplify init-order-dlopen.cc test case: make it Linux-specific
  (there's no strict init-order checking on other platforms anyway),
  and single-threaded.
* reinforce init-order-pthread-create.cc test case: make sure that
  init-order checker would produce a false positive unless we
  turn it off at the moment we call pthread_create().

llvm-svn: 230288
2015-02-24 00:37:27 +00:00
Kostya Serebryany 04d482e924 [asan] when registering globals, use the same unwinder as we use for malloc, instead of the one used for FATAL crash (which may be too slow)
llvm-svn: 230256
2015-02-23 20:40:53 +00:00
Alexey Samsonov 1f5bcbe918 Re-land part of r230171: fix GoTsanRuntimeCheck with ccache.
llvm-svn: 230247
2015-02-23 19:35:42 +00:00
Alexey Samsonov 562145c4e1 Add -fdefine-sized-deallocation to ASan test case.
This flag is now needed to force Clang emit the weak definition
of sized delete if it's not present in the header.

llvm-svn: 230242
2015-02-23 19:18:31 +00:00
Ed Schouten f6d492e683 Use compiler provided endianness definitions if available.
This makes int_endianness.h work on operating systems for which we
haven't written explicit constructs, as long as GCC or Clang are being
used.

llvm-svn: 230208
2015-02-23 09:27:49 +00:00
Ismail Pazarbasi 87f4c90a5c Unix/BSD system calls are prefixed with SYS_ on FreeBSD and Mac
Also, __syscall form should be used when one or more of the
parameters is a 64-bit argument to ensure that argument alignment
is correct.

llvm-svn: 230183
2015-02-22 22:01:09 +00:00
Renato Golin 4b1482e75c Revert "[ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand"
This reverts commit r230019, as it was breaking the ARM sanitizer buildbot
and let other errors be introduced since it wasn't fixed/reverted in
time.

llvm-svn: 230179
2015-02-22 18:58:18 +00:00
Dmitri Gribenko 9cbc6f42aa Revert r230171 "TSan runtime: unbreak the build with ccache"
It broke a buildbot with a non-clang (?) compiler.

llvm-svn: 230174
2015-02-22 12:20:05 +00:00
Kuba Brecka 3280dc7081 Whitespace fix for r230172.
llvm-svn: 230173
2015-02-22 11:49:21 +00:00
Kuba Brecka 11bb33c78b Fix gc-test.cc to work under higher -O levels
The gc-test.cc tries underflows of a variable up to -32 bytes, but on i386, the left redzone is not 32 bytes, it’s only 16 bytes and therefore the access to var[-32] is completely off. The reason why this test didn’t fail before is that we’ve been lucky and there was another variable before the var array, which was also instrumented. This fix uses “-32” for 64-bit systems and “-16” for 32-bit.

Reviewed at http://reviews.llvm.org/D7809

llvm-svn: 230172
2015-02-22 11:12:17 +00:00
Dmitri Gribenko bc4c42c345 TSan runtime: unbreak the build with ccache
llvm-svn: 230171
2015-02-22 11:04:59 +00:00
Peter Collingbourne 6b0d0464a8 Run simple-fail.cpp at -O{1,2,3}.
It's probably overkill to run the other tests at -O* given the increasing
combinatorial explosion.

llvm-svn: 230117
2015-02-21 01:48:51 +00:00
Peter Collingbourne f1d13da249 CFI: Add tests for 32-bit, 64-bit and memory bitsets. Break optimization in more places.
llvm-svn: 230116
2015-02-21 01:36:08 +00:00
Filipe Cabecinhas 0385152752 Don't set $LIB if we're not targetting windows.
Reviewers: timurrrr, samsonov

Subscribers: llvm-commits

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

llvm-svn: 230091
2015-02-20 23:35:19 +00:00
Peter Collingbourne e0c4f7eb81 Add test suite for the Control Flow Integrity feature.
Differential Revision: http://reviews.llvm.org/D7738

llvm-svn: 230056
2015-02-20 20:31:18 +00:00
Alexey Samsonov d1c318657b [Sanitizer] Refactor SuppressionContext class.
SuppressionContext is no longer a singleton, shared by all sanitizers,
but a regular class. Each of ASan, LSan, UBSan and TSan now have their
own SuppressionContext, which only parses suppressions specific to
that sanitizer.

"suppressions" flag is moved away from common flags into tool-specific
flags, so the user now may pass
  ASAN_OPTIONS=suppressions=asan_supp.txt LSAN_OPIONS=suppressions=lsan_supp.txt
in a single invocation.

llvm-svn: 230026
2015-02-20 17:41:59 +00:00
Timur Iskhodzhanov 8af971b267 [ASan] Make the argument of '__sanitizer_annotate_contiguous_container' is not aligned error message easier to understand
llvm-svn: 230019
2015-02-20 15:45:51 +00:00
Timur Iskhodzhanov d3e81e9625 [ASan/Win] Work around PR22545 - unregister globals when using the MD runtime
llvm-svn: 230018
2015-02-20 15:34:16 +00:00
Mohit K. Bhakkad 846de99fbd [TSan][MIPS64] Fix few more test cases for MIPS64
Patch by Sagar Thakur

Reviewers: dvyukov, samsonov, kcc.

Subscribers:  dsanders, mohit.bhakkad, Anand.Takale, llvm-commits.

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

llvm-svn: 230002
2015-02-20 09:32:45 +00:00
Mohit K. Bhakkad a46d5a7438 [TSan][MIPS] Adding support for MIPS64
Patch by Sagar Thakur

Reviewers: dvyukov, samsonov, petarj, kcc, dsanders.

Subscribers:  mohit.bhakkad, Anand.Takale, llvm-commits.

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

llvm-svn: 229972
2015-02-20 06:42:41 +00:00
Filipe Cabecinhas a1225be1ea Make FileCheck be a common dependency, not an ASan one.
Summary:
It still gets picked up by ASan, but it also gets picked up by the other
test suites.

Otherwise, some test suites (e.g: UBSan) would complain they had no
dependencies, and wouldn't run.

Reviewers: samsonov, eugenis

Subscribers: llvm-commits

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

llvm-svn: 229962
2015-02-20 03:41:07 +00:00
Alexey Samsonov 36afc349e8 [Sanitizer] Remove multiline comment to silence GCC warning. NFC.
llvm-svn: 229948
2015-02-20 01:45:51 +00:00
Kostya Serebryany 885994618c [sanitizer] when dumping the basic block trace, also dump the module names. Patch by Laszlo Szekeres
llvm-svn: 229940
2015-02-20 00:30:44 +00:00
Alexey Samsonov 1ec3c5bc99 [Sanitizer] Drop LibIgnore dependency on SuppressionContext. NFC.
Let each LibIgnore user (for now it's only TSan) manually go
through SuppressionContext and pass ignored library templates to
LibIgnore.

llvm-svn: 229924
2015-02-19 22:56:49 +00:00
Alexey Samsonov d2c20c49f8 [Sanitizer] Move TemplateMatch() to sanitizer_common.cc. NFC.
llvm-svn: 229923
2015-02-19 22:56:47 +00:00
Timur Iskhodzhanov 2462a2f404 [ASan/Win] Thread sanitizer common interface through asan_win_dll_thunk.cc
llvm-svn: 229860
2015-02-19 15:25:26 +00:00
Timur Iskhodzhanov 7a010dc5e7 [Sanitizers] Move the common sanitizer interface from sanitizer_internal_defs.h to a new sanitizer_interface_internal.h file
Reviewed at http://reviews.llvm.org/D7758

llvm-svn: 229858
2015-02-19 15:15:33 +00:00
Mohit K. Bhakkad 88077324c6 [LSan][MIPS64] Enable LSan testing for mips64/mips64el
Patch by Sagar Thakur

Reviewers: petarj, earthdok, kcc.

Subscribers:  samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits.

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

llvm-svn: 229833
2015-02-19 09:14:43 +00:00
Dmitry Vyukov c0e912dd7b tsan: fix PTRACE_ATTACH handling during stop-the-world
If the thread receives a signal concurrently with PTRACE_ATTACH,
we can get notification about the signal before notification about stop.
In such case we need to forward the signal to the thread, otherwise
the signal will be missed (as we do PTRACE_DETACH with arg=0) and
any logic relying on signals will break. After forwarding we need to
continue to wait for stopping, because the thread is not stopped yet.
We do ignore delivery of SIGSTOP, because we want to make stop-the-world
as invisible as possible.

http://reviews.llvm.org/D7723

 --This line, and those below, will be ignored--
M    lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
M    test/tsan/signal_segv_handler.cc

llvm-svn: 229832
2015-02-19 09:02:29 +00:00
Mohit K. Bhakkad 36f974d76b [LSan] [MIPS] adding support of LSan for mips64/mips64el arch
Patch by Sagar Thakur

Reviewers: petarj, earthdok, kcc.

Subscribers:  samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits.

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

llvm-svn: 229830
2015-02-19 07:30:39 +00:00
Alexey Samsonov d311566e1a Remove support for building sanitizers from Makefile/autoconf build on Linux.
This is a re-application of r229554 restricted to Linux build only.
Apple still uses Makefile/autoconf to build Clang and sanitizers.

llvm-svn: 229756
2015-02-18 22:26:49 +00:00
Renato Golin 67bf4bd316 Revert "Enable ASAN build and test on AArch64"
This reverts commit r229665. It seems that the AArch64 ASAN tests, that
pass on all our internal machines, doesn't like the public buildbot.

Turning this off until we can investigate the public bot for a better
understanding.

llvm-svn: 229739
2015-02-18 20:30:32 +00:00
Greg Fitzgerald 127f4e5c6a [ASan] Set DYLD_LIBRARY_PATH on Darwin
Differential Revision: http://reviews.llvm.org/D7706

llvm-svn: 229714
2015-02-18 18:26:58 +00:00
Timur Iskhodzhanov 805d807139 [ASan/Win] Speculative fix to make the sed command line work with all sed implementations
llvm-svn: 229679
2015-02-18 15:14:07 +00:00
Dmitry Vyukov 8870ee7755 tsan: fix signal handling during stop-the-world
Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

http://reviews.llvm.org/D7722

llvm-svn: 229678
2015-02-18 15:13:29 +00:00
Renato Golin ee130d1c2a Enable ASAN build and test on AArch64
llvm-svn: 229665
2015-02-18 11:34:41 +00:00
Dmitry Vyukov 2a80437038 tsan: add -Wno-maybe-uninitialized to mingw gcc build flags
As per discussion with David Blaikie here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150216/260289.html

llvm-svn: 229657
2015-02-18 09:37:31 +00:00
Mohit K. Bhakkad b40fed04e7 [MSan][MIPS] Fix for some failing tests on MIPS64
Enabling internal ptrace for mips, which fixes some
ptrace related tests. Along with this fixing some
other failures.

Reviewers: Reviewers: eugenis, kcc, samsonov

Subscribers: dsanders, sagar, lldb-commits

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

llvm-svn: 229656
2015-02-18 09:24:19 +00:00
Matthias Braun c0a2279099 Revert "Remove support for building sanitizers from Makefile/autoconf build."
This reverts commit r229556.

Reverting this for now as internal apple builds rely on this
functionality.

llvm-svn: 229585
2015-02-17 23:30:51 +00:00
Alexey Samsonov e194dfa6be [TSan] Provide default values for compile definitions.
Provide defaults for TSAN_COLLECT_STATS and TSAN_NO_HISTORY.
Replace #ifdef directives with #if. This fixes a bug introduced
in r229112, where building TSan runtime with -DTSAN_COLLECT_STATS=0
would still enable stats collection and reporting.

llvm-svn: 229581
2015-02-17 23:23:10 +00:00
Reid Kleckner c12cc5eba8 WinASan: Fix escaping in dll_host.cc test to work with internal shell
llvm-svn: 229570
2015-02-17 22:22:20 +00:00
Reid Kleckner 6fec509ac7 Silence an MSVC warning about testing a function for truth without calling it
In general, this is a reasonable warning, except real_pthread_create is
weak and can be null.  The existing usage is correct as it the function
is declared with SANITIZER_WEAK, but MSVC can't know that because it is
defined to nothing on Windows.

llvm-svn: 229562
2015-02-17 21:57:42 +00:00
Reid Kleckner 7885776604 Use lit's internal shell when running tests on Windows
The internal shell is faster and more predictable than any copy of
bash.exe on the user's system.

LLVM and Clang use the internal shell by default, and have an
environment variable to disable it. I don't think compiler-rt needs that
complexity, so I left it out.

llvm-svn: 229560
2015-02-17 21:57:10 +00:00
Alexey Samsonov d907016dd0 Remove support for building sanitizers from Makefile/autoconf build.
They autotools build has a number of missing features, supports less
OS, architectures, build configurations, doesn't have any tests and
is hard to support in sync with CMake build.

llvm-svn: 229556
2015-02-17 21:53:45 +00:00
Alexey Samsonov 79df187034 [LSan] Make parent tool responsible for initializing LSan flags.
Summary:
LSan can be combined with a parent tool (for now it's only ASan).
Also, we allow LSAN_OPTIONS to override certain common flags. It means
we have to parse LSAN_OPTIONS early enough, before the rest of the
parent tool (including chunks of sanitizer_common) is initialized.

In future, we can use the same approach for UBSan, after we embed it
into ASan runtime in a similar way.

Test Plan: regression test suite

Reviewers: earthdok, eugenis

Subscribers: llvm-commits

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

llvm-svn: 229519
2015-02-17 18:50:30 +00:00
Dimitry Andric 7a9afba9ad Remove inclusion of netinet/ip_compat.h for FreeBSD. This header is not
always available, and nothing in sanitizer_platform_limits_posix.cc uses
any of its definitions.

See also: https://svnweb.freebsd.org/changeset/base/277201

Reviewers: kcc, kutuzov.viktor.84, samsonov
Reviewed By: samsonov
Differential Revision: http://reviews.llvm.org/D7486

llvm-svn: 229518
2015-02-17 18:27:39 +00:00
Viktor Kutuzov dd82236273 [Msan] Fix the unit tests' PathToLoadable() to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D7587

llvm-svn: 229491
2015-02-17 12:52:08 +00:00
Timur Iskhodzhanov f220f88fc9 [ASan/Win] Add an OOM test
llvm-svn: 229399
2015-02-16 15:24:20 +00:00
Evgeniy Stepanov 5c6de59ec4 [msan] Fix UnalignedLoad/UnalignedStore tests.
Add alignment attrubutes to ensure that the tests actually test unaligned
access irrespective of the stack layout.

llvm-svn: 229398
2015-02-16 15:05:14 +00:00
Dmitry Vyukov 620ebaa9c1 tsan: remove everything related to rss/background thread in Go mode
In Go mode the background thread is not started (internal_thread_start is empty).
There is no sense in having this code compiled in.
Also removes dependency on sanitizer_linux_libcdep.cc which is good,
ideally Go runtime does not depend on libc at all.

llvm-svn: 229396
2015-02-16 14:49:34 +00:00
Dmitry Vyukov 3ac5c27c1f tsan: fix freebsd build
GetTls is not defined in Go mode.

llvm-svn: 229395
2015-02-16 14:35:51 +00:00
Dmitry Vyukov 1236868f85 tsan: fix windows build script
add missing source files
+ add -std=c++11 as it is now required to build compiler-rt

llvm-svn: 229393
2015-02-16 13:54:32 +00:00
Dmitry Vyukov 78c25941ba tsan: fix compiler warning
mingw gcc complains:
warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
       Printf("Failed to read options from '%s': error %d\n", value, err);

llvm-svn: 229392
2015-02-16 13:53:00 +00:00
Dmitry Vyukov 13fd535bcb tsan: fix shadow memory mapping on windows
llvm-svn: 229391
2015-02-16 13:52:04 +00:00
Dmitry Vyukov b3381fad11 tsan: exclude DumpProcessMap on windows
The function uses EnumProcessModules, which requires psapi.lib,
which is not linked with tsan on windows.

llvm-svn: 229390
2015-02-16 13:51:17 +00:00
Viktor Kutuzov 37a79210cb [Msan] Improve the EXPECT_NOT_POISONED() macro to provide the original line number
Differential Revision: http://reviews.llvm.org/D7341

llvm-svn: 229389
2015-02-16 13:30:52 +00:00
Viktor Kutuzov b1f54eeed4 [Msan] Make unit tests that use mempcpy() passing on FreeBSD
Differential Revision: http://reviews.llvm.org/D7588

llvm-svn: 229388
2015-02-16 13:26:32 +00:00
Viktor Kutuzov 1a55126699 [Msan] Disable the fgetgrent_r unit test on FreeBSD
Differential Revision: http://reviews.llvm.org/D7343

llvm-svn: 229387
2015-02-16 13:24:21 +00:00
Viktor Kutuzov f886b38a0e [Msan] Disable fcvt unit tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D7340

llvm-svn: 229386
2015-02-16 13:22:07 +00:00
Viktor Kutuzov 4772b9c843 [Msan] Fix the getgrnam_r unit test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D7339

llvm-svn: 229385
2015-02-16 13:19:21 +00:00
Viktor Kutuzov 2e19f31560 [Msan] Fix the sigaction unit test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D7335

llvm-svn: 229384
2015-02-16 13:15:58 +00:00
Viktor Kutuzov 7eff71a474 [Msan] Fix the ether unit test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D7334

llvm-svn: 229383
2015-02-16 13:13:53 +00:00
Viktor Kutuzov 0247b970c4 [Asan] Fix the dlclose-test.cc unit test to build on FreeBSD 11
Differential Revision: http://reviews.llvm.org/D7586

llvm-svn: 229381
2015-02-16 13:11:09 +00:00
Evgeniy Stepanov 84d30ba43a [asan] Support 'su' rooted devices in ASan setup script.
Android devices may not support 'adb root', but be rooted with 'su'
binary. This patch makes it possible to install ASAN to such
devices. When --use-su flag is specified, most 'adb ...' commangs are
changed to 'adb su -c "..."'.

Some other notes:
 * 'readlink' changed to 'ls -l', since not all devices have readlink
   in their firmware.
 * removing ASan library step moved to very end, because 'su' may not
   run properly without this library until shell will be restarted.

Patch by Dmitry <ripp at yandex-team dot ru>.

llvm-svn: 229368
2015-02-16 10:22:12 +00:00
Dmitry Vyukov a3bdbadfd2 tsan: fix build
Revision 229127 introduced a bug:
zero value is not OK for trace headers,
because stack0 needs constructor call.
Instead unmap the unused part of trace after
all ctors have been executed.

llvm-svn: 229263
2015-02-14 16:14:10 +00:00
Dmitry Vyukov 6aaedb0829 tsan: always subtract one from program counters
Go has a pending change to pass proper PCs to tsan:
https://go-review.googlesource.com/#/c/4902/
So now we can always subtract one from PCs.

llvm-svn: 229262
2015-02-14 16:06:22 +00:00
Filipe Cabecinhas 8cabc53215 Use @LINE instead of hardcoded line numbers
llvm-svn: 229190
2015-02-14 00:09:09 +00:00
Filipe Cabecinhas 22bba5dd4b Add -frtti to tests that need rtti
llvm-svn: 229184
2015-02-13 23:19:23 +00:00
Dmitry Vyukov 8a9d23bf53 tsan: don't initialize trace header in release mode
We are going to use only a small part of the trace with the default
value of history_size. However, the constructor writes to the whole trace.
It writes mostly zeros, so freshly mmaped memory will do.
The only non-zero field if mutex type used for debugging.

Reduces per-goroutine overhead by 8K.

https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229127
2015-02-13 17:39:03 +00:00
Dmitry Vyukov b57e39e310 tsan: fix build
llvm-svn: 229120
2015-02-13 16:08:43 +00:00
Dmitry Vyukov 816bf44ac6 tsan: reduce history size in Go mode
The ContainsSameAccess optimization substantially reduces pressure
on trace by eliminating duplicate accesses. So now we can reduce
default trace size to reduce per-goroutine memory consumption.
Current default size is 64K events, new -- 32K events.
In either case user can change it with GORACE env var.

Reduces per-goroutine memory consumption from 356K to 226K.

llvm-svn: 229117
2015-02-13 15:59:23 +00:00
Dmitry Vyukov 05841b1e39 tsan: disable deadlock detector in Go mode
Go does not use that.
https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229116
2015-02-13 15:44:50 +00:00