Commit Graph

8216 Commits

Author SHA1 Message Date
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
Diana Picus 99141cc7ca Revert "[tsan] Provide external tags (object types) via debugging API"
This reverts commit r295318 as the test is flaky on AArch64.

llvm-svn: 295667
2017-02-20 15:26:12 +00:00
Renato Golin 18342e39e6 Revert "[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write"
Revert "[PGO] remove unintended debug trace. NFC"

This reverts commit r295469, r295364, as they are unstable on ARM/AArch64.

llvm-svn: 295664
2017-02-20 15:03:12 +00:00
Dean Michael Berris 773c2ab9d6 [XRay][compiler-rt] Allow for defining defaults at compile-time
Summary:
Currently, defaulted options cannot be overriden easily. As an example,
we always patch the binary pre-main unless the user defines the option
at the commandline to inhibit this behaviour. This change allows for
building different versions of the XRay archive with different defaults
(whether to patch pre-main, or whether to use FDR mode by default, etc.)
and giving that choice at link-time.

For now we don't create different archives that have different defaults,
but those could be added in later revisions. This change just enables
the possibility.

Reviewers: pelikan, kcc

Subscribers: llvm-commits

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

llvm-svn: 295534
2017-02-18 02:09:51 +00:00
Pirama Arumuga Nainar a84404c7a4 Enable PROFILE, TSAN and UBSAN for Android
Summary:
These sanitizers are enabled and used in Android but got built with
Android's build system.  This change enables them in the CMake build
system.

Reviewers: eugenis

Subscribers: llvm-commits, danalbert, srhines, mgorny

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

llvm-svn: 295523
2017-02-18 01:12:55 +00:00
Rong Xu 1ba2cacc96 [PGO] remove unintended debug trace. NFC
llvm-svn: 295469
2017-02-17 17:42:16 +00:00
Francis Ricci f891e90b35 Revert "Use pthreads for thread-local lsan allocator cache on darwin"
This caused a failure in Linux-x86_64 stack-use-after-return

This reverts commit 1f9563141e999016d13ac3fc6a50fde690381e82.

llvm-svn: 295449
2017-02-17 14:42:30 +00:00
Francis Ricci 908e2d9009 Revert "Upgrade ios min version to 8"
Accidental commit

This reverts commit f21d4a6836ea159e95e5042ba8383f20d4899cda.

llvm-svn: 295414
2017-02-17 04:33:40 +00:00
Francis Ricci 01159f5c58 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: 295413
2017-02-17 04:32:19 +00:00
Francis Ricci 32f0ec51d1 Upgrade ios min version to 8
Summary:
Version 8 is the first version to support the __thread
keyword, which is required for building lsan for
64-bit ios.

Reviewers: kubamracek, kcc, glider

Subscribers: mgorny, llvm-commits

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

