Commit Graph

8455 Commits

Author SHA1 Message Date
Rafael Espindola 281979b12d avoid a subshell.
Instead of using grep -v we can just expand the globs a bit.

llvm-svn: 299084
2017-03-30 15:02:24 +00:00
Francis Ricci 2aa23e892c Enable leak detection on linux-i686 by default
Summary:
This is already assumed by the test suite, and by
asan_flags.cc.

Reviewers: m.ostapenko, vitalybuka, kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31462

llvm-svn: 299082
2017-03-30 14:05:46 +00:00
Rafael Espindola bc16aa9551 Use FileCheck instead of [.
llvm-svn: 299081
2017-03-30 14:02:08 +00:00
Rafael Espindola 41ca83f811 Add LIT_USE_INTERNAL_SHELL to compiler-rt tests.
I am working on improving our internal bot infrastructure. One thing
that is unique to the ps4 is that we want to run the posix tests, but
have to execute them on windows.

We currently have a local hack to use a shell on windows, but it is
pretty much impossible to get all all the tools to play nice with all
the heuristics for what is a path and what is a command line option.

This adds support LIT_USE_INTERNAL_SHELL and I will then try to fix
the tests that fail with it but adding the missing features.

llvm-svn: 299077
2017-03-30 13:33:22 +00:00
Rafael Espindola be927f586d Use count instead of grep -c.
Using count is more common in llvm and avoids a subshell.

llvm-svn: 299076
2017-03-30 13:22:30 +00:00
Maxim Ostapenko f29aec76dd [sanitizer] Move fread and fwrite interceptors to sanitizer_common
{M, T, E}San have fread and fwrite interceptors, let's move them to sanitizer_common to enable ASan checks as well.

Differential Revision: https://reviews.llvm.org/D31456

llvm-svn: 299061
2017-03-30 07:25:33 +00:00
Dean Michael Berris d7b2aafcfc [XRay][compiler-rt] Spell REQUIRES properly for x86_64-linux
Until llvm-xray starts running/supporting binaries that are not ELF64 we
only run the FDR tests on x86_64-linux. Previous changes caused the
tests to not actually run on x86_64.

Follow-up on D31454.

llvm-svn: 299050
2017-03-30 03:50:56 +00:00
Dean Michael Berris c8381a8ad4 [XRay][compiler-rt] Only run tests using llvm-xray in x86_64 for now
Followup on D31454.

llvm-svn: 299049
2017-03-30 03:18:48 +00:00
Dean Michael Berris fecffaf87a [XRay][compiler-rt] XFAIL the FDR mode tests on aarch64-42vma
Followup on D31454.

llvm-svn: 299048
2017-03-30 02:48:50 +00:00
Kuba Mracek 8ed2928d2c [asan] Support line numbers in StackVarDescr
When -fsanitize-address-use-after-scope is used, the instrumentation produces line numbers in stack frame descriptions. This patch make sure the ASan runtime supports this format (ParseFrameDescription needs to be able to parse "varname:line") and prepares lit tests to allow line numbers in ASan report output.

Differential Revision: https://reviews.llvm.org/D31484

llvm-svn: 299043
2017-03-30 00:41:09 +00:00
Dean Michael Berris 51c1365501 [XRay][compiler-rt] Use llvm-xray in FDR mode tests
Summary:
This change allows us to do an end-to-end test of the FDR mode
implementation that uses the llvm-xray tooling to verify that what we
are both writing and reading the data in a consistent manner.

Reviewers: kpw, pelikan

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31454

llvm-svn: 299042
2017-03-30 00:35:58 +00:00
Kostya Serebryany 2203ee08dd [sanitizers] Fix get_groups interceptor in sanitizer (https://reviews.llvm.org/D31332, patch by Martin Liška)
llvm-svn: 299036
2017-03-29 22:59:28 +00:00
Francis Ricci a79b8a22b4 Move current thread data out of lsan_common on linux
Summary:
Now that we have a platform-specific non-common lsan file, use
it to store non-common lsan data.

Reviewers: kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31472

llvm-svn: 299032
2017-03-29 21:49:47 +00:00
Francis Ricci 1aa20001ed Remove failing check from platform specific darwin lsan initializer
Summary:
We currently don't have any platform specific darwin
lsan modules, don't force failure if they don't exist.

Reviewers: kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31473

llvm-svn: 299031
2017-03-29 21:49:13 +00:00
Filipe Cabecinhas e144b72372 Add allocator_frees_and_returns_null_on_realloc_zero=false flag for compatibility with allocators which allow a realloc(p, 0) and don't free the pointer.
Summary:
I know of two implementations that do this (ASan is not protecting against accessing the returned memory for now, just like malloc(0)):
SIE libc on the PS4
dlmalloc has a flag for this

This allows us to properly support this behaviour.

Reviewers: vsk, kcc

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D31295

llvm-svn: 299016
2017-03-29 18:17:22 +00:00
Weiming Zhao 182db30842 [Builtins] Mark mulsc3_test as UNSUPPORTED for armhf; NFC
The same test fails on clang-cmake-armv7-a15-full biuld bot
but passes the clang-cmake-thumbv7-a15-full.

For now, we mark it as UNSUPPORTED for armhf target.
Bug 32457 tracks it.

llvm-svn: 299005
2017-03-29 16:59:09 +00:00
Weiming Zhao ce957f9070 [Compiler-RT][Builtins] Remove XFAIL for mulsc3; NFC
It was XFAILed in r298974. However, the problem was not exposed on
the buildbot because hardfp flag was not passed during the test.

We can fix the CMAKE to pass the same flag as building the lib to the
RUN line to see if the problem is still there. For now, we remove the
XFAIL.

llvm-svn: 298997
2017-03-29 14:55:51 +00:00
Dean Michael Berris 9b57ca171d [XRay] [compiler-rt] Write buffer length to FDR log before writing buffer.
Summary:
Currently the FDR log writer, upon flushing, dumps a sequence of buffers from
its freelist to disk. A reader can read the first buffer up to an EOB record,
but then it is unclear how far ahead to scan to find the next threads traces.

There are a few ways to handle this problem.
1. The reader has externalized knowledge of the buffer size.
2. The size of buffers is in the file header or otherwise encoded in the log.
3. Only write out the portion of the buffer with records. When released, the
   buffers are marked with a size.
4. The reader looks for memory that matches a pattern and synchronizes on it.

2 and 3 seem the most flexible and 2 does not rule 3 out.

This is an implementation of 2.

In addition, the function handler for fdr more aggressively checks for
finalization and makes an attempt to release its buffer.

Reviewers: pelikan, dberris

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31384

llvm-svn: 298982
2017-03-29 05:56:37 +00:00
Dean Michael Berris cf791cf389 [XRay][compiler-rt] Add an end-to-end test for FDR Logging
Summary:
This change exercises the end-to-end functionality defined in the FDR
logging implementation. We also prepare for being able to run traces
generated by the FDR logging implementation from being analysed with the
llvm-xray command that comes with the LLVM distribution.

This also unblocks D31385, D31384, and D31345.

Reviewers: kpw, pelikan

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D31452

llvm-svn: 298977
2017-03-29 05:19:24 +00:00
Weiming Zhao d8ca74176e [Builtin] Unxfail tests for armhf
Summary:
Originally, a few tests fail for armhf target due to:
1) COMPILER_RT_ARMHF_TARGET was not set when building the lib
2) COMPILER_RT_ABI should not be defined as `__attribute__((pcs("aapcs")))` for armhf when building for both lib and tests

