Commit Graph

5808 Commits

Author SHA1 Message Date
Renato Golin 86474c7a1a [ASAN/AArch64] Disable forkpty tests until we can fix them
Reported in PR24400. Disable until it works, so we can keep the rest
tested and green.

llvm-svn: 244398
2015-08-08 15:47:17 +00:00
Evgeniy Stepanov aa91588b6c [asan] Try different values of the shadow gap start.
The number of unaccessible pages at the beginning of the address
space can differ between processes on the same machine. Try different
values at runtime to protect as much memory as possible.

llvm-svn: 244364
2015-08-07 22:38:44 +00:00
Evgeniy Stepanov 290d721070 [asan] Reduce shadow gap start on 32-bit Android.
This fixes an internal assertion failure when running out of
the address space in the large allocator.

llvm-svn: 244359
2015-08-07 21:17:46 +00:00
Renato Golin 827a40b944 [Compiler-RT] Disable TSAN on AArch64 temporarily
Until all problems with the buildbot can be identified and fixed.

llvm-svn: 244324
2015-08-07 15:41:43 +00:00
Renato Golin 2ab51bf13a [ASAN] Disable ManyThreadsTest in AArch64
This test was in an infinite loop in AArch64. We're investigating it
on PR24389, but I'm disabling it for now, so that we continue testing
everything else.

llvm-svn: 244316
2015-08-07 12:40:05 +00:00
Renato Golin 5da19695c5 [ASAN/AArch64] Make sure aarch64 is not stable-runtime
llvm-svn: 244263
2015-08-06 20:34:51 +00:00
Peter Collingbourne 01101b7b5f test: Use lld-link instead of lld-link2 as the LTO linker on Windows.
The old COFF linker has been removed and lld-link now refers to the new linker.

llvm-svn: 244243
2015-08-06 18:37:54 +00:00
Kostya Serebryany cc9fd3cbe9 [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM)
llvm-svn: 244234
2015-08-06 17:52:54 +00:00
Renato Golin 4ae2e1f575 Revert "[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski"
This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline.

llvm-svn: 244210
2015-08-06 12:42:46 +00:00
Reid Kleckner 27dddfc118 Add flag to request codeview debug info on Windows
Needed after fixing PR22032.