llvm-svn: 295412
2017-02-17 04:32:17 +00:00
Francis Ricci a0921f68ab Fix build breakage from moving kInvalidTid to lsan_common
llvm-svn: 295409
2017-02-17 03:34:56 +00:00
Francis Ricci 571c05a550 Use pthreads to store current thread id on darwin
Summary:
__thread is not supported by all darwin versions and architectures,
use pthreads instead to allow for building darwin lsan on iossim.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 295405
2017-02-17 03:23:07 +00:00
Rong Xu 72f1e5440e [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write
Summary:
We found a nondeterministic behavior when doing online profile merging
for multi-process applications. The application forks a sub-process and
sub-process sets to get SIGKILL when the parent process exits,

The first process gets the lock, and dumps the profile. The second one
will mmap the file, do the merge and write out the file. Note that before
the merged write, we truncate the profile.

Depending on the timing, the child process might be terminated
abnormally when the parent exits first. If this happens:
(1) before the truncation, we will get the profile for the main process
(2) after the truncation, and before write-out the profile,  we will get
0 size profile.
(3) after the merged write, we get merged profile.

This patch temporarily suspend the SIGKILL for PR_SET_PDEATHSIG
before profile-write and restore it after the write.

This patch only applies to Linux system.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: xur, llvm-commits

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

llvm-svn: 295364
2017-02-16 19:21:31 +00:00
Vitaly Buka 78395f23dc [sanitizers] DefaultSymbolizer should not be destroyed as as symbolizer
can be accessed after the static destroyed.

llvm-svn: 295348
2017-02-16 18:35:38 +00:00
Kuba Mracek 3e81c2675e [tsan] Provide external tags (object types) via debugging API
In D28836, we added a way to tag heap objects and thus provide object types into report. This patch exposes this information into the debugging API.

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

llvm-svn: 295318
2017-02-16 14:02:32 +00:00
Vitaly Buka f813697f05 [sanitizers] Fix formatting of the shell script.
llvm-svn: 295299
2017-02-16 08:47:27 +00:00
Vitaly Buka 69068dd50e [sanitizers] Redirect pthread calls to interceptors.
It's needed if libcxx is build without disabling threads.

llvm-svn: 295296
2017-02-16 08:06:17 +00:00
Vitaly Buka e4465dba20 Extract *.a to *.bc conversion into separate script.
Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 295272
2017-02-16 02:12:18 +00:00
Weiming Zhao d77a6730b1 [Builtin][ARM] #ifdef ARM vfp tests and cpu_model_tests
Summary:
Add in #ifdef to exclude cpu_model_test on non-X86 and  *vfp_test on ARM targets without VFP support.

This is consistent with other target-specific tests that print "Skipped" if not supported.

Reviewers: rengolin, compnerd, asbirlea

Reviewed By: compnerd

Subscribers: llvm-commits, aemerson

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

llvm-svn: 295261
2017-02-15 23:59:09 +00:00
Tim Shen c6ce73b114 Re-commit r295017, since we have a potential fix of the tests, r295248, landed.
Differential Revision: https://reviews.llvm.org/D29742

llvm-svn: 295251
2017-02-15 22:40:29 +00:00
Tim Shen b39372859f [XRay] Fix gtest error code comparison. NFC.
llvm-svn: 295248
2017-02-15 22:30:54 +00:00
Etienne Bergeron b69639e217 [compiler-rt][asan|win] Fix ASAN exception handler missing import
Summary:
This patch is adding a missing ASAN API redirection from an instrumented DLL.
The bug was introduced here:
  https://reviews.llvm.org/D29463

This is causing this chromium bug:
  https://bugs.chromium.org/p/chromium/issues/detail?id=692580

Reviewers: rnk

Reviewed By: rnk

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

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

llvm-svn: 295232
2017-02-15 20:48:04 +00:00
Sagar Thakur ea831e4c46 [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el
Summary: Adds support for xray on mips/mipsel/mips64/mips64el.

Reviewed by sdardis, dberris
Differential: D27699

llvm-svn: 295166
2017-02-15 10:54:09 +00:00
Xinliang David Li f2d9481028 [PGO] Delay profile dir creation until write
Differential Revision: http://reviews.llvm.org/D29960

llvm-svn: 295108
2017-02-14 21:39:55 +00:00
Tim Shen 6edc4883fe Revert r295017 "Re-commit r294826 and r294781, with a fix on the cmake file to only"
llvm-svn: 295097
2017-02-14 19:48:13 +00:00
Etienne Bergeron 0ce53e4b9f [compiler-rt][asan|win] Fix flaky unittest due to large allocations
Summary:
Coverage is using large arrays which requires large allocations.
These allocations are flaky and often failing on win64.

We are using the 32-bits size until this gets a better fix.

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits, kubamracek, chrisha, dberris

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

llvm-svn: 295086
2017-02-14 18:57:17 +00:00
Etienne Bergeron 60ce0f667c [compiler-rt][asan|win] Force tls_init test to use dynamic runtime
Summary:
There is no guarantee that the tls_init is executed on the static runtime
(/MT).

On windows 7, this unittest is failing.
On windows 10, I believe it's working because of the new CRT.

On ASAN side, it doesn't matter that the hook point is run or not.
It must be run only if there is other tls_initializer that are registered.

Reviewers: rnk, chrisha

Reviewed By: rnk

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 295057
2017-02-14 15:21:53 +00:00
Tim Shen b94588eb88 Re-commit r294826 and r294781, with a fix on the cmake file to only
compile on powerpc64le.

I cannot locally reproduce this test failure:
http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux/builds/1363/steps/test%20standalone%20compiler-rt/logs/stdio

Let's see how the buildbot goes.

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

llvm-svn: 295017
2017-02-14 02:05:47 +00:00
Francis Ricci 8187c7b06b Add cmake build support for lsan on OS X
Summary:
Adds a new cmake flag 'COMPILER_RT_ENABLE_LSAN_OSX', which enables lsan
compilation and is turned off by default. Patches to fix build errors
when this flag is enabled will be uploaded soon.

This is part of an effort to port LSan to OS X, but LSan on OS X does not
currently work or pass tests currently.

Reviewers: kubamracek, kcc, glider, alekseyshl

Reviewed By: kubamracek

Subscribers: danalbert, srhines, mgorny, llvm-commits

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

llvm-svn: 295012
2017-02-14 00:56:53 +00:00
Kuba Mracek 53fc965b48 Fixup for r293885: Update external.cc testcase to include the forgotten stdlib.h.
llvm-svn: 295002
2017-02-13 23:28:06 +00:00
Francis Ricci 7cda03e6d1 Use pthreads to manage thread-local storage on darwin for leak sanitizer
Summary:
__thread is supported on Darwin, but is implemented dynamically via
function calls to __tls_get_addr. This causes two issues when combined
with leak sanitizer, due to malloc() interception.

- The dynamic loader calls malloc during the process of loading
  the sanitizer dylib, while swapping a placeholder tlv_boostrap
  function for __tls_get_addr. This will cause tlv_bootstrap to
  be called in DisabledInThisThread() via the asan allocator.

- The first time __tls_get_addr is called, it allocates memory
  for the thread-local object, during which it calls malloc(). This
  call will be intercepted, leading to an infinite loop in the asan
  allocator, in which the allocator calls DisabledInThisThread,
  which calls tls_get_addr, which calls into the allocator again.

Reviewers: kcc, glider, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 294994
2017-02-13 22:20:07 +00:00
Francis Ricci 259ad9cf08 Disable darwin interception of non-darwin functions
Summary: Fixes build issues when compiling lsan for darwin.

Reviewers: kubamracek, kcc, rnk

Subscribers: llvm-commits

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

llvm-svn: 294984
2017-02-13 21:06:13 +00:00
Francis Ricci 7406f0f54f Add lsan function stubs for darwin
Summary:
This patch provides stubs for all of the lsan platform-specific
functions which need to be implemented for darwin. Currently
all of these functions are stubs, for the purpose of fixing
compilation.

Reviewers: kcc, glider, kubamracek

Subscribers: mgorny, llvm-commits

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

llvm-svn: 294983
2017-02-13 21:03:15 +00:00
Weiming Zhao a164f470e6 [Builtin][ARM] Fix subsf3vfp for non-HF target
Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: hans, aemerson

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

llvm-svn: 294886
2017-02-12 05:10:25 +00:00
NAKAMURA Takumi eb7dcc8c68 sancov.py: [Py3] Get rid of "print" statement. Use print() or write() instead.
Differential Revision: https://reviews.llvm.org/D27405

llvm-svn: 294880
2017-02-12 00:26:28 +00:00
Vitaly Buka 579ca307ab Re-submit r294826 "Fix -Wsign-compare" reverted in r294842 by mistake.
Fix -Wsign-compare - this might not be quite right, but preserves behavior

llvm-svn: 294868
2017-02-11 19:39:05 +00:00
Vitaly Buka d8230247c9 This reverts commits r294826 and r294781 as they break linking on powerpc.
Revert "Fix -Wsign-compare - this might not be quite right, but preserves behavior"
Revert "[XRay] Implement powerpc64le xray."

This reverts commit r294826.
This reverts commit r294781.

llvm-svn: 294842
2017-02-11 12:34:27 +00:00
David Blaikie 9730789ae6 Fix -Wsign-compare - this might not be quite right, but preserves behavior
llvm-svn: 294826
2017-02-11 06:07:59 +00:00
NAKAMURA Takumi a2eb926e8a sancov.py: [Py3] Use sys.stdout.buffer for bytes.
This is part of https://reviews.llvm.org/D27405

llvm-svn: 294812
2017-02-11 00:16:02 +00:00
Dimitry Andric c18de74165 Remove struct_rtentry_sz on FreeBSD
Summary:
Since struct rtentry is an internal kernel-only structure on FreeBSD,
and SIOCADDRT and SIOCDELRT are not supported anyway, stop including
socketvar.h and attempting to get at the definition of struct rtentry,
and move the line with struct_rtentry_sz to the SANIZER_LINUX block.

Reviewers: kcc, kutuzov.viktor.84, emaste

Reviewed By: kcc, emaste

Subscribers: emaste, llvm-commits, kubamracek

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

llvm-svn: 294806
2017-02-10 23:48:40 +00:00