This address https://bugs.llvm.org//show_bug.cgi?id=32261

mulsc3_test.c is a newly exposed issue, which will be addressed separately.

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: aemerson, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D31448

llvm-svn: 298974
2017-03-29 03:36:46 +00:00
Francis Ricci 99a84b163f Postpone lsan tls allocation until required
Summary:
This prevents InternalAlloc from being called before the sanitizers
are fully initialized.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31306

llvm-svn: 298947
2017-03-28 21:56:45 +00:00
Francis Ricci ab85292261 Enable i386 builds for darwin lsan
Summary:
Now that __thread is no longer used for lsan on darwin, i386 builds
can be enabled.

Reviewers: kcc, kubamracek

Subscribers: danalbert, srhines, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29995

llvm-svn: 298946
2017-03-28 21:56:44 +00:00
Weiming Zhao 3a6951250c Reland "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"
Re-land of r298714 which got reverted in r298868.
It looks like the current lit tests won't run for Apple.
Possible reason is the libname is different. (need to update
the base_lib variable of lit.cfg)

llvm-svn: 298892
2017-03-27 23:57:44 +00:00
Francis Ricci f1c2f2a668 Fix missing sanitizer platform include
llvm-svn: 298884
2017-03-27 20:22:02 +00:00
Francis Ricci 2609fd319f Fix comment in lsan_linux.cc
llvm-svn: 298879
2017-03-27 19:44:11 +00:00
Francis Ricci 3e564e985f Move lsan allocator cache from lsan_common_linux to lsan_linux
Having this function in common seems to trigger a lot of unrelated
test failures. Given that this isn't really common code anyway,
move this to a new linux-specific lsan file.

llvm-svn: 298878
2017-03-27 19:42:37 +00:00
Bill Seurer 467afc5f84 [powerpc] deactivate ManyThreadsTest asan test on powerpc64
This test case occassionally hangs when run on powerpc.  This is also a
problem on AArch64 (see https://bugs.llvm.org/show_bug.cgi?id=24389).
Reactivate this when the problem is fixed.

This could also be related to the same problem as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, and several
others that do not run reliably on powerpc.

llvm-svn: 298873
2017-03-27 18:36:06 +00:00
Juergen Ributzka 3d1d9f4ced Revert "[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)"
This broke GreenDragon: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29505/consoleFull

llvm-svn: 298868
2017-03-27 18:08:37 +00:00
Kuba Mracek ded235a141 [sanitizers] Upgrade ios min version to 8
Differential Revision: https://reviews.llvm.org/D29787

llvm-svn: 298860
2017-03-27 17:16:47 +00:00
Kuba Mracek 90caf899eb [sanitizers] Avoid using -fomit-frame-pointer on Darwin
On Darwin, we're having multiple issues with using -fomit-frame-pointer in the AddressSanitizer and ThreadSanitizer runtimes, so we're actually not using -fomit-frame-pointer in the our builds of the sanitizer dylibs. This patch just pushes our internal change upstream.

The issues are usually with debuggers, profilers and other tools that unwind the stack (crash reporter), which are often simply not able to get a stack trace. And crashlogs that don't contain a stack trace are a huge problem.

Differential Revision: https://reviews.llvm.org/D31376

llvm-svn: 298859
2017-03-27 17:14:48 +00:00
Francis Ricci d668a018f7 Use pthreads for thread-local lsan allocator cache on darwin
Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31291

llvm-svn: 298848
2017-03-27 14:07:50 +00:00
Francis Ricci 0add37927c Disable use_tls_dynamic on 32-bit linux
Summary:
This test fails with a false negative due to an unrelated change.
Since we expect a number of false negatives on 32-bit lsan,
disable this test on linux-i386 and linux-i686.

Reviewers: kubamracek, m.ostapenko, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31300

llvm-svn: 298847
2017-03-27 14:06:49 +00:00
Ismail Donmez a2e33e60d2 Fix build error:
In file included from /home/abuild/rpmbuild/BUILD/llvm/projects/compiler-rt/lib/xray/tests/unit/xray_fdr_log_printer_tool.cc:15:
../projects/compiler-rt/lib/xray/tests/../xray_fdr_logging_impl.h:221:21: error: use of undeclared identifier 'CLOCK_MONOTONIC'
  wall_clock_reader(CLOCK_MONOTONIC, &TS);
                    ^
1 error generated.

llvm-svn: 298837
2017-03-27 10:17:03 +00:00
Sam McCall cf95f24a07 Add --std=c++11 to tests that #include <atomic>
llvm-svn: 298836
2017-03-27 09:45:38 +00:00
Dean Michael Berris 1dcec25487 [XRay][compiler-rt] Use sanitizer_common's atomic ops
Instead of std::atomic APIs for atomic operations, we instead use APIs
include with sanitizer_common. This allows us to, at runtime, not have
to depend on potentially dynamically provided implementations of these
atomic operations.

Fixes http://llvm.org/PR32274.

llvm-svn: 298833
2017-03-27 07:13:35 +00:00
Kuba Mracek 0b16ae5090 [asan] Remove column numbers from test expectations in invalid-pointer-pairs.cc
This is failing on some of our internal bots because we're using different symbolizers. It doesn't seem important and we never test for column numbers in any other tests, so let's just remove it.

Differential Revision: https://reviews.llvm.org/D30122

llvm-svn: 298822
2017-03-26 21:20:42 +00:00
Kuba Mracek a1737293fc [tsan] Only Acquire/Release GCD queues if they're not NULL
While it's usually a bug to call GCD APIs, such as dispatch_after, with NULL as a queue, this often "somehow" works and TSan should maintain binary compatibility with existing code. This patch makes sure we don't try to call Acquire and Release on NULL queues, and add one such testcase for dispatch_after.

Differential Revision: https://reviews.llvm.org/D31355

llvm-svn: 298820
2017-03-26 20:59:23 +00:00
Dmitry Vyukov 8096a8c86f tsan: add new mutex annotations
There are several problems with the current annotations (AnnotateRWLockCreate and friends):
- they don't fully support deadlock detection (we need a hook _before_ mutex lock)
- they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock)
- they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on)
- they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes)
- they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives
The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments.

