Commit Graph

1976 Commits

Author SHA1 Message Date
Kuba Mracek 23551fa811 [asan] Support handle_sigill on Darwin
Handling SIGILL on Darwin works fine, so let's just make this feature work and re-enable the ill.cc testcase.

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

llvm-svn: 287959
2016-11-26 01:30:31 +00:00
Kuba Mracek 073cea6128 [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV
This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag.

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

llvm-svn: 287957
2016-11-26 00:50:08 +00:00
Dean Michael Berris 291d74bdb4 Revert "[XRay][compiler-rt] XRay Buffer Queue"
Broke the build on arm7 and aarch64.

llvm-svn: 287911
2016-11-25 03:54:45 +00:00
Dean Michael Berris 47119579c8 [XRay][compiler-rt] XRay Buffer Queue
Summary:
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

Reviewers: majnemer, rSerge, echristo

Subscribers: mehdi_amini, mgorny, llvm-commits

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

llvm-svn: 287910
2016-11-25 03:14:10 +00:00
Kuba Mracek b59118f6ec [tsan] Add support for GCD dispatch_suspend and dispatch_resume
GCD queues can be suspended and resumed with dispatch_suspend and dispatch_resume. We need to add synchronization between the call to dispatch_resume and any subsequent executions of blocks in the queue that was resumed. We already have an Acquire(q) before the block executes, so this patch just adds the Release(q) in an interceptor of dispatch_resume.

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

llvm-svn: 287902
2016-11-24 21:24:54 +00:00
Vedant Kumar 3ac1d4dc10 [test] Use a helper macro to refer to MAP_ANON (NFC)
Some of our internal bots use old SDK's which don't define MAP_ANON.
Use a helper macro to pass the right flag into mmap().

llvm-svn: 287833
2016-11-23 22:23:42 +00:00
Kuba Mracek e99e8d345c [sanitizer] Fix the dedup_token_length_test.cc testcase to not fail when user's home directory contains "bar"
Differential Revision: https://reviews.llvm.org/D24605

llvm-svn: 287696
2016-11-22 20:24:26 +00:00
Dmitry Vyukov 9c5bab23ee tsan: fix build after 287632
1. Mac does not have MAP_32BIT.
Define it to 0 if it is not defined.

2. We are lacking nolibc stub for ListOfModules::init.
Add it.

llvm-svn: 287634
2016-11-22 11:09:35 +00:00
Dmitry Vyukov 5c5d4766f8 tsan: switch libignore from /proc/self/maps to dl_iterate_phdr
/proc/self/maps can't be read atomically, this leads to episodic
crashes in libignore as it thinks that a module is loaded twice.
See the new test for an example.
dl_iterate_phdr does not have this problem.
Switch libignore to dl_iterate_phdr.

llvm-svn: 287632
2016-11-22 09:49:11 +00:00
Kuba Mracek d692ea1e87 [asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deployment target of 10.11+)
The ODR detection in initialization-bug.cc now works on Darwin (due to the recently enabled "live globals" on-by-default), but only if the deployment target is 10.11 or higher. Let's adjust the testcases.

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

llvm-svn: 287581
2016-11-21 21:48:25 +00:00
Ivan Krasin 694c28495a Add a test for vcall on a null ptr.
Summary:
Turns out that in the case of -fsanitize=null and a virtual call,
the type check was generated *after* reading from vtable, which
causes a non-interpretable segfault. The check has been moved up
in https://reviews.llvm.org/D26559 and this CL adds a test for this case.

Reviewers: pcc

Subscribers: cfe-commits, kubabrecka

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

llvm-svn: 287578
2016-11-21 21:23:56 +00:00
Reid Kleckner 7a7477c71f [asan] Un-XFAIL Windows global dead stripping test cases
Test update for r287576

llvm-svn: 287577
2016-11-21 20:40:56 +00:00
Renato Golin 2b9d742ae7 [ARM|ASAN] Disabling more unstable ASAN tests
We're seeying these errors with GCC and Clang on different systems, while
some other identical OSs on different boards fail. Like many other ASAN
tests, there seem to be no easy way to investigate this other than someone
familiar with the sanitizer code and the ARM libraries.

At least, for now, we'll silence the bots. I'll create a bugzilla entry.

llvm-svn: 287464
2016-11-19 21:19:19 +00:00
Reid Kleckner 39950b0f92 [asan] Create a .ASAN$G(A-Z) section for global registration
Summary:
The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

The two tests added for this feature will fail until the LLVM
instrumentation change in D26770 lands, so they are marked XFAIL for
now.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits, mgorny

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

llvm-svn: 287246
2016-11-17 19:02:53 +00:00
Anna Zaks 4cb4c7f4b1 [asan] Update the tests as Mach-O metadata liveness tracking is on by default
This commit reverts r274579.

llvm-svn: 287236
2016-11-17 16:56:11 +00:00
Kuba Brecka cf8d1fc3d8 [asan] Re-enable the use-after-scope-types.cc test on Darwin, now that r287028 fixed the llvm-symbolizer issue that broke this test.
Differential Revision: https://reviews.llvm.org/D26537

llvm-svn: 287029
2016-11-15 21:08:51 +00:00
Anna Zaks 71b55d92c5 [asan] Fixup to r286608 that makes the test pass on iOS.
TARGET_OS_IPHONE is defined in TargetConditionals.h. Without the include the
iOS path is never triggered.

llvm-svn: 286929
2016-11-15 01:57:29 +00:00
Vedant Kumar 8f21c0e50a [cfi] Mark tests as xfailing on Darwin
This allows them to be run on other platforms, undoing damage from
r286902.

llvm-svn: 286904
2016-11-14 23:12:52 +00:00
Vedant Kumar 4f4e522b97 [cfi] Mark some tests as requiring additional support from the MachO writer
These tests need to be marked as unsupported on Darwin:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1545

llvm-svn: 286902
2016-11-14 22:50:13 +00:00
Kuba Brecka b0dd454a1a [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), compiler-rt part
This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

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

llvm-svn: 286894
2016-11-14 21:41:33 +00:00
Evgeniy Stepanov eee04c8f12 Temporarily relax test expectations to fix failures on ppc64.
Summary: Relax test expectations to fix failures on ppc64.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 286885
2016-11-14 20:46:52 +00:00
Reid Kleckner d0c646117f Remove pwd to fix WinASan bot
It only slipped in while I was debugging the test case.

llvm-svn: 286854
2016-11-14 18:02:42 +00:00
Reid Kleckner 171a7022aa Split strncmp and strncasecmp test and XFAIL one for Windows
llvm-svn: 286850
2016-11-14 17:51:11 +00:00
Reid Kleckner e1e344ed05 [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization
Summary:
ASan needs to initialize before ucrtbase.dll so that it can intercept
all of its heap allocations. New versions of dbghelp.dll depend on
ucrtbase.dll, which means both of those DLLs will initialize before the
dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we
avoid the issue.

Eventually, I would like to remove our dbghelp.dll dependency in favor
of always using llvm-symbolizer.exe, but this seems like an acceptable
interim solution.

Fixes PR30903

Reviewers: etienneb

Subscribers: kubabrecka, mgorny, llvm-commits

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

llvm-svn: 286848
2016-11-14 17:37:50 +00:00
Strahinja Petrovic f10d114d43 [lsan] [aarch64] Fix printing of pointers in make check tests - update
This patch replaces fprintf with print_address function in LSAN
tests. This is necessary because of different printing of pointers
in fprintf and sanitizer's print function. 
Differential Revision: https://reviews.llvm.org/D26084.

llvm-svn: 286816
2016-11-14 11:40:56 +00:00
Vitaly Buka c557191b21 [asan] Fix strncmp and strncasecmp interceptors
Summary:
In non-strict mode we will check memory access for both strings from beginning
to either:
  1. 0-char
  2. size
  3. different chars

In strict mode we will check from beginning to either:
  1. 0-char
  2. size

Previously in strict mode we always checked up to the 0-char.

Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 286708
2016-11-12 04:32:31 +00:00
Anna Zaks 03136efd1b [tsan] Test that false races from ObjC's dealloc, .cxx_destruct, and initialize are ignored
Differential Revision: https://reviews.llvm.org/D26228

llvm-svn: 286693
2016-11-12 00:46:07 +00:00
Evgeniy Stepanov ececb37e39 [tsan] Fix typo in test.
llvm-svn: 286674
2016-11-11 23:25:09 +00:00
Reid Kleckner cb03ef90bb Disable a test using posix_spawn on Android
llvm-svn: 286673
2016-11-11 23:23:33 +00:00
Evgeniy Stepanov 31f4eb5f5b Tread TSan LLVM flags to driver: unit tests.
Summary: Unit tests for the new clang flags.

Reviewers: eugenis, dvyukov

Subscribers: kubabrecka, llvm-commits

Patch by Alex Shlyapnikov.

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

llvm-svn: 286670
2016-11-11 23:17:49 +00:00
Evgeniy Stepanov a0fb81fe37 [cfi] Test case for weak symbol handling.
llvm-svn: 286637
2016-11-11 21:39:35 +00:00
Reid Kleckner 47dc7f5550 Add a test that uses coverage and printf from a DLL
This test fails without LLVM r286615

llvm-svn: 286618
2016-11-11 19:27:52 +00:00
Evgeniy Stepanov 753953b02d [cfi] Tweak a test for the cfi-icall change.
llvm-svn: 286612
2016-11-11 18:49:15 +00:00
Reid Kleckner 359fafe74c Add missing %run to test to fix AArch64 buildbot
llvm-svn: 286609
2016-11-11 18:11:33 +00:00
Reid Kleckner 2a2bc7293e [asan/win] Fix wrong TerminateProcess exit code
Add a test for it.

llvm-svn: 286608
2016-11-11 17:51:51 +00:00
Sylvestre Ledru 3383f946ab Force the locale when executing ld gold
Summary:
If run with other locales (like French),
the decode operation might fail

This is the same change as in r246421 for llvm.

llvm-svn: 286605
2016-11-11 17:46:51 +00:00
Sagar Thakur cdfdff0b18 [MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64
Changed the kernel sigaction structure in test syscalls_sigaction.cc for MIPS according to the structure defined in kernel.

Reviewed by eugenis.
Differential: https://reviews.llvm.org/D25814

llvm-svn: 286583
2016-11-11 12:05:30 +00:00
Evgeniy Stepanov a50bc7fddb [asan] Ignore host LD_LIBRARY_PATH in device tests.
I'm not sure why is it there, but it is breaking tests on Android N
because of unexpected linker output about an empty LD_LIBRARY_PATH
entry.

llvm-svn: 286321
2016-11-09 00:33:43 +00:00
Evgeniy Stepanov fcba0d647c [asan] Disable unexpected passing test.
This test fails on some versions of Android and passes on other versions.
Replace XFAIL with UNSUPPORTED.

llvm-svn: 286320
2016-11-09 00:33:41 +00:00
Reid Kleckner d092107b0e [asan/win] Add init hooks to .CRT$XLAB
Summary:
User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
Chromium:
https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs

This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.

The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.

Reviewers: etienneb

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 286290
2016-11-08 20:45:45 +00:00
Dmitry Vyukov 62f99cc486 tsan: more precise handling of atomic stores
Atomic stores terminate release sequences on the atomic variable,
and must use ReleaseStore primitive instead of Release.
This was broken in r192355 during a refactoring.
Restore correct behavior and add a test.

llvm-svn: 286211
2016-11-08 05:34:50 +00:00
Evgeniy Stepanov f95e706371 [asan] Add missing header in a test.
llvm-svn: 286191
2016-11-08 01:17:58 +00:00
Evgeniy Stepanov 4fcbb24deb [asan] Fix one test on Android N.
A fake strtol interceptor should at least make forward progress.

llvm-svn: 286187
2016-11-08 00:59:54 +00:00
Kuba Brecka c784b36fca [tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments don't have nullptr.
llvm-svn: 286166
2016-11-07 22:26:13 +00:00
Evgeniy Stepanov 5d387286d0 Use -fsanitize-recover instead of -mllvm -msan-keep-going: tests.
Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: unit tests.

Reviewers: eugenis

Subscribers: llvm-commits

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

Patch by Aleksey Shlyapnikov.

llvm-svn: 286149
2016-11-07 21:02:56 +00:00
Kuba Brecka 19679f97ed [tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part
Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

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

llvm-svn: 286136
2016-11-07 19:10:13 +00:00
Reid Kleckner 3501fdcb30 [asan] Add more dynamic CRT mode tests
Only tests using %clang_cl_asan were using the dynamic CRT before this.
The unit tests and lit tests using %clangxx_asan were using the static
CRT. Many cross-platform tests fail with the dynamic CRT, so I had to
add win32-(static|dynamic)-asan lit features.

Also deletes some redundant tests in TestCases/Windows that started
failing with this switch.

llvm-svn: 285821
2016-11-02 15:39:08 +00:00
Kuba Brecka be0f80a284 [tsan] Enable the tsan/libcxx/ testcase(s) on Darwin
Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it.

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

llvm-svn: 285634
2016-10-31 20:50:15 +00:00
Kuba Brecka bf6e7848a0 [asan] Move instrumented null-terminated strings to a special section, compiler-rt part
On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285620
2016-10-31 18:52:32 +00:00
Kuba Brecka 0222eacf0f [tsan] Add support for GCD target queues
GCD (libdispatch) has a concept of “target queues”: Each queue has either an implicit or explicit target queue, where the task is handed over to when it’s time to execute it. For example, a concurrent queue can have a serial target queue (effectively making the first queue serial), or multiple queues can have the same serial target queue (which means tasks in all the queues are mutually excluded). Thus we need to acquire-release semantics on the full “chain” of target queues.

This patch changes the way we Acquire() and Release() when executing tasks in queues. Now we’ll walk the chain of target queues and synchronize on each queue that is serial (or when dealing with a barrier block). This should avoid false positives when using dispatch_set_target_queue().

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

llvm-svn: 285613
2016-10-31 18:28:02 +00:00
Anna Zaks 7be6b4963c [asan] Set the darwin deployment target for the dead-strip test
ASan dead-strip support relies on a linker option that only exists
in 10.11 and later, so the LLVM instrumentation checks for the deployment
target. This test does not pass when clang is built to choose lower
deployment target by default but runs on newer host.

(Note, the REQUIRES: osx-ld64-live_support clause only checks the host
and not the target OS.)

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

llvm-svn: 285482
2016-10-29 00:27:07 +00:00
Maxim Ostapenko 49504fa211 [asan] Run pthread_create_from_constructor test on x86 targets.
llvm-svn: 285389
2016-10-28 09:49:34 +00:00
Maxim Ostapenko ee84db84d4 [asan] Disable pthread_create_from_constructor test on PowerPC64.
llvm-svn: 285387
2016-10-28 08:45:23 +00:00
Maxim Ostapenko 984f42eed5 [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread initialization.
There is possible deadlock in dynamic ASan runtime when we dlopen() shared lib
which creates a thread at the global initialization stage. The scenario:

1) dlopen grabs a GI_pthread_mutex_lock in main thread.
2) main thread calls pthread_create, ASan intercepts it, calls real pthread_create
   and waits for the second thread to be "fully initialized".
3) Newly created thread tries to access a thread local disable_counter in LSan
   (to complete its "full initialization") and hangs in tls_get_addr_tail, because
   it also tries to acquire GI_pthread_mutex_lock.

The issue is reproducible on relative recent Glibc versions e.g. 2.23.

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

llvm-svn: 285385
2016-10-28 06:49:53 +00:00
Vitaly Buka d6eee81790 [asan] Test jumps which bypass variables declaration
Summary:
Clang should not generate lifetime intrinsics for such variables. D24693

PR28267

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 285343
2016-10-27 21:02:32 +00:00
Kostya Kortchinsky 71dcc33c58 [scudo] Lay the foundation for 32-bit support
Summary:
In order to support 32-bit platforms, we have to make some adjustments in
multiple locations, one of them being the Scudo chunk header. For it to fit on
64 bits (as a reminder, on x64 it's 128 bits), I had to crunch the space taken
by some of the fields. In order to keep the offset field small, the secondary
allocator was changed to accomodate aligned allocations for larger alignments,
hence making the offset constant for chunks serviced by it.

The resulting header candidate has been added, and further modifications to
allow 32-bit support will follow.

Another notable change is the addition of MaybeStartBackgroudThread() to allow
release of the memory to the OS.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 285209
2016-10-26 16:16:58 +00:00
Robert Lougher 8e075fd086 [ubsan] Fix vptr.cpp test to be more resilient. NFC.
The test contains a switch statement in which two of the cases are
tail-merged, with the call to __ubsan_handle_dynamic_type_cache_miss_abort
in the common tail. When tail-merging occurs, the debug location of the
tail is randomly taken from one of the merge inputs.  Luckily for the test,
the expected line number in the check is the one which is chosen by the
tail-merge.  However, if the switch cases are re-ordered the test will
fail.

This patch disables tail-merge, making the test resilient to changes
in tail-merge, and unblocking review D25742.  It does not change the
semantics of the test.

llvm-svn: 285208
2016-10-26 16:02:36 +00:00
Tim Northover 5adb224bc2 [asan] relax strstr tests.
Darwin's implementation of strstr seems to trigger slightly different failure
modes from Linux since it calls strncmp. All messages seem about equally useful
and correct, so I relaxed the tests so Darwin can pass.

llvm-svn: 285004
2016-10-24 19:07:27 +00:00
Mandeep Singh Grang 249237cb2e [compiler-rt] Remove redundant --check-prefix=CHECK from test
Reviewers: eugenis, rengolin

Subscribers: dberris

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

llvm-svn: 284932
2016-10-23 00:55:12 +00:00
Kostya Serebryany 110e2e52b7 [sanitizers] support strict_string_checks for strncmp
llvm-svn: 284901
2016-10-21 23:52:26 +00:00
Richard Smith 104887ed08 Fix typo (ordered comparison between pointer and 0).
llvm-svn: 284886
2016-10-21 21:37:18 +00:00
Strahinja Petrovic 19610a33c1 [lsan] [aarch64] Fix printing of pointers in make check tests
This patch replaces fprintf with print_address function
in LSAN tests. This is necessary because of different 
printing of pointers in fprintf and sanitizer's print 
function. Differential Revision: https://reviews.llvm.org/D25270.

llvm-svn: 284722
2016-10-20 12:25:57 +00:00
Vitaly Buka 832c383b25 [asan] Update test for D25715
Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 284548
2016-10-18 23:30:07 +00:00
Kuba Brecka efdc36c802 [tsan] Always use -std=c++11 in TSan tests
We currently only pass -std=c++11 when we have an instrumented libcxx.

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

llvm-svn: 284512
2016-10-18 18:33:42 +00:00
Vedant Kumar 6ff82bd0ec [profile] Mark lprofCurFilename as COMPILER_RT_WEAK
This makes __llvm_profile_set_filename() work across dylib boundaries on
Darwin.

This functionality was originally meant to work on all platforms, but
was moved to a Linux-only directory with r272404. The root cause of the
test failure on Darwin was that lprofCurFilename was not marked weak.
Each dylib maintained its own copy of the variable due to the two-level
namespace.

Tested with check-profile (on Darwin). I don't expect this to regress
other platforms.

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

llvm-svn: 284440
2016-10-18 00:02:28 +00:00
Kostya Serebryany 8633900e03 Make lsan complain loudly when running under ptrace
Summary:
LeakSanitizer does not work with ptrace but currently it
will print warnings (only under verbosity=1) and then proceed
to print tons of false reports.
This patch makes lsan fail hard under ptrace with a verbose message.

https://github.com/google/sanitizers/issues/728

Reviewers: eugenis, vitalybuka, aizatsky

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 284171
2016-10-13 22:34:13 +00:00
Vedant Kumar d5454ce10e [profile] Add test for dead_strip+live_support functionality
Differential Revision: https://reviews.llvm.org/D25457

llvm-svn: 283948
2016-10-11 21:48:48 +00:00
Sagar Thakur 51458256a2 [ESan][MIPS] Adds support for MIPS64
With this patch 12 out of 13 tests are passing.

Reviewed by zhaoqin.
Differential: D23799 

llvm-svn: 283435
2016-10-06 09:58:11 +00:00
Diana Picus 47cf72c34c [sanitizers] Update sanitizers test to better match glibc internals
Reapply 282061.

One of the tests relying on sem_t's layout gets the wrong value for versions of
glibc newer than 2.21 on platforms that don't have 64-bit atomics (e.g. ARM).

This commit fixes the test to work with:
* versions of glibc >= 2.21 on platforms with 64-bit atomics: unchanged
* versions of glibc >= 2.21 on platforms without 64-bit atomics: the semaphore
value is shifted by SEM_VALUE_SHIFT (which is set to 1 in glibc's internal
headers)
* versions of glibc < 2.21: unchanged

The logic is complicated a bit by the fact that the sanitizers always pick the
oldest version of the symbol available in glibc, which creates discrepancies
between old platforms which contain several versions od the sem_init symbol, and
newer platforms which contain only one.

See the glibc 2.23 sources:
* sysdeps/nptl/internaltypes.h (struct new_sem for glibc >= 2.21 and
                                struct old_sem for glibc < 2.21)
* nptl/sem_getvalue.c

This was uncovered on one of the new buildbots that we are trying to move to
production.

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

llvm-svn: 283299
2016-10-05 07:13:42 +00:00
Kostya Serebryany 3aacfafaad [asan] When protect_shadow_gap=0, set up the shadow for the shadow gap. This is needed to support NVIDIA CUDA drivers. Unfortunately, I don't know how to test it properly with CUDA on a public build bot, so adding a test that emulates the CUDA behavior.
llvm-svn: 283270
2016-10-04 23:39:58 +00:00
Kostya Serebryany e923a1a486 [sanitizer-coverage] remove stale code, second attempt after failed r282994
llvm-svn: 283185
2016-10-04 04:18:30 +00:00
Vitaly Buka bf1bc21157 Revert "[sanitizer-coverage] remove stale code" at it breaks Windows bot.
This reverts commit r282994.

llvm-svn: 283183
2016-10-04 02:59:03 +00:00
Kostya Serebryany 73957e39a4 [sanitizer-coverage] remove stale code
llvm-svn: 282994
2016-10-01 00:55:13 +00:00
Kostya Kortchinsky ada2761407 [scudo] Fix an edge case in the secondary allocator
Summary:
s/CHECK_LT/CHECK_LE/ in the secondary allocator, as under certain circumstances
Ptr + Size can be equal to MapEnd. This edge case was not found by the current
tests, so those were extended to be able to catch that.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 282913
2016-09-30 19:57:21 +00:00
Etienne Bergeron cde78361d9 [compiler-rt][asan] Disable a broken test on windows 64-bits
Summary:
This test is broken on wndows 64-bit.

The interception library is not able to hook on the memchr functions.

Snippet of the function that is not hookable:
```
--- No source file -------------------------------------------------------------
000007FEFA1A18CD CC                   int         3  
000007FEFA1A18CE CC                   int         3  
000007FEFA1A18CF CC                   int         3  
--- f:\dd\vctools\crt\vcruntime\src\string\amd64_arm_arm64\memchr.c ------------
        while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) {
000007FEFA1A18D0 4D 85 C0             test        r8,r8  
000007FEFA1A18D3 74 0D                je          memchr+12h (07FEFA1A18E2h)  
000007FEFA1A18D5 38 11                cmp         byte ptr [rcx],dl  
000007FEFA1A18D7 74 09                je          memchr+12h (07FEFA1A18E2h)  
                buf = (unsigned char *)buf + 1;
000007FEFA1A18D9 48 FF C1             inc         rcx  
                cnt--;
000007FEFA1A18DC 49 83 E8 01          sub         r8,1  
000007FEFA1A18E0 75 F3                jne         memchr+5h (07FEFA1A18D5h)  
        }
```

Reviewers: rnk

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282860
2016-09-30 14:31:39 +00:00
Etienne Bergeron 04a9eb4c0f [compiler-rt][asan] Fix incorrect regexp breaking an asan unittest on win64
Summary:
On windows, the memcpy and memmove function can be the same.
This is correcly detected when hooking, but it's not possible
to report the right function name when doing symbolisation.

The same fix was applied for the static asan unittest.
We forgot to apply the fix for the dynamic asan tests.
```
lvm\projects\compiler-rt\test\asan/TestCases/Windows/.svn/text-base/intercept_memcpy.cc.svn-base:// CHECK-NEXT:  __asan_{{.*}}mem{{.*}}
```

This patch is fixing this test (win64):
```
ddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc
```

Reviewers: rnk, vitalybuka

Subscribers: llvm-commits, kubabrecka, chrisha, dberris

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

llvm-svn: 282859
2016-09-30 14:29:43 +00:00
Mike Aizatsky 7f4516b049 [sancov] removing html report option test, the option doesn't exist anymore
llvm-svn: 282727
2016-09-29 16:59:04 +00:00
Vitaly Buka e8c12662ac Add build script for symbolizer which can be linked into instrumented process.
Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 282617
2016-09-28 18:46:52 +00:00
Dmitry Vyukov b3587836bc [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber
This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size.

This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it.

Author: Andrii Grynenko (andriigrynenko)
Reviewed in: https://reviews.llvm.org/D24628

llvm-svn: 282582
2016-09-28 12:28:16 +00:00
Evgeniy Stepanov 5ab97ec2f6 [msan] Disable flaky fork.cc on PPC64.
This test is very flaky on PPC64 (both BE and LE), but not on other platforms.

llvm-svn: 282315
2016-09-23 23:41:44 +00:00
Chad Rosier 6c46efba78 Fix the following tests when running under cross-compilation:
Profile-aarch64 :: Linux/comdat_rename.test
 Profile-aarch64 :: Linux/extern_template.test
 Profile-aarch64 :: Linux/instrprof-comdat.test
 Profile-aarch64 :: Linux/instrprof-cs.c

The issue is that the created (aarch64) binaries were attempting to run natively
instead of running through %run, which guarantees running in the proper
environment if the compilation was configured correctly.

llvm-svn: 282264
2016-09-23 17:40:40 +00:00
Etienne Bergeron a0a921888e [compiler-rt] Fix a broken asan 64-bit test using ld_preload
Summary:
The 'asan_preload_test-1.cc' is not working with the i686 architecture.
To repro the error, run on a linux 64-bit:
```
ninja check-asan-dynamic
```

The following error occurs:
```
--
Exit Code: 1

Command Output (stderr):
--
/home/llvm/llvm/projects/compiler-rt/test/asan/TestCases/Linux/asan_preload_test-1.cc:18:12: error: expected string not found in input
 // CHECK: AddressSanitizer: heap-buffer-overflow
           ^
<stdin>:1:1: note: scanning from here
ERROR: ld.so: object 'libclang_rt.asan-i686.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
^
<stdin>:2:10: note: possible intended match here
==25982==AddressSanitizer CHECK failed: /home/llvm/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:736 "((__interception::real_memcpy)) != (0)" (0x0, 0x0)
```

The unittest is running (where %shared_libasan is replaced by libclang_rt.asan-i686.so):
```
// RUN: env LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s
```

But the executable also has a dependancy on libclang_rt.asan-i386.so (added by the clang driver):
```
linux-gate.so.1 =>  (0xf77cc000)
libclang_rt.asan-i386.so => not found
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf76ba000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7673000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7656000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf74a7000)
```

By looking to the clang driver (tools.cpp) we can see that every x86 architecture are mapped to 'i386'.
```
 StringRef MyArch;
    switch (getToolChain().getArch()) {
    case llvm::Triple::arm:
      MyArch = "arm";
      break;
    case llvm::Triple::x86:
      MyArch = "i386";
      break;
    case llvm::Triple::x86_64:
      MyArch = "amd64";
      break;
    default:
      llvm_unreachable("Unsupported architecture");
    }
```

This patch is implementing the same mapping but in the compiler-rt unittest.

Reviewers: rnk, vitalybuka

Subscribers: aemerson, kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282263
2016-09-23 17:40:31 +00:00
Peter Collingbourne 95d5b9c711 cfi: Fixes for check-cfi when configured as an external project.
Differential Revision: https://reviews.llvm.org/D24817

llvm-svn: 282189
2016-09-22 20:51:48 +00:00
Dmitry Vyukov cc1f318b5a tsan: support pie binaries on newer kernels
4.1+ Linux kernels map pie binaries at 0x55:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d1fd836dcf00d2028c700c7e44d2c23404062c90
Currently tsan does not support app memory at 0x55 (https://github.com/google/sanitizers/issues/503).
Older kernels also map pie binaries at 0x55 when ASLR is disables (most notably under gdb).

This change extends tsan mapping for linux/x86_64 to cover 0x554-0x568 app range and fixes both 4.1+ kernels and gdb.

This required to slightly shrink low and high app ranges and move heap. The mapping become even more non-linear, since now we xor lower bits. Now even a continuous app range maps to split, intermixed shadow ranges. This breaks ShadowToMemImpl as it assumes linear mapping at least within a continuous app range (however it turned out to be already broken at least on arm64/42-bit vma as uncovered by r281970). So also change ShadowToMemImpl to hopefully a more robust implementation that does not assume a linear mapping.

llvm-svn: 282152
2016-09-22 13:42:02 +00:00
Sagar Thakur 2ce2ab3a4d [ESan][MIPS] Fix tests struct-simple.cpp on MIPS
For mips assember '#' is the start of comment. We get assembler error messages if # is used in the struct names. Therefore using '$' which works for all architectures.

Differential: D24335
Reviewed by: zhaoqin

llvm-svn: 282142
2016-09-22 08:36:54 +00:00
Nico Weber 08959d3bdd Remove obsolete XFAIL.
The sanitizer-windows bot is currently red because this test unexpectedly passes.

llvm-svn: 282095
2016-09-21 17:41:03 +00:00
Diana Picus a78ee9f322 Revert "[sanitizers] Update sanitizers test to better match glibc internals"
This reverts commit r282061 because it broke the clang-cuda-build bot.

llvm-svn: 282064
2016-09-21 10:06:37 +00:00
Diana Picus 099771b736 [sanitizers] Update sanitizers test to better match glibc internals
One of the tests relying on sem_t's layout gets the wrong value for versions of
glibc newer than 2.21 on platforms that don't have 64-bit atomics (e.g. ARM).

This commit fixes the test to work with:
* versions of glibc >= 2.21 on platforms with 64-bit atomics: unchanged
* versions of glibc >= 2.21 on platforms without 64-bit atomics: the semaphore
value is shifted by SEM_VALUE_SHIFT (which is set to 1 in glibc's internal
headers)
* versions of glibc < 2.21: unchanged

See the glibc 2.23 sources:
* sysdeps/nptl/internaltypes.h (struct new_sem for glibc >= 2.21 and
                                struct old_sem for glibc < 2.21)
* nptl/sem_getvalue.c

This was uncovered on one of the new buildbots that we are trying to move to
production.

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

llvm-svn: 282061
2016-09-21 08:56:14 +00:00
Kostya Kortchinsky 1da3ea561a [scudo] Fix a bug in the new Secondary Allocator
Summary:
GetActuallyAllocatedSize() was not accounting for the last page of the mapping
being a guard page, and was returning the wrong number of actually allocated
bytes, which in turn would mess up with the realloc logic. Current tests didn't
find this as the size exercised was only serviced by the Primary.

Correct the issue by subtracting PageSize, and update the realloc test to
exercise paths in both the Primary and the Secondary.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 282030
2016-09-20 22:17:59 +00:00
Reid Kleckner cf661a0bf7 XFAIL cfi/stats.cpp on Windows until we fix LLD
llvm-svn: 282018
2016-09-20 21:09:31 +00:00
Filipe Cabecinhas 08c1eb9b63 [asan] Fix GlobalAddressDescription::Print()
Summary: Check bug_type for nullptr before calling internal_strcmp

Reviewers: kcc, vitalybuka, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 282012
2016-09-20 20:33:18 +00:00
Kostya Kortchinsky 3beafffcca [scudo] Modify Scudo to use its own Secondary Allocator
Summary:
The Sanitizer Secondary Allocator was not entirely ideal was Scudo for several
reasons: decent amount of unneeded code, redundant checks already performed by
the front end, unneeded data structures, difficulty to properly protect the
secondary chunks header.

Given that the second allocator is pretty straight forward, Scudo will use its
own, trimming all the unneeded code off of the Sanitizer one. A significant
difference in terms of security is that now each secondary chunk is preceded
and followed by a guard page, thus mitigating overflows into and from the
chunk.

A test was added as well to illustrate the overflow & underflow situations
into the guard pages.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 281938
2016-09-19 21:11:55 +00:00
Kostya Serebryany f0ca160ea2 [sanitizer] rename __sanitizer_symbolize_data to __sanitizer_symbolize_global (to avoid conflict with another definition)
llvm-svn: 281902
2016-09-19 14:18:16 +00:00
Kostya Serebryany 88b93166dc [sanitizer] add __sanitizer_symbolize_data (can only print the names of the globals for now)
llvm-svn: 281886
2016-09-19 05:10:32 +00:00
Kuba Brecka 0baa19004f [tsan] Update fork_atexit.cc to consistently print to stderr (and not stdout)
llvm-svn: 281821
2016-09-17 14:39:53 +00:00
Kuba Brecka bdbd1d2848 [tsan] Update signal_cond.cc to write to stderr intead of stdout
llvm-svn: 281820
2016-09-17 14:33:36 +00:00
Vitaly Buka 5ee727add5 [asan] Remove the test as the fix is going to be removed
Summary:
I need to redu solution, existing is not good enough.

PR28267

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281687
2016-09-16 01:37:17 +00:00
Kostya Serebryany 7b296aa567 [asan] add heap_profile=1 to asan to periodically print the heap profile. So far this is a very basic heap-profile functionality
llvm-svn: 281546
2016-09-14 22:00:58 +00:00
Kuba Brecka 410dbbd296 [asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positive with LTO (compiler-rt part)
The '-asan-use-private-alias’ option (disabled by default) option is currently only enabled for Linux and ELF, but it also works on Darwin and Mach-O. This option also fixes a known problem with LTO on Darwin (https://github.com/google/sanitizers/issues/647). This patch enables the support for Darwin (but still keeps it off by default) and adds the LTO test case.

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

llvm-svn: 281472
2016-09-14 14:09:18 +00:00
Kuba Brecka 896bbb3dfe [tsan] Fix hanging gcd-apply and gcd-apply-race tests on macOS Sierra
llvm-svn: 281462
2016-09-14 13:53:06 +00:00
Evgeniy Stepanov 610816f268 [asan] alloc_dealloc_mismatch=0 by default on Android.
All known (to me) Android deployments are disabling this flag anyway.
The in-tree script (asan_device_setup) does that, too.

llvm-svn: 281410
2016-09-13 22:25:44 +00:00
Evgeniy Stepanov 15934b86a1 [asan] Remove lit -j5 flag for android tests.
It makes the tests extremely slow due to high latency of the test launcher.
The main reason for -j5 was high memory usage with handle_abort=1, which
is now disabled in the test runner.

llvm-svn: 281409
2016-09-13 22:25:41 +00:00
Evgeniy Stepanov b48348fec5 [asan] Re-poison all redzones on activation.
When running with start_deactivated=1 in ASAN_OPTIONS, heap redzones
are not poisoned until the first instrumented module is loaded. This
can cause false negatives even on memory allocated after activation,
because redzones are normally poisoned only once when a new allocator
region is mapped.

This change attempts to fix it by iterating over all existing
allocator chunks and poisoning their redzones.

llvm-svn: 281364
2016-09-13 18:38:40 +00:00
Jonas Hahnfeld 161c7f8661 [asan] Add missing include for rand()
llvm-svn: 281342
2016-09-13 14:42:40 +00:00
Keno Fischer 8dc0e0943b [sanitizer] Add interceptor for ttyname_r
Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281116
2016-09-09 23:09:34 +00:00
Evgeniy Stepanov 627d78f6c2 [asan] Disable handle_abort in Android tests.
The same thing is already done on Mac. handle_abort slows down tests
significantly because it triggers tombstone collection on Android;
also, it changes failed test outcome from "not-crash" to "crash" (as
in "bin/not --crash").

This change adds handle_abort=0 to asan options on android (test
only!), and also tweaks android_run.py to semi-correctly pass the
crash/no-crash status to the caller.

llvm-svn: 281075
2016-09-09 18:43:24 +00:00
Filipe Cabecinhas e3c7f54e93 [asan] Since r280945 fixed the OS X abort() problem, merge scariness_score_test.cc and make it a general test.
Summary: Merges back both scariness_score_test.cc files, since the Linux-specific version shouldn't be needed any more.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281048
2016-09-09 14:18:22 +00:00
Kostya Serebryany d77e8c0269 [sanitizer] fix a potential buffer overflow due to __sanitizer_symbolize_pc (need to put a zero after strncmp). LOL
llvm-svn: 281015
2016-09-09 02:13:27 +00:00
Qin Zhao 0ab52b97e8 Revert "[ESan][MIPS] Adds support for MIPS64"
Summary:
This reverts commit 62b3eecdbe72af0255f0639b0446087a47efbf48. (D23799)

The CL cause 13 ESan test failure on x86_64:
Failing Tests (13):
    EfficiencySanitizer-x86_64 :: TestCases/large-stack-linux.c
    EfficiencySanitizer-x86_64 :: TestCases/libc-intercept.c
    EfficiencySanitizer-x86_64 :: TestCases/mmap-shadow-conflict.c
    EfficiencySanitizer-x86_64 :: TestCases/struct-simple.cpp
    EfficiencySanitizer-x86_64 :: TestCases/verbose-simple.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-early-fault.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-memset.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-midreport.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-samples.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-signal-posix.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-simple.cpp
    EfficiencySanitizer-x86_64 :: Unit/circular_buffer.cpp
    EfficiencySanitizer-x86_64 :: Unit/hashtable.cpp

  Unexpected Failures: 13

Reviewers: bruening, slthakur

Subscribers: sdardis, kubabrecka, beanz

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

llvm-svn: 280954
2016-09-08 16:09:46 +00:00
Kuba Brecka 419ebb2891 [tsan] Support C++11 call_once in TSan on Darwin
This patch adds a wrapper for call_once, which uses an already-compiled helper __call_once with an atomic release which is invisible to TSan. To avoid false positives, the interceptor performs an explicit atomic release in the callback wrapper.

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

llvm-svn: 280920
2016-09-08 10:15:20 +00:00
Vitaly Buka b638c48819 [asan] Test that asan does not report use-after-scope if program jumped over variable declaration.
Summary:
Test to check if PR28267 workaround works.

PR28267
PR27453

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 280908
2016-09-08 06:43:02 +00:00
Evgeniy Stepanov 337e40f157 [sanitizer] Fix a conflict between abort_on_error and handle_abort.
Reset the SIGABRT signal handler before calling abort().

Also, change the error message when catching SIGABRT to say "ABRT"
instead of "SEGV".

llvm-svn: 280885
2016-09-07 23:40:53 +00:00
Sagar Thakur 41f08b4422 [ESan][MIPS] Adds support for MIPS64
With this patch 10 out of 13 tests are passing.

Following is the list of failing tests:

    struct-simple.cpp
    workingset-signal-posix.cpp
    mmap-shadow-conflict.c

Reviewed by bruening
Differential: D23799

llvm-svn: 280795
2016-09-07 09:09:03 +00:00
Filipe Cabecinhas 3121ddf7fa [asan] Move scariness_score_test.cc to a common subdirectory
Summary:
Only one of the tests in it doesn't work on OS X.
On Windows it seems that everything that is being moved is also
supported.

The abort() test wasn't copied over (original case 22). This is because
it doesn't work on OS X.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: kubabrecka, llvm-commits
llvm-svn: 280469
2016-09-02 07:18:35 +00:00
Reid Kleckner 0c4dd8de47 Un-XFAIL cfi/stats.cpp, it passes since fixing llvm-symbolizer to look for dwarf again
llvm-svn: 280422
2016-09-01 22:46:26 +00:00
Filipe Cabecinhas d2fb1e4a6c Revert "Copy over most of the scariness_score test to the general tests"
This reverts commit r280361 until we have the proper change in place.

llvm-svn: 280398
2016-09-01 18:40:12 +00:00
Chris Bieneman 5f2546273d [CMake] Adding compiler-rt-test-depends target
This exposes a target for building the compiler-rt test dependencies and matches llvm-test-depends.

llvm-svn: 280393
2016-09-01 18:26:51 +00:00
Renato Golin fbd3de7851 Try to fix another profile test
Another CFG optimisation patch (280364) has broken bad profile tests, and this
is a similar attempt to fix the test without changing the semantics.

llvm-svn: 280373
2016-09-01 14:44:02 +00:00
Renato Golin 0f298a2655 Fix profile test assuming dumb compiler
Commit r280364 has introduced some call-graph optmisations making a profiler
test "fail" due to not expecting the compiler to be "smart", and fold constants
across functions. This commit works around the issue, leaving the origial
semantics intact.

llvm-svn: 280365
2016-09-01 13:45:47 +00:00
Filipe Cabecinhas 6e903def8b Copy over most of the scariness_score test to the general tests
The abort() test wasn't copied over (original case 22). This is because
it doesn't work on OS X.

If theres no buildbot problem with this test later today, I will
minimize the Linux version.

llvm-svn: 280361
2016-09-01 12:29:13 +00:00
Reid Kleckner c213685f69 XFAIL cfi/stats.cpp on Windows until we fix our DIA usage
llvm-svn: 280106
2016-08-30 16:13:07 +00:00
Vasileios Kalintiris 7931529905 [mips][tsan] XFAIL on every MIPS platform an x86_64-specific test.
The map32bit.cc test uses the MMAP_32BIT flag which is supported only
on x86-64.

llvm-svn: 280084
2016-08-30 13:01:04 +00:00
Akira Hatanaka c80f7b866e [asan] Mark failing test as UNSUPPORTED.
llvm-svn: 280055
2016-08-30 03:10:19 +00:00
Vitaly Buka c84d4f5905 [asan] Disable test on darwin bot
According logs asan detects the bug but string with file name is not found.
I will investigate and fix the test.

llvm-svn: 280038
2016-08-30 00:57:40 +00:00
Vitaly Buka 98c3245dc9 [asan] Attempt to fix test on darwin bot
llvm-svn: 280026
2016-08-29 22:59:02 +00:00
Vitaly Buka ac644fa917 [asan] Remove runtime flag detect_stack_use_after_scope
Summary:
We are going to use store instructions to poison some allocas.
Runtime flag will require branching in instrumented code on every lifetime
intrinsic. We'd like to avoid that.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 279981
2016-08-29 17:16:59 +00:00
Akira Hatanaka 0b2628df1a [asan] Disable tests more selectively.
Add "target-arch+host-os" to the feature list to enable disabling the
tests I committed in r279614 and r279880 more selectively.

llvm-svn: 279918
2016-08-27 16:06:36 +00:00
Akira Hatanaka 56658af2cb [asan] Use "REQUIRES: x86_64-target-arch" to disable the test on i386.
My attempt to disable this test on i386 by adding "UNSUPPORTED: i386-apple"
in r279880 wasn't succesful, so I'm using REQUIRES instead.

llvm-svn: 279916
2016-08-27 05:57:50 +00:00
Kostya Serebryany 42034d009d [asan] restrict release_to_os_test.cc to x86_64
llvm-svn: 279898
2016-08-27 00:36:20 +00:00
Kostya Serebryany b72479b84a [asan] first attempt at releasing free-d memory back to the system using madvise. Requires quite some tuning.
llvm-svn: 279887
2016-08-26 23:58:42 +00:00
Akira Hatanaka 0ac01607b6 [asan] Mark symbolize_pc.cc as UNSUPPORTED on i386-apple.
atos currently doesn't work well when loaded from 32-bit binaries, which
was causing some of the bots to fail. Disable this test until we can
come up with a better fix.

llvm-svn: 279880
2016-08-26 23:08:28 +00:00
Dean Michael Berris f50eb93da7 [compiler-rt][XRay] Initial per-thread inmemory logging implementation
Depends on D21612 which implements the building blocks for the compiler-rt
implementation of the XRay runtime. We use a naive in-memory log of fixed-size
entries that get written out to a log file when the buffers are full, and when
the thread exits.

This implementation lays some foundations on to allowing for more complex XRay
records to be written to the log in subsequent changes. It also defines the format
that the function call accounting tool in D21987 will start building upon.

Once D21987 lands, we should be able to start defining more tests using that tool
once the function call accounting tool becomes part of the llvm distribution.

Reviewers: echristo, kcc, rnk, eugenis, majnemer, rSerge

Subscribers: sdardis, rSerge, dberris, tberghammer, danalbert, srhines, majnemer, llvm-commits, mehdi_amini

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

llvm-svn: 279805
2016-08-26 06:39:33 +00:00
Dean Michael Berris 510911f7bd Include tests only if COMPILER_RT_BUILD_XRAY is ON.
This should un-break users that have not re-generated their CMake
configs when they ran it when this was defaulted to OFF. Related to
r277975 post-commit review.

llvm-svn: 279802
2016-08-26 02:39:09 +00:00
Kostya Serebryany 7c5ae7cbc6 [sanitizer] enable random shuffling the memory chunks inside the allocator, under a flag. Set this flag for the scudo allocator, add a test.
llvm-svn: 279793
2016-08-26 00:06:03 +00:00
Kostya Serebryany 9aab75f697 [sanitizer] add __sanitizer_symbolize_pc. https://github.com/google/sanitizers/issues/322
llvm-svn: 279780
2016-08-25 21:35:29 +00:00
Kostya Serebryany 3a46def40c [lsan] one more test fix to please the Debian Sid bot (this time, confirmed on the proper machine). Apparently, newer glibc uses slightly more stack
llvm-svn: 279768
2016-08-25 19:08:10 +00:00
Adhemerval Zanella 1005b7d90c msan: Enable 48-bit VMA support on aarch64
This patch adds 48-bits VMA support for msan on aarch64. As current
mappings for aarch64, 48-bit VMA also supports PIE executable. The
48-bits segments only cover the usual PIE/default segments plus some
more segments (262144GB total, 0.39% total VMA). Memory avaliability
can be increase by adding multiple application segments like 39 and
42 mapping (some mappings were added on this patch as well).

Tested on 39 and 48-bit VMA kernels on aarch64.

llvm-svn: 279752
2016-08-25 17:05:56 +00:00
Kostya Serebryany db0fcdb03b [lsan] give a test a bit more stack -- it started failing after r279664 on the debian bot, hopefully this is a fix.
llvm-svn: 279674
2016-08-24 22:10:35 +00:00
Kostya Serebryany 6d03d84fac [ubsan] fix the test to me more resistent against changes in the sanitizer allocator
llvm-svn: 279661
2016-08-24 21:03:28 +00:00
Akira Hatanaka 1164cae527 [asan] Mark asan-symbolize-sanity-test.cc as UNSUPPORTED on x86_64-apple
and x86_64h-apple.

Mark the test as UNSUPPORTED to fix a bot that is failing.

http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check

The bot is failing because asan_symbolize.py cannot tell whether the
reported address is from an x86_64 slice or an x86_64h slice by the
length of the address alone, so it ends up passing the wrong arch to
atos.

rdar://problem/27907889

llvm-svn: 279614
2016-08-24 06:49:28 +00:00
Vitaly Buka 8176ee9b5d [asan] Rename asan-instrument-allocas -> asan-instrument-dynamic-allocas
Summary: Depends on D23707.

Subscribers: kubabrecka

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

llvm-svn: 279377
2016-08-20 17:22:36 +00:00
Chris Bieneman 5968c3ac1f [CMake] Add check-compiler-rt target for runtimes build
Durning standalone builds (which includes runtimes builds) we want to create a target named check-compiler-rt. Additionally we also create check-all if it doesn't already exist as a convienence target that depends on check-compiler-rt.

This allows us to generate a single check target that invokes lit for all test suites in the runtimes projects, while avoiding name collision of check-all and not breaking existing workflows.

llvm-svn: 279334
2016-08-19 22:17:48 +00:00
Vitaly Buka 8075b82322 [asan] Temporarily mark test as broken on Windows
llvm-svn: 279318
2016-08-19 20:48:09 +00:00
Vitaly Buka 3efaaeb79d [asan] Add one more test for __asan_set_shadow_*
Reviewers: eugenis, filcab

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 279108
2016-08-18 18:15:15 +00:00
Oleg Ranevskyy 8a8b7b6df7 [compiler-rt][tests] cpu_model_test.c test fails to compile if X86 is not clang's default target
Summary:
test/builtins/Unit/cpu_model_test.c tests the X86 specific builtin `__builtin_cpu_supports`.
It fails if the clang's default target is not X86.

The proposed patch adds an additional requirement for the X86 target to the test, making lit ignore the test if the target is different.

Reviewers: asbirlea

Subscribers: dberris, llvm-commits

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

llvm-svn: 279071
2016-08-18 14:39:39 +00:00
Daniel Sanders 93c0f382b4 [mips][msan] Fix all the XPASSes following r278793 and r278795
All msan tests are now passing for mipsel and mips64el except for
allocator_mapping.cc which is marked unsupported.

llvm-svn: 279048
2016-08-18 10:50:46 +00:00
Sagar Thakur 49307c0297 [MSAN][MIPS] Changed memory mapping to support pie executable.
Reviewed by eugenis
Differential: D22993

llvm-svn: 278793
2016-08-16 12:49:54 +00:00
Sagar Thakur 19b84a0224 [TSan][MIPS] Implements setjmp assembly for MIPS64
Reviewed by dvyukov
Differential: https://reviews.llvm.org/D23494

llvm-svn: 278775
2016-08-16 05:06:56 +00:00
Daniel Sanders edfed3deeb [msan] Correct @LINE expression in obstack.cc
Summary:

[[@LINE-30]] only worked because the resulting 3 matches the first character of
30. With the additional blank lines the resulting 5 no longer matches 30.

Reviewers: eugenis

Subscribers: eugenis, llvm-commits

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

llvm-svn: 278715
2016-08-15 18:56:54 +00:00
Daniel Sanders dab0556112 [msan] Fix line number sensitivity in chained_origin.cc and chained_origin_memcpy.cc
Reviewers: eugenis

Subscribers: eugenis, llvm-commits

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

llvm-svn: 278712
2016-08-15 18:50:36 +00:00