llvm-svn: 244162
2015-08-05 22:48:26 +00:00
Kostya Serebryany ce1799a83f [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski
llvm-svn: 244136
2015-08-05 21:19:11 +00:00
Renato Golin 12a7cdc3a0 [AArch64] Stable runtime required for proc maps test
llvm-svn: 244105
2015-08-05 19:45:26 +00:00
Alexey Samsonov 894d5821e7 [UBSan] Fix UBSan-vptr false positive.
Offset from vptr to the start of most-derived object can actually
be positive in some virtual base class vtables.

Patch by Stephan Bergmann!

llvm-svn: 244101
2015-08-05 19:35:46 +00:00
Kostya Serebryany b6804dbf43 [sanitizer] fix the Mac build (hopefully)
llvm-svn: 244099
2015-08-05 18:56:42 +00:00
Renato Golin 4481fe0f1f [AArch64] Fixes broken bot fue to TSAN patch
Patch by Adhemerval Zanella.

llvm-svn: 244088
2015-08-05 18:34:20 +00:00
Kostya Serebryany dd8b3952b8 [libFuzzer] add weak hooks for strcmp
llvm-svn: 244083
2015-08-05 18:20:54 +00:00
Kostya Serebryany 823e85c37e [libFuzzer/DFSan] add more __sanitizer callbacks to dfsan blacklist
llvm-svn: 244082
2015-08-05 18:20:15 +00:00
Hans Wennborg 92e6412f29 Try to fix sanitizer_win.cc compile error on 64-bit after r243895
llvm-svn: 244077
2015-08-05 17:55:26 +00:00
Adhemerval Zanella d7984710ae [tsan] Enable tsan for aarch64
This patch enabled TSAN for aarch64 with 39-bit VMA layout.  As defined by
tsan_platform.h the layout used is:

0000 4000 00 - 0200 0000 00: main binary
2000 0000 00 - 4000 0000 00: shadow memory
4000 0000 00 - 5000 0000 00: metainfo
5000 0000 00 - 6000 0000 00: -
6000 0000 00 - 6200 0000 00: traces
6200 0000 00 - 7d00 0000 00: -
7d00 0000 00 - 7e00 0000 00: heap
7e00 0000 00 - 7fff ffff ff: modules and main thread stack

Which gives it about 8GB for main binary, 4GB for heap and 8GB for
modules and main thread stack.

Most of tests are passing, with the exception of:

 * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for
   no support to make mmap page non-executable.

 * longjmp tests due missing specialized assembly routines.

These tests are xfail for now.

The only tsan issue still showing is:

  rtl/TsanRtlTest/Posix.ThreadLocalAccesses

Which still required further investigation.  The test is disable for
aarch64 for now.

llvm-svn: 244055
2015-08-05 15:17:59 +00:00
Adhemerval Zanella 975998bf6a [asan] Enable asan for aarch64
This patch enables asan for aarch64/linux.  It marks it as 'unstable-release',
since some tests are failing due either kernel missing support of non-executable
pages in mmap or environment instability (infinite loop in juno reference
boards).

It sets decorate_proc_maps test to require stable-release, since the test expects
the shadow memory to not be executable and the support for aarch64 is only
added recently by Linux (da141706aea52c1a9 - 4.0).

It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call
as a TLS optimization.

llvm-svn: 244054
2015-08-05 15:13:33 +00:00
Tanya Lattner bba51dc31f Update references to new lists.llvm.org mailing lists.
llvm-svn: 244002
2015-08-05 03:58:00 +00:00
Naomi Musgrave 2551b62931 Runtime check of poisoning derived class members.
Summary: Simple test case to verify that an instance of a derived class with virtual base is properly poisoned

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

modified test to be more concise, and check the local pointer to the destroyed object

revised test to not examine padding- only explicit object members

llvm-svn: 243913
2015-08-03 23:01:19 +00:00
Reid Kleckner 646386e779 [asan] Print VAs instead of RVAs for module offsets on Windows
Summary:
This is consistent with binutils and ASan behavior on other platforms,
and makes it easier to use llvm-symbolizer with WinASan. The
--relative-address flag to llvm-symbolizer is also no longer needed.

An RVA is a "relative virtual address", meaning it is the address of
something inside the image minus the base of the mapping at runtime.

A VA in this context is an RVA plus the "preferred base" of the module,
and not a real runtime address. The real runtime address of a symbol
will equal the VA iff the module is loaded at its preferred base at
runtime.

On Windows, the preferred base is stored in the ImageBase field of one
of the PE file header, and this change adds the necessary code to
extract it. On Linux, this offset is typically included in program and
section headers of executables.

ELF shared objects typically use a preferred base of zero, meaning the
smallest p_vaddr field in the program headers is zero. This makes it so
that PIC and PIE module offsets come out looking like RVAs, but they're
actually VAs. The difference between them simply happens to be zero.

Reviewers: samsonov, majnemer

Subscribers: llvm-commits

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

llvm-svn: 243895
2015-08-03 19:51:18 +00:00
Kuba Brecka fe17cee960 [asan] Fix dyld version detection on OS X
We currently have a dyld check in DyldNeedsEnvVariable that detects whether we are on a new OS X (10.11+) where we don't need to re-exec. For iOS simulator, we have a dlsym() hack that checks for a specific symbol, but this turns out to be fragile and problematic, because dlsym can sometimes call malloc(), which is not a good idea this early in the process runtime.

Let's instead of this do a direct comparison of dyld's version, which is exported in a public symbol `dyldVersionNumber`.

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

llvm-svn: 243879
2015-08-03 14:48:59 +00:00
Evgeniy Stepanov c86e7cfee9 [asan] Link tests with ld.gold on Android.
ld.bfd fails to find dependencies of asan runtime library w/o an
extra -rpath-link pointing to usr/lib under the sysroot. Gold does
not have this problem.

llvm-svn: 243802
2015-08-01 00:01:23 +00:00
Alexey Samsonov 25ac9311d0 [ASan] Fix two tests on FreeBSD: alloca.h is missing there.
llvm-svn: 243800
2015-07-31 23:57:06 +00:00
Alexey Samsonov 1e156011d1 [Sanitizer] Try to fix sanitizer_libc_test on FreeBSD.
llvm-svn: 243797
2015-07-31 23:02:51 +00:00
Evgeniy Stepanov fef29821a7 [asan] Fix wrong __ANDROID_API__ preprocessor condition.
This fixes report symbolization on L devices when building for API
level 21 or 22.

llvm-svn: 243787
2015-07-31 21:35:15 +00:00
Alexey Samsonov 356ac539c3 [CMake] Don't build libc++ with MSan-with-calls instrumentation.
Instead, refactor the build rules so that we build libc++ with MSan for
each supported architecture.

llvm-svn: 243785
2015-07-31 21:15:34 +00:00
Filipe Cabecinhas 698e8cf845 [UBSan] Test: Move coverage-levels.cc out of Linux directory
Summary:
This test is working on other platforms.

Reviewers: samsonov, emaste

Subscribers: llvm-commits

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

llvm-svn: 243771
2015-07-31 18:18:07 +00:00
Sergey Dmitrouk a2ce083d2d Fix __floatsitf() for negative input
Negative numbers were handled properly initially, but got broken
during addressing review, so none of them did actually work.  Issues:
 * Wrong negation.
 * Wrong exponent calculation.

llvm-svn: 243746
2015-07-31 13:32:09 +00:00
Daniel Sanders adf1fcc2a5 Re-commit r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
The builder remains broken in the same way without this patch so this patch is
innocent.

llvm-svn: 243744
2015-07-31 11:29:25 +00:00
Renato Golin 341d42c270 [AArch64|DFSAN] XPASS custom.cc, as it got fixed by r243686
llvm-svn: 243743
2015-07-31 10:50:29 +00:00
Daniel Sanders 923906a600 Revert r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
It's implicated in a buildbot failure and while the failure looks unrelated,
this commit is the only probably candidate in the blamelist.

llvm-svn: 243740
2015-07-31 09:04:37 +00:00
Kostya Serebryany 4fca6e8063 [libFuzzer] prepare for __sanitizer_cov_trace_switch in libFuzzer and sanitizer coverage. Also fix pedantic warnings
llvm-svn: 243721
2015-07-31 01:07:12 +00:00
Evgeniy Stepanov f3ed62f626 [asan] Fix signal() interception on 64-bit Android.
The bsd_signal() special case only applies to 32-bit Android targets.
Fixes AddressSanitizer.SignalTest on aarch64/android.

llvm-svn: 243714
2015-07-31 00:00:03 +00:00
Adhemerval Zanella 4e3b4ac241 [dfsan] Enable dfsan for aarch64
This patch enable DFSan for AArch64 (39-bit VMA).  All tests are passing
but:

 * test/dfsan/custom.cc

Due an invalid access in dl_iterate_phdr instrumentation (commenting out
this function make the testcase to pass).  The test is XFAIL for aarch64
for now.

llvm-svn: 243688
2015-07-30 21:13:21 +00:00
Daniel Sanders 043717d572 [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
Summary:
Using u64 as type for offset changes its value, changing starting address for map in file.
This patch solves Bug 24151, which raises issue while mapping file in mips32.

Patch by Mohit Bhakkad

Reviewers: dsanders, kcc

Subscribers: hans, llvm-commits, samsonov, nitesh.jain, sagar, bhushan, jaydeep

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

llvm-svn: 243686
2015-07-30 21:00:48 +00:00
Evgeniy Stepanov df5ba14731 [asan] Support arm64 devices in asan_device_setup.
llvm-svn: 243679
2015-07-30 20:07:13 +00:00
Naomi Musgrave 64a1bd9db8 testing for tail call optimization repression when sanitizing use-after-dtor
Summary: Verify that running in optimized mode while checking for use-after-dtor errors, does not generate tail call invocation of destructor. This avoids possible error where stack frame for the destructor is eliminated, making tracking down the errors more difficult.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

simplified test cases

updated line numbering on test

renamed test

llvm-svn: 243675
2015-07-30 18:46:18 +00:00
Nico Weber e099213481 Revert r243604, it (very likely) caused PR24312.
llvm-svn: 243615
2015-07-30 03:41:05 +00:00
Kostya Serebryany 66a75c54be [sanitizer] add a weak hook for strncmp interceptor, both to dfsan and other sanitizers. Hide the declaration and the calls in better macros
llvm-svn: 243610
2015-07-30 02:32:51 +00:00
Hans Wennborg 78bea23be0 [CMake] Pass -march=i686 when targeting i686 (PR24222)
Clang will not define __i686__, even when the target triple is i686,
without -march=i686.

With this patch, the compiler-rt build will successfully detect that
Clang can target i686.

The open_memstream.cc test is a little funny. Before my patch, it
was invoked with "-m32 -m64". To make it work after my -march
change, I had to add '-march=x86-64'.

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

llvm-svn: 243604
2015-07-30 01:45:17 +00:00
Kostya Serebryany d99f2b3291 [sanitizer] add a weak hook for memcmp interceptor, to be used primarily for fuzzing. More hooks will be added later. So far this is a Linux-only feature
llvm-svn: 243601
2015-07-30 01:19:17 +00:00
Alexey Samsonov ba46a47e07 [Sanitizer] Replace diagnostic string literal to workaround CMake 2.8 bug.
Let me tell you a story. Suppose you want to build your project (e.g. LLVM)
with CMake 2.8, Clang and AddressSanitizer. You also want to ensure that
Clang is fresh enough and check that CMAKE_CXX_COMPILER_VERSION is 3.1+.
This check would fail - CMake would fail to correctly calculate compiler
version if you pass CMAKE_CXX_FLAGS=-fsanitize=address.

The problem is funky compiler version calculation in
CMakeDetermineCompilerId.cmake module: it compiles the sample source
file with provided compiler and compile flags, runs "strings" and greps
for "INFO:" ASCII strings contained on the executable to fetch
"INFO:compiler", "INFO:compiler_version" etc. It limits the output of
grep to just 4 lines.

Unfortunately, if your executable was built with ASan, it would also contain
an ASCII string
  INFO: %s ignores mlock/mlockall/munlock/munlockall
and INFO:compiler_version string would never be parsed.

All of the above actually happened after r243574 when we tried to
configure libcxx with just-built Clang with TSan/MSan, and the version
check mentioned above failed in HandleLLVMOptions.cmake

(╯°□°)╯.~.┻━┻

llvm-svn: 243599
2015-07-30 00:50:40 +00:00
Kostya Serebryany c69bf1b4c0 [asan,tsan,msan] move the memcmp interceptor from asan/tsan to sanitizer_common. This may potentially lead to more reports from msan as it now sees the reads inside memcmp. To disable, use the flag intercept_memcmp=0. Likewise, it may potentially cause new races to appear due to more strict memcmp checking (flag strict_memcmp=1)
llvm-svn: 243595
2015-07-29 23:53:08 +00:00
Evgeniy Stepanov 1378c683e9 [asan] XFAIL 1 test on Android.
The test uses source file relative paths which does not work when the
test is executed on a remote device.

llvm-svn: 243564
2015-07-29 20:17:21 +00:00
Evgeniy Stepanov 4d81f86d97 [asan] Remove special case mapping on Android/AArch64.
ASan shadow on Android starts at address 0 for both historic and
performance reasons. This is possible because the platform mandates
-pie, which makes lower memory region always available.

This is not such a good idea on 64-bit platforms because of MAP_32BIT
incompatibility.

This patch changes Android/AArch64 mapping to be the same as that of
Linux/AAarch64.

llvm-svn: 243548
2015-07-29 18:22:25 +00:00
Peter Collingbourne ea087056ae CFI: Update tests for various bit vector sizes following lowerbitsets optzns.
Also add a test to ensure that this doesn't regress.

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

llvm-svn: 243547
2015-07-29 18:12:45 +00:00
Reid Kleckner e30c0d25e6 Delete unused <dbghelp.h> include
llvm-svn: 243529
2015-07-29 16:19:40 +00:00