Reviewed in https://reviews.llvm.org/D31093

llvm-svn: 298809
2017-03-26 15:27:04 +00:00
Evgeniy Stepanov 656bc5bb5c Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Only depend on LLD if it is going to be built.

Re-land of r298174 which got reverted in r298287.

llvm-svn: 298753
2017-03-25 00:42:25 +00:00
Alex Shlyapnikov f51fafde1e Fix flaky strtok.c test.
Asserting the result of strtok when we expect delimiter overflow is
flaky, the result depends on the random state of memory right after the
delimiters.

llvm-svn: 298743
2017-03-24 21:43:56 +00:00
Kuba Mracek e598c0d8e1 Follow-up for r298738: Use "0" instead of "false" because the variable is uptr.
llvm-svn: 298741
2017-03-24 21:12:24 +00:00
Kuba Mracek 44df297598 Fix an uninitialized field in tsan_block_context_t/AllocContext in tsan_libdispatch_mac.cc.
llvm-svn: 298738
2017-03-24 20:57:33 +00:00
Weiming Zhao a78ae8a172 Revert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA."
This reverts commit c3709191b6d36c4c936173f4a9a29a734b12cb15.
(commit by mistake)

llvm-svn: 298715
2017-03-24 17:08:35 +00:00
Weiming Zhao 2dff98414f [Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)
Summary:
Original r297566 (https://reviews.llvm.org/D30802) is splitted into two parts.
This part adds CMakefile/lit.cfg support.

Reviewers: rengolin, compnerd, jroelofs, erik.pilkington

Subscribers: srhines, dberris, mgorny

Differential Revision: https://reviews.llvm.org/D31259

llvm-svn: 298714
2017-03-24 17:06:05 +00:00
Weiming Zhao 19bf8bfa15 builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.

Due to this:
 - use  __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
 - use '.thumb' directive consistently  in all affected files
 - decorate all thumb functions using
   DEFINE_COMPILERRT_THUMB_FUNCTION()

---------
Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

Reviewers: weimingz, rengolin, compnerd

Subscribers: aemerson, dim

Differential Revision: https://reviews.llvm.org/D30938

llvm-svn: 298713
2017-03-24 17:06:00 +00:00
Kuba Mracek d8789fdf0b Update debug_external.cc testcase to use TSan-invisible barriers to reduce flakiness.
llvm-svn: 298707
2017-03-24 16:37:02 +00:00
Martin Pelikan 1730dc789e [XRay] [compiler-rt] Plug a file descriptor leak in a failure case.
Summary: Fd needs to be closed before the number gets out of scope.

Reviewers: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31278

llvm-svn: 298685
2017-03-24 05:02:51 +00:00
Kuba Mracek 1082904d20 Fix a warning when running the GotsanRuntimeCheck test on Darwin.
llvm-svn: 298684
2017-03-24 03:57:27 +00:00
Kuba Mracek 38ded5a37f Update the Darwin/external.cc testcase to use rpath. This means we can move the test output executables and still be able to run them.
llvm-svn: 298682
2017-03-24 03:53:44 +00:00
Alex Shlyapnikov d6848fc58f Add strtok interceptor for ASAN for Windows.
Summary: Fixes test broken by D30384

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D31312

llvm-svn: 298658
2017-03-23 23:20:47 +00:00
Alex Shlyapnikov 4ab77b9f28 [asan] Add an interceptor for strtok
Summary:
This change addresses https://github.com/google/sanitizers/issues/766. I
tested the change with make check-asan and the newly added test case.

Reviewers: ygribov, kcc, alekseyshl

Subscribers: kubamracek, llvm-commits

Patch by mrigger

Differential Revision: https://reviews.llvm.org/D30384

llvm-svn: 298650
2017-03-23 21:39:52 +00:00
Kostya Kortchinsky 69d458fa55 [scudo] Add test exercising pthreads
Summary: Scudo didn't have any test using multiple threads. Add one, borrowed from lsan.

Reviewers: kcc, alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31297

llvm-svn: 298636
2017-03-23 19:21:10 +00:00
Alex Shlyapnikov 86abf9aeb3 Bypass potential libc's sysconf interceptors
Summary:
sysconf(_SC_PAGESIZE) is called very early during sanitizer init and
any instrumented code (sysconf() wrapper/interceptor will likely be
instrumented) calling back to sanitizer before init is done will
most surely crash.

2nd attempt, now with glibc version checks (D31092 was reverted).

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D31221

llvm-svn: 298613
2017-03-23 15:57:58 +00:00
Reid Kleckner 731bc9d2fe Use lld-link /nopdb to suppress PDB generation when DWARF is required
Fixes cfi/stats.cpp and asan/fuse-lld.cc on Windows.

llvm-svn: 298545
2017-03-22 19:49:29 +00:00
Nico Weber 082f922e9d Make nullability test pass on Windows, which evaluates parameters right-to-left.
llvm-svn: 298539
2017-03-22 19:15:24 +00:00
Francis Ricci dc13921fbc Factor lsan allocator cache accesses into a function
Summary:
This patch is the first step towards allows us to move away from using
__thread for the allocator cache on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

This will be followed by patches to move the function into OS-specific files.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29994

llvm-svn: 298537
2017-03-22 18:42:43 +00:00
Bob Haarman 1012fe8a54 [compiler-rt] build compiler-rt runtimes without LTO
Summary: Currently, we build the compiler-rt runtimes with link-time optimization if LTO is configured for the LLVM project. This will break external programs that don't invoke the linker in such a way that it supports LLVM's LTO. To avoid this, this change causes the compiler-rt runtimes to be compiled with -fno-lto. This also makes the check-profile tests work on systems when doing a lld LTO build on a system where the system linker does not support LLVM LTO.

Reviewers: rnk, davidxl

Reviewed By: davidxl

Subscribers: dberris, mgorny, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D31218

llvm-svn: 298525
2017-03-22 17:25:49 +00:00
Dmitry Vyukov 28264edea3 tsan: fix a typo
s/covert_morder/convert_morder/

llvm-svn: 298492
2017-03-22 09:31:17 +00:00
Dean Michael Berris 6ba6673dfd [XRay][compiler-rt] Remove dependency on <system_error>
Summary:
Depending on C++11 <system_error> introduces a link-time requirement to
C++11 symbols. Removing it allows us to depend on header-only C++11 and
up libraries.

Partially fixes http://llvm.org/PR32274 -- we know there's more invasive work
to be done, but we're doing it incrementally.

Reviewers: dblaikie, kpw, pelikan

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31233

llvm-svn: 298480
2017-03-22 04:40:32 +00:00
Reid Kleckner 81ee1a59ef XFAIL CFI stats test while LLD produces corrupt PDBs that confuse DIA
llvm-svn: 298476
2017-03-22 01:45:08 +00:00
Reid Kleckner 2b19203e19 Revert "[compiler-rt][asan] Turn on ASAN unittests for win64."
This reverts commit r296878.

These test still require too much swap to pass reliably.

llvm-svn: 298450
2017-03-21 22:07:06 +00:00
Bob Haarman ccd6ae25f4 [compiler-rt] respect CMAKE_EXE_LINKER_FLAGS in compiler and library tests
Summary: check_cxx_compiler_flag and check_library_exists could fail because they ignored CMAKE_EXE_LINKER_FLAGS and therefore would always fail to produce executables. Cmake policy CMP0056 fixes this, but was explicitly set to OLD in our CMakeLists because it caused problems with test_target_arch. This change sets the policy to NEW to fix the problem with the compiler and library tests, and temporarily clears CMAKE_EXE_LINKER_FLAGS inside test_target_arch to emulate the old behavior there. This allows, for example, LTO builds that require lld to succeed.

Reviewers: davidxl, beanz

Reviewed By: beanz

Subscribers: fjricci, dberris, mgorny, mehdi_amini, tejohnson, rnk, llvm-commits

Differential Revision: https://reviews.llvm.org/D31098

llvm-svn: 298413
2017-03-21 18:25:35 +00:00
Dmitry Vyukov 3bf24449b0 tsan: fix pie_no_aslr test
It failed on clang-cmake-aarch64-39vma.
Restrict it to x86_64 only.

llvm-svn: 298383
2017-03-21 15:37:48 +00:00
Chandler Carruth 985f1a9417 Revert r298274: "Use pthreads for thread-local lsan allocator cache on darwin"
This fixes a failure currently present on the upstream linux boxes (and
reproduces for me as well):
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/1130/steps/64-bit%20check-asan-dynamic/logs/stdio

llvm-svn: 298382
2017-03-21 15:31:15 +00:00
Dmitry Vyukov de033e6cdb tsan: support __ATOMIC_HLE_ACQUIRE/RELEASE flags
HLE flags can be combined with memory order in atomic operations.
Currently tsan runtime crashes on e.g. IsStoreOrder(mo) in atomic store
if any of these additional flags are specified.

Filter these flags out.
See the comment as to why it is safe.

llvm-svn: 298378
2017-03-21 14:28:55 +00:00
Dmitry Vyukov ae9f13855b tsan: add test for pie/no aslr
Just ensure that such combination works.

llvm-svn: 298372
2017-03-21 13:44:01 +00:00
Vitaly Buka 40b0b46746 Revert "Bypass potential libc's sysconf wrappers for sysconf(_SC_PAGESIZE) call"
Bot can't find <sys/auxv.h>

This reverts commit r298305.

llvm-svn: 298343
2017-03-21 06:55:32 +00:00
Weiming Zhao 9b7bbeca48 [Builtin] Implement lit-test support (part 1 of 2: test cases update)
Original r297566 is splitted into two parts.
This is part one, which adds "RUN" command for test cases.
Unit/arm/call_apsr.S is updated to support thumb1.
It also fixes a bug in arm/aeabi_uldivmod_test.c
gcc_personality_test is XFAILED as the framework cannot handle it so far.
cpu_model_test is also XFAILED for now as it is expected to return non-zero.

TODO: A few tests are XFAILed for armhf and aarch64.
We need further investigating.  [1,2] Tracks the issue.

[1] https://bugs.llvm.org//show_bug.cgi?id=32260
[2] https://bugs.llvm.org//show_bug.cgi?id=32261

Reviewers: rengolin, compnerd, jroelofs, erik.pilkington, arphaman

Reviewed By: jroelofs

Subscribers: jroelofs, aemerson, srhines, nemanjai, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30802

llvm-svn: 298339
2017-03-21 05:32:51 +00:00
Alex Shlyapnikov a7291b3730 Bypass potential libc's sysconf wrappers for sysconf(_SC_PAGESIZE) call
Summary:
sysconf(_SC_PAGESIZE) is called very early, during sanitizer init and
any instrumented code (a wrapper/interceptor will likely be instrumented)
calling back to sanitizer before init is done will most surely crash.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D31092

llvm-svn: 298305
2017-03-20 21:03:28 +00:00
Evgeniy Stepanov 3bf85d3124 Revert r298174, r298173, r298169, r298159.
Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF."
Revert "[asan] Remove gc-sections test with bfd."
Revert "[asan] Disable globals-gc test with ld.bfd."
Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)"

OOM in gold linker.

llvm-svn: 298287
2017-03-20 18:45:27 +00:00
Francis Ricci b91a5eabb3 Use pthreads for thread-local lsan allocator cache on darwin
Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29994

llvm-svn: 298274
2017-03-20 17:06:42 +00:00
Kuba Mracek 5971469566 Disable stack-use-after-return.cc on AArch64. The test was not testing the right thing before (the call to pthread_attr_setstacksize wasn't doing anything) anyway, and now it's running out of stack due to an unrelated change.
llvm-svn: 298267
2017-03-20 16:36:34 +00:00
Francis Ricci d7b08a6c73 Revert "Use pthreads for thread-local lsan allocator cache on darwin"
This is still failing stack-use-after-return on linux-aarch64.

This reverts commit 5b350130fc4bf6f70c078a5d97096df98a17a057.

llvm-svn: 298246
2017-03-20 13:45:29 +00:00
Francis Ricci 9971b76d20 Use pthreads for thread-local lsan allocator cache on darwin
Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29994

llvm-svn: 298214
2017-03-19 15:02:43 +00:00
Kuba Mracek 662c9b1e81 Re-commit of r296706 ("Increase stack size for stack-use-after-return test"). Hopefully the recent changes in the test will make it not flaky anymore.
Differential Revision: https://reviews.llvm.org/D30267

llvm-svn: 298200
2017-03-19 00:59:08 +00:00
Kuba Mracek 61f8bca7c5 Apparently, PTHREAD_STACK_MIN can be in limits.h on some systems...
llvm-svn: 298196
2017-03-18 22:01:33 +00:00
Kuba Mracek 0d9b01fb95 Change stack-use-after-return.cc to respect PTHREAD_STACK_MIN before calling pthread_attr_setstacksize. To investigate <https://reviews.llvm.org/D30267>. NFC.
llvm-svn: 298195
2017-03-18 21:35:12 +00:00
Kuba Mracek 07183b4a82 Add extra return value checks into stack-use-after-return.cc to help diagnose AArch64 test failures for <https://reviews.llvm.org/D30267>. NFC.
llvm-svn: 298193
2017-03-18 20:39:31 +00:00
Evgeniy Stepanov 0e6cb1925c Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Only depend on LLD if it is going to be built.

llvm-svn: 298174
2017-03-18 00:25:43 +00:00
Evgeniy Stepanov 7453bb7940 [asan] Remove gc-sections test with bfd.
It used to be XFAIL: *, but with the new implementation it passes in some cases
and fails in other. There are similar tests for gold and lld that are not
flaky, and a positive test for bfd that makes sure that were are not breaking
existing functionality.

llvm-svn: 298173
2017-03-18 00:25:40 +00:00
Evgeniy Stepanov 9424af1b30 [asan] Disable globals-gc test with ld.bfd.
Fails on clang-cmake-armv7-a15-full.

llvm-svn: 298169
2017-03-17 23:40:50 +00:00
Evgeniy Stepanov 79ee0c1813 [asan] Fix dead stripping of globals on Linux (compiler-rt)
Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests.

Differential Revision: https://reviews.llvm.org/D30120

llvm-svn: 298159
2017-03-17 22:17:38 +00:00
Vedant Kumar eb44542f69 [ubsan] Add e2e test for -fsanitize=nullability
llvm-svn: 298117
2017-03-17 20:27:33 +00:00
Rong Xu cf1f6fb1b2 Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write
And also r295364 [PGO] remove unintended debug trace. NFC
I removed the test case: it's hard to write synchronized test b/w processes
in this framework. I will revisit the test-case later.

llvm-svn: 298113
2017-03-17 18:41:33 +00:00
Dean Michael Berris 4cb8e11884 [XRay][compiler-rt] Add missing include to <string>
Fixes a build break when using clang-3.9.1 (reported upstream,
post-commit review of D30850).

llvm-svn: 298039
2017-03-17 03:38:12 +00:00
Dean Michael Berris edb0b93bad [XRay][compiler-rt] Add missing include for <functional>
Fixes http://llvm.org/PR32313

llvm-svn: 298037
2017-03-17 02:36:17 +00:00
Juergen Ributzka eecb0ec2ea Revert "[PowerPC] Fix sanitizer frame unwind on 32-bit ABIs"
This broke GreenDragon:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29210/

llvm-svn: 298029
2017-03-17 01:15:39 +00:00
Kuba Mracek 720883520d Fix macOS version detection to also allow missing 3rd part of the version number.
llvm-svn: 298008
2017-03-16 22:35:34 +00:00
Bill Seurer 6c0f69da68 [PowerPC] Fix sanitizer frame unwind on 32-bit ABIs
This fixes many sanitizer problems with -m32.  It is really intended
for gcc but patches to the sanitizers make their way through llvm
first.

ref:  https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00855.html
llvm-svn: 297995
2017-03-16 21:14:13 +00:00
Vitaly Buka bccdba0c1d [compiler-rt] Add undefined "dup" symbol into internal symbolizer white-list.
llvm-svn: 297924
2017-03-16 01:17:31 +00:00
Evgeniy Stepanov d3332fc92f [msan] Intercept getloadavg.
llvm-svn: 297923
2017-03-16 01:06:22 +00:00
Kostya Serebryany ec3ceb1ce5 [asan] trying to fix the windows build
llvm-svn: 297918
2017-03-15 23:53:12 +00:00
Kostya Serebryany 82a41dd6c4 [asan] add one more argument to __sanitizer_print_memory_profile, remove a redundant weak definition.
llvm-svn: 297914
2017-03-15 23:27:14 +00:00
Rong Xu b85cc09329 [PGO] Value profile support for value ranges
This patch adds profile run time support to profile a range of values.
This interface will be used in profiling the size of memory intrinsic calls.

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

llvm-svn: 297895
2017-03-15 21:46:31 +00:00
Dean Michael Berris 5d892ab02e Add NO_EXEC_STACK_DIRECTIVE to xray assembly files.
Summary: Add NO_EXEC_STACK_DIRECTIVE to xray assembly files

Reviewers: dberris, javed.absar

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30953

llvm-svn: 297894
2017-03-15 21:18:47 +00:00
Reid Kleckner 029dbd5e97 Fix -Wstring-conversion instance
llvm-svn: 297879
2017-03-15 19:50:02 +00:00
Eric Liu fd89ed8ed2 [msan] Relax lit check in wcsncpy.cc
Summary: The CHECK failed when the name is __interceptor_wcsncpy

Reviewers: bkramer, eugenis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30975

llvm-svn: 297828
2017-03-15 12:14:32 +00:00
Alex Lorenz d2677c8ed5 [compiler-rt][builtins] Ignore the deprecated warning for
CFPropertyListCreateFromXMLData that's used in __isOSVersionAtLeast

I forgot to add the pragmas in r297760.

llvm-svn: 297827
2017-03-15 12:13:20 +00:00
Dean Michael Berris c6ee33852b [XRay] [compiler-rt] Refactor logic for xray fdr logging. NFC.
Summary:
Separated the IO and the thread local storage state machine of logging
from the writing of log records once the contents are deterministic.

Finer granularity functions are provided as inline functions in the same
header such that stack does not grow due to the functions being separated.

An executable utility xray_fdr_log_printer is also implemented to use the
finest granularity functions to produce binary test data in the FDR format
with a relatively convenient text input.

For example, one can take a file with textual contents layed out in rows
and feed it to the binary to generate data that llvm-xray convert can then
read. This is a convenient way to build a test suite for llvm-xray convert
to ensure it's robust to the fdr format.

Example:

$cat myFile.txt
NewBuffer : { time = 2 , Tid=5}
NewCPU : { CPU =1 , TSC = 123}
Function : { FuncId = 5, TSCDelta = 3, EntryType = Entry }
Function : { FuncId = 5, TSCDelta = 5, EntryType = Exit}
TSCWrap : { TSC = 678 }
Function : { FuncId = 6, TSCDelta = 0, EntryType = Entry }
Function : { FuncId = 6, TSCDelta = 50, EntryType = Exit }
EOB : { }
$cat myFile.txt | ./bin/xray_fdr_log_printer > /tmp/binarydata.bin
$./bin/llvm-xray convert -output-format=yaml -output=- /tmp/binarydata.bin

yaml format comes out as expected.

Reviewers: dberris, pelikan

Reviewed By: dberris

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30850

llvm-svn: 297801
2017-03-15 03:12:01 +00:00
Dean Michael Berris 66443d80f1 [XRay][compiler-rt] Support TSC emulation even for x86_64
Summary:
Use TSC emulation in cases where RDTSCP isn't available on the host
running an XRay instrumented binary. We can then fall back into
emulation instead of not even installing XRay's runtime functionality.
We only do this for now in the naive/basic logging implementation, but
should be useful in even FDR mode.

Should fix http://llvm.org/PR32148.

Reviewers: pelikan, rnk, sdardis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30677

llvm-svn: 297800
2017-03-15 02:28:00 +00:00
Dean Michael Berris 601afaf089 Fix a build break with xray
Summary: Building compiler-rt with clang 3.7 broken, could not find mkstemp

Reviewers: dberris, bkramer

Reviewed By: dberris

Differential Revision: https://reviews.llvm.org/D30389

llvm-svn: 297794
2017-03-14 23:49:12 +00:00
Evgeniy Stepanov a4238e4cdb [msan] Intercept wcsncpy, wcsnlen.
llvm-svn: 297793
2017-03-14 23:48:37 +00:00
Evgeniy Stepanov 32f6b5129f [cfi] Disable bad-split test on win32.
It appears that the fix only helped Itanium ABI.

llvm-svn: 297775
2017-03-14 20:02:42 +00:00
Evgeniy Stepanov dd913de968 [cfi] Add test for type metadata split issue.
https://reviews.llvm.org/D30716

llvm-svn: 297771
2017-03-14 19:33:44 +00:00
Dimitry Andric e773b2d341 After rL297370 and rL297383, instead of a platform check, explicitly
check for the existence of RTLD_DEEPBIND, since this constant is only
supported for glibc >= 2.3.4.  This fixes builds for FreeBSD and other
platforms that do not have RTLD_DEEPBIND.

llvm-svn: 297763
2017-03-14 18:18:14 +00:00
Alex Lorenz ca1fab5d66 [compiler-rt][builtins] __isOSVersionAtLeast should load CoreFoundation
symbols dynamically

The CoreFoundation symbols uses by __isOSVersionAtLeast should be loaded at
runtime to ensure that the programs that don't use @available won't have to be
linked to CoreFoundation.

The Clang frontend IRGen library will need to emit a CoreFoundation symbol
when @available is used to ensure that programs that actually use @available
are linked to CoreFoundation.

rdar://31039554

llvm-svn: 297760
2017-03-14 17:53:37 +00:00
Vedant Kumar c5d628400f [ubsan] Add nullability handlers to interface file
llvm-svn: 297749
2017-03-14 16:36:03 +00:00
Vedant Kumar f2d04e628d [ubsan] Add diagnostic handlers for nullability errors
Add 'nullability_arg' and 'nullability_return' diagnostic handlers, and
also add a TypeCheckKind for null assignments to _Nonnull. With this in
place, we can update clang to use the nicer handlers for nullability
diagnostics.

The alternative to this approach is to update the existing 'nonnull_arg'
and 'nonnull_return' handlers to accept a boolean parameter. However,
versioning the existing handlers would cause code size bloat, and the
complexity cost of introducing new handlers into the runtime is low.

I will add tests for this, and all of -fsanitize=nullability, into
check-ubsan once the clang side of the changes is in.

llvm-svn: 297748
2017-03-14 16:32:27 +00:00
Filipe Cabecinhas 51c5396de8 Some ASan bots (AArch64 at least) use SEGV for a unit test error instead of SIGBUS
llvm-svn: 297728
2017-03-14 10:26:37 +00:00
Weiming Zhao 4f821702ec [Builtin][AArch64] Fix build errors of test cases
Summary:
{mul,sub}tf3_test.c have build errors [1] because macro "COMPILER_RT_ABI" is defined in "int_lib.h", which should be included in test cases.

[1] http://lab.llvm.org:8011/builders/clang-cmake-aarch64-39vma/builds/4861/steps/ninja%20check%201/logs/FAIL%3A%20Builtins-aarch64-linux%3A%3A%20multf3_test.c

Reviewers: rengolin, sdmitriev, dschuff, compnerd, jroelofs

Reviewed By: jroelofs

Subscribers: llvm-commits, aemerson

Differential Revision: https://reviews.llvm.org/D30872

llvm-svn: 297697
2017-03-14 00:44:15 +00:00
Filipe Cabecinhas f7c7c11312 [asan] Split SIGSEGV / SIGBUS handling so we can handle only one of them and not the other.
Summary: This is useful in some platforms where one of these signals is special.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30783

llvm-svn: 297665
2017-03-13 21:06:41 +00:00
Alex Lorenz c630f349b8 [compiler-rt][builtins] Ignore the deprecated warning for
CFPropertyListCreateFromXMLData that's used in __isOSVersionAtLeast

llvm-svn: 297613
2017-03-13 11:00:44 +00:00
Weiming Zhao 4451a33442 Revert "[Builtin] Implement lit-test support"
Due to test failure of check-builtins for aarch64 and armhf.
This reverts commit r297566.

llvm-svn: 297569
2017-03-11 20:53:01 +00:00
Weiming Zhao e0004f9215 [Builtin] Implement lit-test support
Summary:
This patch implements a initial support of lit test for builtins.
Unit/arm/call_apsr.S is updated to support thumb1.
It also fixes a bug in arm/aeabi_uldivmod_test.c
gcc_personality_test is XFAILED as the framework cannot handle it so far.
cpu_model_test is also XFAILED for now as it is expected to return non-zero.

Reviewers: rengolin, compnerd, jroelofs, erik.pilkington, arphaman

Reviewed By: jroelofs

Subscribers: jroelofs, aemerson, srhines, nemanjai, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30802

llvm-svn: 297566
2017-03-11 19:40:24 +00:00
Erik Pilkington eea05ec3f3 Silence a pedantic warning, NFC
llvm-svn: 297515
2017-03-10 21:38:59 +00:00
Weiming Zhao 9dd49054fa [Builtin][ARM] Fix test case for uldivmod
Summary: the inline asm should set those clobbered registers.

Reviewers: rengolin, compnerd, jroelofs

Reviewed By: jroelofs

Subscribers: aemerson, llvm-commits

Differential Revision: https://reviews.llvm.org/D30811

llvm-svn: 297487
2017-03-10 18:21:34 +00:00
Erik Pilkington 0490e1c5f4 Reapply r297382: "[compiler-rt][builtins] Add __isOSVersionAtLeast()"
Looks like the problem was a case-insensitive include of dispatch/dispatch.h.

llvm-svn: 297392
2017-03-09 17:02:16 +00:00
Erik Pilkington 4d297df95c Revert "[compiler-rt][builtins] Add __isOSVersionAtLeast()"
This reverts r297382, it was causing build failures.

llvm-svn: 297388
2017-03-09 15:58:26 +00:00
Maxim Ostapenko c206800218 [sanitizer] Fix android buildbots after r297370
llvm-svn: 297383
2017-03-09 14:40:15 +00:00
Erik Pilkington 6fa97926e9 [compiler-rt][builtins] Add __isOSVersionAtLeast()
This predicate compares the host's marketing OS version to one passed as
argument. Currently, only darwin targets are supported. This is done by parsing
the SystemVersion.plist file.

Also added in this patch is some lit testing infrastructure for builtins, which
previously had none. This part of the patch was written by Alex Lorenz (with
some minor modifications).

This patch is part of a feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

Differential revision: https://reviews.llvm.org/D30136

llvm-svn: 297382
2017-03-09 14:17:36 +00:00
Maxim Ostapenko 76630d43f6 [sanitizer] Bail out with warning if user dlopens shared library with RTLD_DEEPBIND flag
People keep hitting on spurious failures in malloc/free routines when using sanitizers
with shared libraries dlopened with RTLD_DEEPBIND (see https://github.com/google/sanitizers/issues/611 for details).
Let's check for this flag and bail out with warning message instead of failing in random places.

Differential Revision: https://reviews.llvm.org/D30504

llvm-svn: 297370
2017-03-09 10:47:38 +00:00
Francis Ricci 0504863383 Use correct function signature for strerror_r interceptor
There are two possible return values for strerror_r:

On OS X, the return value is always `int`.
On Linux, the return value can be either `char *` or `int`, depending
on the value of:
`(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE`

Because OS X interceptors require a matching function signature,
split out the two cases into separate interceptors, using the above
information to determine the correct signature for a given build.

llvm-svn: 297315
2017-03-08 22:51:03 +00:00
Dean Michael Berris 05641ca556 [XRay] [compiler-rt] Mark arg1 logging test as failing on !x86_64.
Summary:
rL297000 and rL297003 implemented arg1 logging on amd64 and made
other architectures build.  We need to blacklist the new test as well.

Reviewers: dberris, timshen

Reviewed By: dberris

Subscribers: sdardis, llvm-commits

Differential Revision: https://reviews.llvm.org/D30635

llvm-svn: 297238
2017-03-07 23:07:03 +00:00
Bill Seurer fe53fdb873 [PowerPC] mark xray test as unsupported on powerpcle in testsuite
Temporarily mark the test as unsupported so the powerpc le buildbot
testers can get back to work.

There was a brief discussion of this on the mailing list for r296998.

llvm-svn: 297184
2017-03-07 18:52:54 +00:00
Tim Shen 0243eac2d8 [XRay] [compiler-rt] Stub out architectures we don't do arg1 logging on.
rL297000 forgot to include code for three architectures that appeared
since I wrote the first version. This gives them the same treatment as ARMs
have for now - write stubs and wait for someone to actually implement it.

Patched by pelikan (Martin Pelikán)!

Differential Revision: https://reviews.llvm.org/D30634

llvm-svn: 297003
2017-03-06 08:26:21 +00:00
Dean Michael Berris a814c94163 [XRay] [compiler-rt] Allow logging the first argument of a function call.
Summary:
Functions with the LOG_ARGS_ENTRY sled kind at their beginning will be handled
in a way to (optionally) pass their first call argument to your logging handler.

For practical and performance reasons, only the first argument is supported, and
only up to 64 bits.

Reviewers: javed.absar, dberris

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29703

llvm-svn: 297000
2017-03-06 07:25:41 +00:00
Etienne Bergeron 4edb9fd3c8 [compiler-rt][asan] Turn on ASAN unittests for win64.
Summary:
Asan is now working on windows 64-bit.
This patch is turning on the unittest.

Reviewers: rnk

Reviewed By: rnk

Subscribers: kubamracek, dberris, beanz, mgorny, llvm-commits, chrisha

Differential Revision: https://reviews.llvm.org/D24742

llvm-svn: 296878
2017-03-03 16:35:46 +00:00
Evgeniy Stepanov b6fe13f26b [msan] Test for _mm_getcsr and _mm_setcsr (r296848).
llvm-svn: 296849
2017-03-03 01:13:23 +00:00
Francis Ricci 7cd7d9bc8e Revert "Use pthreads for thread-local lsan allocator cache on darwin"
Reverting due to revert of prerequisite patch r296706

This reverts commit 6e1f23078c1acc44295065d28167043c4d31ddd1.

llvm-svn: 296720
2017-03-02 00:12:58 +00:00
Francis Ricci ddee63ffb2 Revert "Increase stack size for stack-use-after-return test"
Reverting due to failures on aarch64

This reverts commit f8ff7e585134196e8482e4dd8752cd4c22cf027a.

llvm-svn: 296719
2017-03-02 00:12:56 +00:00
Francis Ricci 923a320441 Use pthreads for thread-local lsan allocator cache on darwin
Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29994

llvm-svn: 296707
2017-03-01 23:18:15 +00:00
Francis Ricci bdc963a98c Increase stack size for stack-use-after-return test
Summary:
The current size is flaky, as revealed by checking
the stack size attr after setting it.

Reviewers: kubamracek, rnk

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30267

llvm-svn: 296706
2017-03-01 23:18:13 +00:00
Filipe Cabecinhas 9a563daff5 Restrict usage of MemoryMappingLayout to platforms which support it
llvm-svn: 296657
2017-03-01 19:20:13 +00:00
Filipe Cabecinhas 74ad311556 Reapply r296419: [asan] Print a "PC is at a non-executable memory region" message if that's the case
Summary: Points the user to look at function pointer assignments.

Reviewers: kcc, eugenis, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30432

llvm-svn: 296653
2017-03-01 18:52:11 +00:00
Dean Michael Berris fbe64b65a8 [XRay] [compiler-rt] [NFC] Annotate unused variables for the compiler.
Summary:
Use a common definition of a "this variable is unused" annotation for useless
variables only present for their lambda global initializers, to silence gcc's
warning.

Reviewers: dberris

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29860

llvm-svn: 296449
2017-02-28 08:48:46 +00:00
Dean Michael Berris 427215ce5e [XRay][compiler-rt] Switch default XRay 'patch_premain' to false
Summary:
Currently, we assume that applications built with XRay would like to
have the instrumentation sleds patched before main starts. This patch
changes the default so that we do not patch the instrumentation sleds
before main. This default is more helpful for deploying applications in
environments where changing the current default is harder (i.e. on
remote machines, or work-pool-like systems).

This default (not to patch pre-main) makes it easier to selectively run
applications with XRay instrumentation enabled, than with the current
state.

Reviewers: echristo, timshen

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D30396

llvm-svn: 296445
2017-02-28 08:10:01 +00:00
Filipe Cabecinhas 6e36c11d2a Revert r296419 since the strings appear to need some tweaking.
llvm-svn: 296428
2017-02-28 02:45:46 +00:00
Filipe Cabecinhas f1d4ae579d [non-executable-pc.cpp] Try to fix clang-ppc64be buildbot.
llvm-svn: 296424
2017-02-28 02:05:53 +00:00
Filipe Cabecinhas cd643f6324 [asan] Print a "PC is at a non-executable memory region" message if that's the case
Summary: Points the user to look at function pointer assignments.

Reviewers: kcc, eugenis, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30432

llvm-svn: 296419
2017-02-28 00:56:43 +00:00
Evgeniy Stepanov acc8ebb8e3 [msan] Test for alloca handling.
llvm-svn: 296051
2017-02-24 00:13:28 +00:00
Filipe Cabecinhas 3f4181db66 [test] Use @LINE macro
llvm-svn: 295995
2017-02-23 17:23:28 +00:00
Benjamin Kramer 782e98e8aa [xray] Unbreak unittest after r295967.
llvm-svn: 295969
2017-02-23 13:13:27 +00:00
Benjamin Kramer 7654191e70 [Xray] fix building the runtime with GCC.
GCC has a warning about enum bitfields that cannot be disabled. Do the
ugly thing and go through uint8_t for all the values.

llvm-svn: 295967
2017-02-23 12:49:41 +00:00
Kuba Mracek c90b79c585 Re-commit of r295318, which was reverted due to AArch64 flakiness. Moving the test to Darwin only.
llvm-svn: 295801
2017-02-22 01:13:34 +00:00
Tim Shen 01fb2c87b9 [XRay] Change the ppc trampoline asm file into a different name, to not collide with the cc file. NFC.
llvm-svn: 295795
2017-02-22 00:19:43 +00:00
Vitaly Buka 5d6631d8b4 [compiler-rt] Prevent symbolizer from starting itself.
Summary:
If symbolizer was instrumented with sanitizer and crash, it may
try to call itself again causing infinite recursion of crashing processes.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D30222

llvm-svn: 295771
2017-02-21 21:39:24 +00:00
Anna Zaks aacf7958c5 [asan] Re-enable a test on i386-darwin.
This test has been reverted in r279918 due to flaky atos support in the OS
some machines in the buildbot fleet were running. This should not be a
problem anymore.

llvm-svn: 295766
2017-02-21 20:46:50 +00:00
Etienne Bergeron 0eec53cb41 [compiler-rt][asan] Fix incorrect macro preventing ICF with MSVC
Summary:
The DLL thunks are stubs added to an instrumented DLL to redirect ASAN API calls
to the real ones in the main executable. These thunks must contain dummy
code before __asan_init got called. Unfortunately, MSVC linker is doing ICF and is
merging functions with the same body.


In our case, this two ASAN thunks were incorrectly merged:
```
asan_interface.inc:16
INTERFACE_FUNCTION(__asan_before_dynamic_init)
```
```
sanitizer_common_interface.inc:16
INTERFACE_FUNCTION(__sanitizer_verify_contiguous_container)
```

The same thunk got patched twice. After the second patching, calls to
`__asan_before_dynamic_init` are redirected to `__sanitizer_verify_contiguous_container`
and trigger a DCHECK on incorrect operands/

The problem was caused by the macro that is only using __LINE__ to prevent
collapsing code.
```
 #define INTERCEPT_SANITIZER_FUNCTION(name)
   extern "C" __declspec(noinline) void name() {
   volatile int prevent_icf = (__LINE__ << 8); (void)prevent_icf;
```

The current patch is adding __COUNTER__ which is safer than __LINE__.

Also, to precent ICF (guarantee that code is different), we are using a unique attribute:
  - the name of the function

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits, kubamracek, chrisha, dberris

Differential Revision: https://reviews.llvm.org/D30219

llvm-svn: 295761
2017-02-21 20:04:47 +00:00
Renato Golin fc1ccec9bb [RT ARM] Avoid Linux include with a redefinition
To avoid depending on kernel headers, we just repeat the single define
we need, which is likely never going to change.

Patch by Joakim Sindholt <opensource@zhasha.com>

llvm-svn: 295738
2017-02-21 17:40:26 +00:00
Etienne Bergeron fc68c2c777 [compiler-rt][asan] Add support for desallocation of unhandled pointers
Summary: On windows 10, the ucrt DLL is performing allocations before the function hooking and there are multiple allocations not handled by Asan. When a free occur at the end of the process, asan is reporting desallocations not malloc-ed.

Reviewers: rnk, kcc

Reviewed By: rnk, kcc

Subscribers: kcc, llvm-commits, kubamracek, chrisha, dberris

Differential Revision: https://reviews.llvm.org/D25946

llvm-svn: 295730
2017-02-21 16:09:38 +00:00