Commit Graph

9353 Commits

Author SHA1 Message Date
Vitaly Buka 011aec2cf1 [builtins] Remove one more missed not-android
llvm-svn: 313441
2017-09-16 03:47:19 +00:00
Vitaly Buka 20d78186c2 [asan] Remove not-android
Replaced with !android

llvm-svn: 313440
2017-09-16 03:41:16 +00:00
Vitaly Buka 3d8c362f94 Revert "[ubsan] Update ubsan_interface.inc"
This brakes interface_symbols_linux.c test.

This reverts commit r313432.

llvm-svn: 313439
2017-09-16 03:26:12 +00:00
Vitaly Buka 581fbc61b2 [asan] Enable asan_and_llvm_coverage_test.cc on Android
Test just needs profile.

llvm-svn: 313438
2017-09-16 03:26:03 +00:00
Vitaly Buka 3ab63e34f6 [ubsan] Update ubsan_interface.inc
llvm-svn: 313432
2017-09-16 01:21:04 +00:00
Peter Collingbourne 823bb7eff6 Try to fix check-asan.
llvm-svn: 313423
2017-09-15 23:37:22 +00:00
Kostya Serebryany 80e9a6ccd1 [libFuzzer] add linux-specific test for gc-sections
llvm-svn: 313421
2017-09-15 23:07:18 +00:00
Kostya Serebryany ad66fefdca [libFuzzer] test fix
llvm-svn: 313411
2017-09-15 22:29:20 +00:00
Zachary Turner ce92db13ea Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

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

llvm-svn: 313407
2017-09-15 22:10:46 +00:00
Kostya Serebryany bcd78491ef [libFuzzer] minor refactoring, NFC
llvm-svn: 313406
2017-09-15 22:10:36 +00:00
Kostya Serebryany 97b8b2daff [libFuzzer] reduce the size of the merge control file by not dumping redundant features into it
llvm-svn: 313403
2017-09-15 22:02:26 +00:00
Peter Collingbourne d13d61fdb4 ubsan: Unbreak ubsan_cxx runtime library on Windows.
This was originally broken by r258744 which introduced a weak reference
from ubsan to ubsan_cxx. This reference does not work directly on
Windows because COFF has no direct concept of weak symbols. The fix is
to use /alternatename to create a weak external reference to ubsan_cxx.

Also fix the definition (and the name, so that we drop cached values)
of the cmake flag that controls whether to build ubsan_cxx. Now the
user-controllable flag is always on, and we turn it off internally
depending on whether we support building it.

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

llvm-svn: 313391
2017-09-15 20:24:12 +00:00
Peter Collingbourne a02c2eaf52 cfi: Enable ThinLTO tests on Windows.
We now avoid using absolute symbols on Windows (D37407 and D37408),
so this should work.

Fixes PR32770.

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

llvm-svn: 313379
2017-09-15 18:55:35 +00:00
Peter Collingbourne 7d218f7532 ubsan: Stop building the DLL version of the runtime library on Windows.
As far as I know we never use it.

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

llvm-svn: 313378
2017-09-15 18:54:37 +00:00
Petar Jovanovic 16807db3d4 [sanitizer][mips64] fix MIPS64 kernel_stat_to_stat()
This patch tackles with two issues:

Output stat st_[a|m|c]time fields were holding wrong values.
st_[a|m|c]time fields should have contained value of seconds and instead
these are filled with st_[a|m|c]time_nsec fields which hold nanoseconds.
Build fails for MIPS64 if SANITIZER_ANDROID. Recently <sys/stat.h> from
bionic introduced st_[a|m|c]time_nsec macros for compatibility with old NDKs
and those clashed with the field names of the <asm/stat.h> kernel_stat
structure.
To fix both issues and make sure sanitizer builds on all platforms, we must
un-define all compatibility macros and access the fields directly when
copying the 'time' fields.

Patch by Miodrag Dinic <miodrag.dinic@imgtec.com>

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

llvm-svn: 313360
2017-09-15 15:18:51 +00:00
Vitaly Buka 5fbd91df56 [ubsan] Extract GetStackTraceWithPcBpAndContext similar to asan version
llvm-svn: 313350
2017-09-15 08:11:53 +00:00
Dmitry Vyukov b63a3ab5bf tsan: respect LDFLAGS when build Go test
Reported at:
https://bugs.llvm.org/show_bug.cgi?id=27597

Some platforms need additional LDFLAGS when building the test
(e.g. -no-pie). Respect LDFLAGS.

llvm-svn: 313347
2017-09-15 06:51:37 +00:00
Vitaly Buka 3e45e10819 [sanitizer] Simplify checks in allow_user_segv.cc
llvm-svn: 313342
2017-09-15 04:48:02 +00:00
Vitaly Buka 461e8c1de8 [sanitizer] Use __sanitizer:: in CHECK_IMPL on both sides of assignment
llvm-svn: 313338
2017-09-15 04:05:15 +00:00
Zachary Turner 83dcb68468 Revert "[lit] Force site configs to run before source-tree configs"
This patch is still breaking several multi-stage compiler-rt bots.
I already know what the fix is, but I want to get the bots green
for now and then try re-applying in the morning.

llvm-svn: 313335
2017-09-15 02:56:40 +00:00
Vitaly Buka f716931bb2 [lsan] Disable clang-format on few RUN: statements
llvm-svn: 313321
2017-09-15 00:02:30 +00:00
Vitaly Buka 21ddc6219b [sanitizer] Move stack overflow and signal reporting from Asan into common.
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek

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

llvm-svn: 313310
2017-09-14 22:44:03 +00:00
Vitaly Buka 846a217bfc [asan] Remove ErrorStackOverflow
Summary:
The only difference from ErrorDeadlySignal is reporting code and it lives in
sanitizer common.

Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl, filcab

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 313309
2017-09-14 22:43:53 +00:00
Eric Fiselier 4aa0ecf86b [ASAN] Revert r313303 - Add macro denoting availability of new `__asan_handle_no_return()` function.
It was pointed out that compiler-rt has always defined the symbol, but only
recently added it to the public headers. Meaning that libc++abi can re-declare
it instead of needing this macro.

llvm-svn: 313306
2017-09-14 22:31:34 +00:00
Eric Fiselier 6892062f7c [ASAN] Add macro denoting availability of new `__asan_handle_no_return()` function.
Summary:
Libc++abi attempts to use the newly added `__asan_handle_no_return()` when built under ASAN. Unfortunately older versions of compiler-rt do not provide this symbol, and so libc++abi needs a way to detect if `asan_interface.h` actually provides the function.

This patch adds the macro `SANITIZER_ASAN_INTERFACE_HAS_HANDLE_NO_RETURN` which can be used to detect the availability of the new function.

Reviewers: phosek, kcc, vitalybuka, alekseyshl

Reviewed By: phosek

Subscribers: mclow.lists, cfe-commits

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

llvm-svn: 313303
2017-09-14 22:19:10 +00:00
Kostya Kortchinsky 26e689f0c5 [scudo] Fix bad request handling when allocator has not been initialized
Summary:
In a few functions (`scudoMemalign` and the like), we would call
`ScudoAllocator::FailureHandler::OnBadRequest` if the parameters didn't check
out. The issue is that if the allocator had not been initialized (eg: if this
is the first heap related function called), we would use variables like
`allocator_may_return_null` and `exitcode` that still had their default value
(as opposed to the one set by the user or the initialization path).

To solve this, we introduce `handleBadRequest` that will call `initThreadMaybe`,
allowing the options to be correctly initialized.

Unfortunately, the tests were passing because `exitcode` was still 0, so the
results looked like success. Change those tests to do what they were supposed
to.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 313294
2017-09-14 20:34:32 +00:00
Simon Dardis b2388c52e8 Revert "[mips] Fix sem_init_glibc test for MIPS."
The commit did not fix the failing test and instead exposed an inconsistency
between lsan and (t|m|a)san. I'm reverting the patch as it causes more failures
and the original patch had a '||' instead of '&&', which meant that an N32 build
of test would have be incorrect w.r.t. __HAVE_64B_ATOMICS for glibc.

This reverts commit r313248.

llvm-svn: 313291
2017-09-14 19:58:04 +00:00
Vitaly Buka 2cda290ec8 [asan] Disable two dynamic tests on armhf
This is not an regression. Tests are old and we just recently started to
run them on bots with dynamic runtime.

llvm-svn: 313283
2017-09-14 18:19:28 +00:00
Zachary Turner a0e55b6403 [lit] Force site configs to be run before source-tree configs
This patch simplifies LLVM's lit infrastructure by enforcing an ordering
that a site config is always run before a source-tree config.

A significant amount of the complexity from lit config files arises from
the fact that inside of a source-tree config file, we don't yet know if
the site config has been run.  However it is *always* required to run
a site config first, because it passes various variables down through
CMake that the main config depends on.  As a result, every config
file has to do a bunch of magic to try to reverse-engineer the location
of the site config file if they detect (heuristically) that the site
config file has not yet been run.

This patch solves the problem by emitting a mapping from source tree
config file to binary tree site config file in llvm-lit.py. Then, during
discovery when we find a config file, we check to see if we have a
target mapping for it, and if so we use that instead.

This mechanism is generic enough that it does not affect external users
of lit. They will just not have a config mapping defined, and everything
will work as normal.

On the other hand, for us it allows us to make many simplifications:

* We are guaranteed that a site config will be executed first
* Inside of a main config, we no longer have to assume that attributes
  might not be present and use getattr everywhere.
* We no longer have to pass parameters such as --param llvm_site_config=<path>
  on the command line.
* It is future-proof, meaning you don't have to edit llvm-lit.in to add
  support for new projects.
* All of the duplicated logic of trying various fallback mechanisms of
  finding a site config from the main config are now gone.

One potentially noteworthy thing that was required to implement this
change is that whereas the ninja check targets previously used the first
method to spawn lit, they now use the second. In particular, you can no
longer run lit.py against the source tree while specifying the various
`foo_site_config=<path>` parameters.  Instead, you need to run
llvm-lit.py.

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

llvm-svn: 313270
2017-09-14 16:47:58 +00:00
Simon Dardis c720ee5914 [mips] Fix sem_init_glibc test for MIPS.
glibc changed the implementation of semaphores for glibc 2.21 requiring
some target specific changes for this compiler-rt test. Modify the test
to cope with MIPS64 and do some future/correctness work by tying the
define for MIPS64 to exactly the define of __HAVE_64B_ATOMICS in glibc.

Contributions from Nitesh Jain.

Reviewers: eugenis

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

llvm-svn: 313248
2017-09-14 10:36:04 +00:00
Vitaly Buka 561f5408c9 [sanitizer] Mark allow_user_segv as XFAIL instead of UNSUPPORTED
llvm-svn: 313241
2017-09-14 08:15:13 +00:00
Vitaly Buka 62f02d5247 [sanitizer] Add empty Fuchsia and Win versions of StartReportDeadlySignal
llvm-svn: 313240
2017-09-14 08:14:56 +00:00
Vitaly Buka 2b077ecb91 [lsan] Extract GetStackTraceWithPcBpAndContext similar to asan version
llvm-svn: 313239
2017-09-14 08:14:38 +00:00
Vitaly Buka 9a4c73e20c [sanitizer] Move IsStackOverflow into SignalContext
llvm-svn: 313227
2017-09-14 03:23:02 +00:00
Vitaly Buka 5d53e050ca [sanitizer] Add BufferedStackTrace::Reset()
llvm-svn: 313226
2017-09-14 03:06:35 +00:00
Vitaly Buka 9c1fa35e5f [asan] Add const into ScarinessScoreBase::Print
llvm-svn: 313225
2017-09-14 03:06:20 +00:00
Vitaly Buka cd851f8085 [compiler-rt] Fix Windows build
llvm-svn: 313224
2017-09-14 02:58:18 +00:00
Vitaly Buka 73c101613d [compiler-rt] Cleanup SignalContext initialization
Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, dberris

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

llvm-svn: 313223
2017-09-14 02:48:41 +00:00
Vedant Kumar afe2bdd773 [ubsan-minimal] Filter targets to test by host arch on Darwin
This reverts r313189, and adds a use of darwin_filter_host_archs() for
ubsan-minimal.

llvm-svn: 313206
2017-09-13 21:57:47 +00:00
Zachary Turner 1929ffd452 Revert "Determine up front which projects are enabled."
This was intended to be a generic CMake solution to a problem
shared across several projects.  It turns out it doesn't interact
very well certain CMake configurations, and furthermore the
"problem" is actually not a problem, as the problematic code
is never executed to begin with.  So this really isn't solving
anything.

llvm-svn: 313191
2017-09-13 20:49:25 +00:00
Vedant Kumar cb835d3fdb [ubsan-minimal] Temporarily disable x86_64h testing on Darwin
We're seeing strange issues on the public GreenDragon Darwin bots which
we don't understand. x86_64h tests are still being run on pre-Haswell
bots despite the added checks in test/ubsan_minimal/lit.common.cfg,
which were verified on our internal bots.

I'm unable to ssh into the affected public bot, so for now am trying a
more aggressive check which disables all x86_64h testing for
ubsan-minimal on Darwin.

rdar://problem/34409349

llvm-svn: 313189
2017-09-13 20:46:26 +00:00
Vitaly Buka 72e8b55bab [asan] Fix Windows build
llvm-svn: 313177
2017-09-13 19:39:06 +00:00
Vitaly Buka dbde6f337c [compiler-rt] Use SignalContext in ErrorStackOverflow and ErrorDeadlySignal
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl, filcab

Subscribers: kubamracek, llvm-commits, dberris

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

llvm-svn: 313168
2017-09-13 18:30:16 +00:00
Vitaly Buka b215e90fb0 [compiler-rt] Add siginfo into SignalContext
Summary:
Information stored there is often been passed along with SignalContext.

Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits, dberris

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

llvm-svn: 313167
2017-09-13 18:30:06 +00:00
Vitaly Buka c40f5ceca0 [compiler-rt] Compile signal specific functions only for !SANITIZER_GO
llvm-svn: 313130
2017-09-13 08:10:16 +00:00
Vitaly Buka 6570c1d8b8 [compiler-rt] Add test for not fully implemented dump_registers
Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 313120
2017-09-13 06:33:43 +00:00
Vitaly Buka 20562abc1c Fix line breaks.
llvm-svn: 313118
2017-09-13 06:25:09 +00:00
Vitaly Buka ecc44ecdbc [compiler-rt] Move dump_instruction_bytes and dump_registers into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits, dberris

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

llvm-svn: 313117
2017-09-13 06:24:59 +00:00
Vitaly Buka d9d2a89e50 [compiler-rt] Move *Sanitizer:DEADLYSIGNAL printing into common part
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits, dberris

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

llvm-svn: 313115
2017-09-13 04:46:37 +00:00
Petr Hosek d8328f13ac [Fuchsia] Magenta -> Zircon
Fuchsia's lowest API layer has been renamed from Magenta to Zircon.

Patch by Roland McGrath

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

llvm-svn: 313106
2017-09-13 01:18:15 +00:00
Vitaly Buka 97ec1451a8 [compiler-rt] Move IsStackOverflow into sanitizer_posix_libcdep.cc to the rest
of instrumentation code.

llvm-svn: 313100
2017-09-13 00:24:44 +00:00
Vedant Kumar 5fb5094a4a [ubsan] Enable -fsanitize=function test on Darwin
Differential Revision: https://reviews.llvm.org/D37598

llvm-svn: 313097
2017-09-13 00:04:35 +00:00
Zachary Turner c7fc93946c Determine up front which projects are enabled.
Some projects need to add conditional dependencies on other projects.
compiler-rt is already doing this, and I attempted to add this to
debuginfo-tests when I ran into the ordering problem, that you can't
conditionally add a dependency unless that dependency's CMakeLists.txt
has already been run (which would allow you to say if (TARGET foo).

The solution to this seems to be to determine very early on the entire
set of projects which is enabled. This is complicated by the fact that
there are multiple ways to enable projects, and different tree layouts
(e.g. mono-repo, out of -tree, external, etc). This patch attempts to
centralize all of this into one place, and then updates compiler-rt to
demonstrate as a proof of concept how this can simplify code.

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

llvm-svn: 313091
2017-09-12 23:32:34 +00:00
Kostya Serebryany 93679be037 [libFuzzer] factor out some code into GetSizedFilesFromDir; NFC
llvm-svn: 313081
2017-09-12 21:58:07 +00:00
Vitaly Buka 2890105eab [tsan] Disable user_malloc test which fails glibc 2.24
llvm-svn: 313069
2017-09-12 20:03:39 +00:00
Vedant Kumar 57e8a2e504 [ubsan-minimal] Fix the x86_64h config check
Checking if config.target_arch is x86_64h doesn't work (the 'h' suffix
is dropped here, and I didn't account for that). Instead, check to see
if '-arch x86_64h' is in the cflags.

Tested on a pre-Haswell bot.

rdar://problem/34378605

llvm-svn: 313053
2017-09-12 17:32:25 +00:00
Max Moroz 1a33da2401 [libFuzzer] Fix lit files to make running tests more straightforward on Mac OS.
Summary:
Current implementation does not work if CMAKE_OSX_SYSROOT is not specified.

It silently generates invalid command with the following flags:

`-std=c++11 -lc++ -gline-tables-only -isysroot  -fsanitize=address,fuzzer`

and then fails with the following error:

```
warning: no such sysroot directory: '-fsanitize=address,fuzzer' [-Wmissing-sysroot]"
<...>/RepeatedBytesTest.cpp:5:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^~~~~~~~~~
1 error generated.
```

However, if you have Command Line Tools installed, you have '/usr/include' dir.
In that case, it is not necessary to specify isysroot path.

Also, with the patch, in case of '/usr/include' does not exist, the '-sysroot'
path would be resolved automatically in compiler-rt/cmake/base-config-ix.cmake.

For more context, see the comment at `compiler-rt/cmake/base-config-ix.cmake#L76`

Reviewers: kcc, george.karpenkov

Reviewed By: kcc, george.karpenkov

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

llvm-svn: 313033
2017-09-12 15:02:10 +00:00
Max Moroz 3f26dac416 [libfuzzer] Compare TotalNumberOfRuns with MaxNumberOfRuns when testing a memory leak.
Summary:
Fuzzer::TryDetectingAMemoryLeak may call ExecuteCallback which would
increment TotalNumberOfRuns, but it doesn't respect Options.MaxNumberOfRuns
value specified by a user.

Context: https://github.com/google/oss-fuzz/issues/822#issuecomment-328153970

Reviewers: kcc

Reviewed By: kcc

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

llvm-svn: 312993
2017-09-12 02:01:54 +00:00
Dean Michael Berris d56b90fb4c [XRay][compiler-rt] Use a single global volatile recursion guard for FDR handlers
Summary:
Before this change, the recursion guard for the flight data recorder
(FDR) mode handlers were independent. This change makes it so that when
a handler is already in the process of running and somehow the same or
another handler starts running -- say in a signal handler, while the
XRay handler is executing -- then we can use the same thread-local
recursion guard to stop the second handler from running.

Reviewers: kpw, eizan

Subscribers: llvm-commits

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

llvm-svn: 312992
2017-09-12 01:37:59 +00:00
Vitaly Buka f6fc68c7d1 [compiler-rt] Move IsStackOverflow from asan into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 312987
2017-09-12 00:44:23 +00:00
Vitaly Buka 7af8e4b146 Revert "[compiler-rt] Move IsStackOverflow from asan into sanitizer_common"
Windows is broken.

This reverts commit r312951

llvm-svn: 312984
2017-09-12 00:14:33 +00:00
Vedant Kumar 661e2422d7 [ubsan-minimal] Disable x86_64h tests when not on x86_64h
llvm-svn: 312982
2017-09-12 00:01:13 +00:00
Evgeniy Stepanov 93f2edc215 Runtime detection of android_set_abort_message.
Summary:
Use runtime detection (with a weak-undef symbol) of
android_set_abort_message availability. Android NDK provides a single
version of the ASan runtime library to be used for any target API
level, which makes compile-time feature detection impossible (the
library itself is built at API level 9).

Reviewers: vitalybuka

Subscribers: srhines, llvm-commits, kubamracek

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

llvm-svn: 312973
2017-09-11 23:27:58 +00:00
Vedant Kumar 7669679e82 [ubsan-minimal] Enable on Darwin
Testing: check-ubsan-minimal

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

llvm-svn: 312959
2017-09-11 21:37:53 +00:00
Vitaly Buka 54cc3603de [ubsan] Make ubsan version of __sanitizer_print_stack_trace consistent with other sanitizers
Summary: Other sanitizers include __sanitizer_print_stack_trace into stack trace.

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 312954
2017-09-11 21:25:22 +00:00
Vitaly Buka bdcc82d7ed [ubsan] Save binary name before parsing options
Summary: To parser "include" we may need to do binary name substitution.

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 312953
2017-09-11 21:13:06 +00:00
Vitaly Buka 4084a583d9 Revert "[ubsan] Save binary name before parsing options"
Patch was corrupted by rebase.

This reverts commit r312933

llvm-svn: 312952
2017-09-11 21:12:43 +00:00
Vitaly Buka ecba46d0e6 [compiler-rt] Move IsStackOverflow from asan into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 312951
2017-09-11 21:00:24 +00:00
Vitaly Buka 36266b6b0d [compiler-rt] Cleanup decorators
Summary:
Removed redundant End*() methods which defined same way.
Removed redundant Warning() methods.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits, dberris

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

llvm-svn: 312950
2017-09-11 20:55:49 +00:00
Kostya Kortchinsky 040c211bc4 [scudo] Fix improper TSD init after TLS destructors are called
Summary:
Some of glibc's own thread local data is destroyed after a user's thread local
destructors are called, via __libc_thread_freeres. This might involve calling
free, as is the case for strerror_thread_freeres.
If there is no prior heap operation in the thread, this free would end up
initializing some thread specific data that would never be destroyed properly
(as user's pthread destructors have already been called), while still being
deallocated when the TLS goes away. As a result, a program could SEGV, usually
in __sanitizer::AllocatorGlobalStats::Unregister, where one of the doubly linked
list links would refer to a now unmapped memory area.

To prevent this from happening, we will not do a full initialization from the
deallocation path. This means that the fallback cache & quarantine will be used
if no other heap operation has been called, and we effectively prevent the TSD
being initialized and never destroyed. The TSD will be fully initialized for all
other paths.

In the event of a thread doing only frees and nothing else, a TSD would never
be initialized for that thread, but this situation is unlikely and we can live
with that.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 312939
2017-09-11 19:59:40 +00:00
Vitaly Buka 87d1f9ce93 [asan] Include asan-dynamic into check-all
Summary: It's adds just 1k to about 45k tests.

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, mgorny, llvm-commits

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

llvm-svn: 312937
2017-09-11 19:41:17 +00:00
Vitaly Buka 57ff314368 [ubsan] Save binary name before parsing options
Summary: To parser "include" we may need to do binary name substitution.

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 312933
2017-09-11 18:32:51 +00:00
Vitaly Buka f8e944121e [asan] Fix tests broken by r312858
llvm-svn: 312872
2017-09-09 20:07:45 +00:00
Vitaly Buka fd5960a653 [ubsan] Enable UBsan in sanitizer_common tests
Summary:
Failing tests just marked as UNSUPPORTED or XFAIL.
Some of them can be easily supported, but I'll do this in separate patches.

Reviewers: eugenis, alekseyshl

Subscribers: srhines, kubamracek, llvm-commits, mgorny

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

llvm-svn: 312860
2017-09-09 06:10:58 +00:00
Vitaly Buka b4f2d13dc6 [compiler-rt] Move allow_user_segv.cc into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis

Subscribers: kubamracek, dberris, llvm-commits

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

llvm-svn: 312859
2017-09-09 06:04:23 +00:00
Vitaly Buka e7e7194a73 [asan] Use more generic string in error message
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 312858
2017-09-09 05:58:52 +00:00
Kostya Serebryany 25d6b95679 [libFuzzer] remove a couple of reduntant includes
llvm-svn: 312848
2017-09-09 00:56:34 +00:00
Francis Ricci f36d34a4d4 Revert "Prevent DCE on __lsan_is_turned_off and re-enable test case"
This doesn't fix the failing test. Leave in the comment and the
attribute, since the used attribute is still required.

This partially reverts commit r312824

llvm-svn: 312827
2017-09-08 21:09:43 +00:00
Francis Ricci 4a327e1c5c Prevent DCE on __lsan_is_turned_off and re-enable test case
Summary:
-dead_strip in ld64 strips weak interface symbols, which I believe
is most likely the cause of this test failure. Re-enable after marking the interface
function as used.

Reviewers: alekseyshl, kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 312824
2017-09-08 19:43:53 +00:00
Kostya Serebryany 754e584076 [libFuzzer] simplify CustomCrossOverTest even more
llvm-svn: 312697
2017-09-07 05:33:05 +00:00
Kostya Serebryany 57c03648e1 [libFuzzer] simplify CustomCrossOverTest a bit more
llvm-svn: 312695
2017-09-07 05:23:23 +00:00
Kostya Serebryany d0386fac26 [libFuzzer] simplify and re-enable CustomCrossOverTest
llvm-svn: 312689
2017-09-07 02:04:06 +00:00
Vedant Kumar b6d2fe5c88 [cmake] Work around more -Wunused-driver-argument warnings
add_compiler_rt_object_libraries should strip out the -msse3 option on
non-macOS Apple platforms.

llvm-svn: 312688
2017-09-07 01:36:47 +00:00
Evgeniy Stepanov 7d1ab555ae [asan] Add a note to shadow memory setup error.
Point to https://github.com/google/sanitizers/issues/856 as a possible cause of the failed mapping.

llvm-svn: 312687
2017-09-07 01:35:59 +00:00
Kostya Kortchinsky 6bc7b26d18 [scudo] getauxval alternative for Android
Summary:
`getauxval` was introduced with API level 18. In order to get things to work
at lower API levels (for the toolchain itself which is built at 14 for 32-bit),
we introduce an alternative implementation reading directly from
`/proc/self/auxv`.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, llvm-commits

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

llvm-svn: 312653
2017-09-06 17:51:32 +00:00
Simon Dardis 10d0ae85dd [compiler-rt][xray][mips] Mark some tests as unsupported.
Thesee tests require the integrated assembler which is still in
development / testing for MIPS64. GAS doesn't understand the
section directives produced by XRay, so marking the relevant
tests as unsupported.

llvm-svn: 312628
2017-09-06 10:17:29 +00:00
Evgeniy Stepanov 9566d28997 [msan] Remove a stale fixme (NFC).
It was fixed in 312576.

llvm-svn: 312597
2017-09-06 00:28:52 +00:00
Petr Hosek 4f4bdc3c20 [sanitizer_common][Fuchsia] Update Fuchsia sanitizer markup
Include URLs to the markup format specification in code comments.
Use sanitizer markup in the sancov message about a dump just produced.

Patch by Roland McGrath

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

llvm-svn: 312596
2017-09-06 00:00:46 +00:00
Kostya Serebryany 79cdf36a2c [libFuzzer] remporary disable an unstable test
llvm-svn: 312593
2017-09-05 23:45:54 +00:00
Evgeniy Stepanov 29c7487167 Remove ld.config.txt for Android O.
ld.config.txt defines linker namespaces in a way that is incompatible
with ASan. Remove the file when installing ASan on an Android O
(8.0.x) device.

Patch by Jiyong Park.

llvm-svn: 312581
2017-09-05 21:51:20 +00:00
Evgeniy Stepanov 8b80b328d1 [msan] Check sigset_t and sigaction arguments.
Summary:
Check sigset_t arguments in ppoll, sig*wait*, sigprocmask
interceptors, and the entire "struct sigaction" in sigaction. This
can be done because sigemptyset/sigfullset are intercepted and
signal masks should be correctly marked as initialized.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 312576
2017-09-05 21:08:56 +00:00
Evgeniy Stepanov 00dedc208f (NFC) Fix the use of do{}while(0) in a macro.
llvm-svn: 312396
2017-09-02 00:09:57 +00:00
David Blaikie 387d0964ba Fix constant-logical-operand warning.
llvm-svn: 312394
2017-09-01 23:57:34 +00:00
Vedant Kumar f5addb18f2 [cmake] Remove accidentally committed warning messages
llvm-svn: 312393
2017-09-01 23:49:22 +00:00
Vedant Kumar 6b1de0e673 [cmake] Work around -Wunused-driver-argument warnings
Fix the Darwin logic so that -msse3 is only used on macOS, and
-fomit-frame-pointer is not used on armv7/armv7k/armv7s.

llvm-svn: 312390
2017-09-01 23:23:59 +00:00
Kostya Serebryany 07490f8415 [libFuzzer] use more iterations for a test
llvm-svn: 312356
2017-09-01 19:45:08 +00:00
George Karpenkov 2928375cd2 [libFuzzer] Enable 8-bit counters test on macOS
llvm-svn: 312339
2017-09-01 17:13:26 +00:00
Evgeniy Stepanov adfa21087f Revert "[ubsan] Make check-ubsan depend on check-ubsan-minimal."
Breaks buildbot with
CMake Error at projects/compiler-rt/test/CMakeLists.txt:76 (add_dependencies):
  The dependency target "check-ubsan-minimal" of target "check-ubsan" does
  not exist.

llvm-svn: 312295
2017-08-31 23:34:01 +00:00
Evgeniy Stepanov a865658a74 [ubsan] Make check-ubsan depend on check-ubsan-minimal.
Summary: This way we don't need to add check-ubsan-minimal steps to all the bots.

Reviewers: vitalybuka

Subscribers: mgorny, llvm-commits

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

llvm-svn: 312291
2017-08-31 22:26:34 +00:00
Kostya Serebryany 082e9a7528 [libFuzzer] tolerate missing files when loading the seed corpus
llvm-svn: 312269
2017-08-31 19:17:15 +00:00
Alex Lorenz 341317fda4 Revert r312240
The buildbots have shown that -Wstrict-prototypes behaves differently in GCC
and Clang so we should keep it disabled until Clang follows GCC's behaviour

llvm-svn: 312246
2017-08-31 15:51:23 +00:00
Alex Lorenz fbac1ae062 Build LLVM with -Wstrict-prototypes enabled
Clang 5 supports -Wstrict-prototypes. We should use it to catch any C
declarations that declare a non-prototype function.

rdar://33705313

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

llvm-svn: 312240
2017-08-31 13:23:24 +00:00
Martin Storsjo 376cce2ec8 [cmake] Fix the list of arm32 architectures
This was accidentally changed in SVN r311924, which was only
supposed to change the behaviour for x86.

llvm-svn: 312230
2017-08-31 10:01:36 +00:00
Evgeniy Stepanov 84614f851c [ubsan] Give ubsan-minimal lit test suite a name.
Otherwise llvm-lit -v prints this:
PASS: <unnamed> :: TestCases/recover-dedup-limit.cpp (1 of 3)
PASS: <unnamed> :: TestCases/recover-dedup.cpp (2 of 3)
PASS: <unnamed> :: TestCases/uadd-overflow.cpp (3 of 3)

llvm-svn: 312203
2017-08-31 00:54:10 +00:00
Dean Michael Berris 1704f6289a [XRay][compiler-rt] Enable the XRay compiler-rt unit tests.
Summary:
Before this change we seemed to not be running the unit tests, and therefore we
set out to run them. In the process of making this happen we found a divergence
between the implementation and the tests.

This includes changes to both the CMake files as well as the implementation and
headers of the XRay runtime. We've also updated documentation on the changed
functions.

Reviewers: kpw, eizan

Subscribers: mgorny, llvm-commits

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

llvm-svn: 312202
2017-08-31 00:50:12 +00:00
Kamil Rytarowski d92f3982ce Finalize ASAN/NetBSD
Summary:
This revision contains various cleanups.

Sponsored by <The NetBSD Foundation>

Reviewers: kcc, vitalybuka, joerg, eugenis

Reviewed By: kcc

Subscribers: emaste, srhines, llvm-commits, kubamracek, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 312188
2017-08-30 23:02:36 +00:00
Matt Morehouse 034126e507 [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Only enable on Linux.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya

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

llvm-svn: 312185
2017-08-30 22:49:31 +00:00
Kamil Rytarowski 06f2f80791 Add NetBSD support in lsan_interceptors.cc
Summary:
NetBSD is a modern POSIX-like UNIX-like Operating System derived from 4.4BSD/386BSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, dvyukov

Reviewed By: kcc

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 312184
2017-08-30 22:47:05 +00:00
Kamil Rytarowski 8da2722a9f Add preliminary NetBSD support in libfuzzer
Summary:
This code already works and passes some number of tests.

There is need to finish remaining sanitizers to get better coverage.

Many tests fail due to overly long file names of executables (>31).
This is a current shortcoming of the NetBSD 8(beta) kernel, as
certain functions can fail (like retrieving file name of executable).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, george.karpenkov

Reviewed By: kcc

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 312183
2017-08-30 22:44:11 +00:00
Kamil Rytarowski 5ec32d4f96 Add NetBSD support in tsan_interceptors.cc
Summary:
NetBSD is a POSIX-like BSD Operating System.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, dvyukov, eugenis

Reviewed By: dvyukov

Subscribers: srhines, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 312160
2017-08-30 19:41:30 +00:00
Kamil Rytarowski 08e525ea06 Add NetBSD support in test/tsan/thread_name*.cc
Summary:
A snipped from the documentation of thread_setname_np(3):

NAME
     pthread_getname_np - get and set descriptive name of a thread

LIBRARY
     POSIX Threads Library (libpthread, -lpthread)

SYNOPSIS
     #include <pthread.h>

     int
     pthread_getname_np(pthread_t thread, char *name, size_t len);

     int
     pthread_setname_np(pthread_t thread, const char *name, void *arg);

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc

Reviewed By: dvyukov

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 312159
2017-08-30 19:40:47 +00:00
Vedant Kumar 637e321e35 [fuzzer] Don't enable tests when the fuzzer isn't built
Should fix:
http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1527

llvm-svn: 312157
2017-08-30 19:29:11 +00:00
Francis Ricci e3b018f6e5 [builtins] Prevent duplicate definitions for overridden functions
Summary:
Some architecture-specific function overrides (for example, i386/ashrdi3.S)
duplicate generic functions (in that case, ashrdi3.c). Prevent duplicate definitions
by filtering out the generic files before compiling.

Reviewers: compnerd, beanz

Subscribers: llvm-commits, mgorny

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

llvm-svn: 312140
2017-08-30 17:12:57 +00:00
George Karpenkov 5a2898ae03 Fix for TSan unit-tests:
Previous refactoring has left unit-tests in a buggy state,
where they were not launched at all.

llvm-svn: 312094
2017-08-30 02:24:31 +00:00
Evgeniy Stepanov c6daf73c72 Restore clang_rt library name on i686-android.
Summary:
Recent changes canonicalized clang_rt library names to refer to
"i386" on all x86 targets. Android historically uses i686.

This change adds a special case to keep i686 in all clang_rt
libraries when targeting Android.

Reviewers: hans, mgorny, beanz

Subscribers: srhines, cfe-commits, llvm-commits

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

llvm-svn: 312048
2017-08-29 22:12:31 +00:00
Matt Morehouse ba2e61b357 Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
This reverts r312026 due to bot breakage.

llvm-svn: 312047
2017-08-29 21:56:56 +00:00
Kostya Kortchinsky 913d038b29 Enable GetRandom for Fuchsia sanitizer.
Summary: Adds a true implementation of GetRandom, to be used by scudo_utils.h.

Reviewers: mcgrathr, phosek, kcc, vitalybuka, cryptoad

Reviewed By: mcgrathr

Subscribers: kubamracek

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

llvm-svn: 312046
2017-08-29 21:52:56 +00:00
Vitaly Buka 07196d3145 [asan] Add use-after-scope test which fails because of bug in clang
Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 312039
2017-08-29 21:23:44 +00:00
Matt Morehouse 2edac86cdb Re-enable stack depth instrumentation on Windows.
Specified tls_model attribute properly. Should compile on Windows
now.

llvm-svn: 312037
2017-08-29 21:15:33 +00:00
Evgeniy Stepanov 3bafa546d0 Disable ubsan-minimal on Darwin.
Should un-break this bot:
http://green.lab.llvm.org/green//job/clang-stage1-configure-RA_build/38264/consoleFull

llvm-svn: 312036
2017-08-29 21:15:08 +00:00
Kostya Serebryany 4faeb87ebe [libFUzzer] change the way we load the seed corpora: instead of loading all files and these executing all files, load and execute them one-by-one. This should reduce the memory usage in many cases
llvm-svn: 312033
2017-08-29 20:51:24 +00:00
Matt Morehouse c29c2c9b0c Disable stack depth tracking on Windows.
Windows doesn't support the tls_model attribute.

llvm-svn: 312032
2017-08-29 20:44:41 +00:00
Evgeniy Stepanov 6d2b6f0a5f Minimal runtime for UBSan.
Summary:
An implementation of ubsan runtime library suitable for use in production.

Minimal attack surface.
* No stack traces.
* Definitely no C++ demangling.
* No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general.
* as simple as possible

Minimal CPU and RAM overhead.
* Source locations unnecessary in the presence of (split) debug info.
* Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at.
* above two items save 3% binary size.

When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt.

Reviewers: pcc, kcc

Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits

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

llvm-svn: 312029
2017-08-29 20:03:51 +00:00
Matt Morehouse 2ad8d948b2 [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Disable stack depth tracking on Mac.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya

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

llvm-svn: 312026
2017-08-29 19:48:12 +00:00
Dean Michael Berris eca980396e [XRay][compiler-rt][NFC] Refactor global TLS variables behind an accessor function.
Summary:
This change hides all the initialization of thread_local variables used
by the XRay FDR mode implementation behind a function call. This makes
initialization of thread-local data to be done lazily, instead of
eagerly when they're done as globals. It also gives us an isolation
mechanism if/when we want to change the TLS implementation from using
the C++ thread_local keyword, for something more ad-hoc (potentialy
using pthread directly) on some platforms or set-ups where we cannot use
the C++ thread_local variables.

Reviewers: kpw, eizan

Subscribers: llvm-commits

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

llvm-svn: 311997
2017-08-29 12:21:45 +00:00
Kostya Serebryany 3a8e3c8336 [libFuzzer] refactoring: move reading the seed corpus closer to where it's consumed; NFC
llvm-svn: 311972
2017-08-29 02:05:01 +00:00
Kamil Rytarowski 802afb4c0a Shorten filenames of tests (-with-calls to -calls)
Summary:
The NetBSD's 8(beta) versions of kernel functions to retrieve
program name (vnode to path translator) and process memory
map have internal limit of processing filenames with maximum
of 31 characters.

Filenames like Asan-x86_64-with-calls-Noinst-Test break this
limit and affect tests. Rename "-with-calls" to "-calls".

This changes fixes all issues for the Address Sanitizer test
target (check-asan) on the current NetBSD support caused
by long filenames.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, fjricci, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 311966
2017-08-29 01:03:13 +00:00
Kostya Serebryany c07008653c [libFuzzer] allow -print_funcs=N: N is the max number of new covered function printed
llvm-svn: 311945
2017-08-28 22:52:22 +00:00
Kamil Rytarowski 357bbc57f9 Add NetBSD ASAN shadow mapping for x86-64
Summary:
The maximal virtual address on NetBSD/amd64 is 0x7f7ffffff000.
Define shadow offset 0x400000000000 (1ULL << 46).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, fjricci, kcc, eugenis, pcc

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 311937
2017-08-28 21:41:04 +00:00
Kamil Rytarowski 5abb0ac6ea Add NetBSD specific version of sanitizer_platform_limits_posix
Summary:
NetBSD is an Open-Source POSIX-like BSD Operating System.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, filcab, fjricci

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 311933
2017-08-28 21:03:23 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

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

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
George Karpenkov 52a3e48e9f [libFuzzer] Exclude a test failing on OS X.
llvm-svn: 311916
2017-08-28 20:10:30 +00:00
George Karpenkov dacfd66dfd [libFuzzer] Fix libFuzzer flag propagation for standalone builds.
Under the previous configurations, flags from SANITIZER_COMMON were not
propagated for standalone builds.

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

llvm-svn: 311912
2017-08-28 19:44:19 +00:00
George Karpenkov 16a05f2dfe Proper dependency check for clang in compiler_rt.
- Not having a dependency does not work in standalone build, as Clang does not exist.
 - if (TARGET clang) check is useless, as it is order-dependent,
   and Clang may not be registered yet.

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

llvm-svn: 311911
2017-08-28 19:39:05 +00:00
Kostya Kortchinsky 476f21d87e [sanitizer] Re-introduce kUseSeparateSizeClassForBatch for the 32-bit Primary
Summary:
Currently `TransferBatch` are located within the same memory regions as
"regular" chunks. This is not ideal for security: they make for an interesting
target to overwrite, and are not protected by the frontend (namely, Scudo).

To solve this, we re-introduce `kUseSeparateSizeClassForBatch` for the 32-bit
Primary allowing for `TransferBatch` to end up in their own memory region.
Currently only Scudo would use this new feature, the default behavior remains
unchanged. The separate `kBatchClassID` was used for a brief period of time
previously but removed when the 64-bit ended up using the "free array".

Reviewers: alekseyshl, kcc, eugenis

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 311891
2017-08-28 15:20:02 +00:00
Dean Michael Berris 66faaceeb1 [XRay][compiler-rt] Return the pointer associated with the function instead of the sled
Summary:
XRay has erroneously been returning the address of the first sled in the
instrumentation map for a function id instead of the (runtime-relocated)
functison address. This causes confusion and issues for applications
where:

  - The first sled in the function may not be an entry sled (due to
    re-ordering or some other reason).
  - The caller attempts to find a symbol associated with the pointer at
    runtime, because the sled may not be exactly where the function's
    known address is (in case of inlined functions or those that have an
    external definition for symbols).

This fixes http://llvm.org/PR34340.

Reviewers: eizan

Subscribers: llvm-commits

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

llvm-svn: 311871
2017-08-28 03:58:23 +00:00
Petr Hosek 00b760ed48 [asan] Move __asan_handle_no_return to public header
Heretofore asan_handle_no_return was used only by interceptors,
i.e. code private to the ASan runtime. However, on systems without
interceptors, code like libc++abi is built with -fsanitize=address
itself and should call asan_handle_no_return directly from
__cxa_throw so that no interceptor is required.

Patch by Roland McGrath

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

llvm-svn: 311869
2017-08-28 00:45:12 +00:00
George Karpenkov bebcbfb46d [libFuzzer] Use custom allocators for STL containers in libFuzzer.
Avoids ODR violations causing spurious ASAN warnings.

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

llvm-svn: 311866
2017-08-27 23:20:09 +00:00
Michal Gorny 7298595a2c Revert r311842 - [cmake] Remove i686 target that is duplicate to i386
The required change in clang is being reverted because of the Android
build bot failure.

llvm-svn: 311859
2017-08-27 20:37:06 +00:00
Michal Gorny 34ca7168ae [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

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

llvm-svn: 311842
2017-08-27 07:44:41 +00:00
George Karpenkov 24069a0424 Revert "[libFuzzer] Use custom allocators for STL containers in libFuzzer"
This reverts commit 3539efc2f2218dba2bcbd645d0fe276f2b5cf588.

llvm-svn: 311831
2017-08-26 17:50:35 +00:00
George Karpenkov d50410bfb1 [libFuzzer] Use custom allocators for STL containers in libFuzzer
Avoids ODR violations causing spurious ASAN container overflow warnings.

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

llvm-svn: 311830
2017-08-26 17:17:37 +00:00
Evgeniy Stepanov c28cedcfe8 Automatically pick up new sanitizers in cmake.
Change the default of COMPILER_RT_SANITIZERS_TO_BUILD to "all" in
order to automatically pick up new sanitizers in existing build
trees.

llvm-svn: 311824
2017-08-26 01:13:33 +00:00
Matt Morehouse 6ec7595b1e Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
This reverts r311801 due to a bot failure.

llvm-svn: 311803
2017-08-25 22:01:21 +00:00
Matt Morehouse f42bd31323 [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, llvm-commits, hiraditya

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

llvm-svn: 311801
2017-08-25 21:18:29 +00:00
Kostya Serebryany 09c4161029 [libFuzzer] prepare tests for switching from -fsanitize-coverage=trace-pc-guard to -fsanitize-coverage=inline-8bit-counters
llvm-svn: 311798
2017-08-25 20:20:46 +00:00
Kostya Serebryany 2eef816e6e [libFuzzer] add -print_funcs=1 (on bey default): print newly discovered functions during fuzzing
llvm-svn: 311797
2017-08-25 20:09:25 +00:00
Max Moroz 1dbb7578ff [compiler-rt] Test commit: remove some trailing white spaces.
Summary: [compiler-rt] Test commit: remove some trailing white spaces.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: dberris

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

llvm-svn: 311796
2017-08-25 19:36:30 +00:00
Kostya Serebryany d3e4b7e24a [sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC
llvm-svn: 311794
2017-08-25 19:29:47 +00:00
Dmitry Vyukov 780b462840 tsan: fix darwin build
Runtime hooks do not seem to work on darwin. The test failed on builder:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/34882/consoleFull#7286766538254eaf0-7326-4999-85b0-388101f2d404
Move the test to Linux dir.

llvm-svn: 311776
2017-08-25 15:18:48 +00:00
Dmitry Vyukov 714ac2e781 tsan: don't pass bogus PCs to __tsan_symbolize_external
See the added comment for an explanation.

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

llvm-svn: 311768
2017-08-25 08:52:28 +00:00
Adrian Prantl 1d6ae01d4c Revert "Add Clang dependency to the check for Clang C++ headers."
This temporarily reverts commit r311733, because of bot breakage.
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/38139/consoleFull#-256426522e9a0fee5-ebcc-4238-a641-c5aa112c323e

llvm-svn: 311757
2017-08-25 02:36:36 +00:00
Sean Fertile 6e5e0bcd80 [cfi] only add cfi tests on supported arches.
Differential Revision:  https://reviews.llvm.org/D35101

llvm-svn: 311745
2017-08-25 01:50:53 +00:00
George Karpenkov cdb8341e62 Add Clang dependency to the check for Clang C++ headers.
The problem is that CMake is mostly imperative and the result of
processing "if (TARGET blah)" checks depends on the order of import of
CMake files.
In this case, "projects" folder is registered before "tools",
and calling "CheckClangHeaders" [renamed to have a better name]
errors out without even giving Clang a chance to be built.

This, in turn, leads to libFuzzer bot failures in some circumstances on
some machines (depends on whether LIT or UNIT tests are scheduled
first).

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

llvm-svn: 311733
2017-08-24 23:43:17 +00:00
Hans Wennborg c7d8b01774 Mark allocator_oom_test.cc unsupported on arm & aarch64 (PR33972)
The buildbots don't seem to like it.

llvm-svn: 311674
2017-08-24 17:00:36 +00:00
Xinliang David Li c7c5303fa3 [Profile] create a copy of profile file name from environment
Original patch by Max Moroz.

Differential Revsion: http://reviews.llvm.org/D36903

llvm-svn: 311607
2017-08-23 21:39:33 +00:00
Oleg Ranevskyy 6c75b51bb5 [ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to non-AEABI functions on HF targets
Summary:
This is a patch for PR34167.

On HF targets functions like `__{eq,lt,le,ge,gt}df2` and `__{eq,lt,le,ge,gt}sf2` expect their arguments to be passed in d/s registers, while some of the AEABI builtins pass them in r registers.

Reviewers: compnerd, peter.smith, asl

Reviewed By: peter.smith, asl

Subscribers: peter.smith, aemerson, dberris, javed.absar, llvm-commits, asl, kristof.beyls

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

llvm-svn: 311555
2017-08-23 14:26:31 +00:00
Dean Michael Berris 71f88a955d [XRay][compiler-rt] Support sled versioning for custom event sleds
Summary:
This change introduces versions to the instrumentation map entries we
emit for XRay instrumentaiton points. The status quo for the version is
currently set to 0 (as emitted by the LLVM back-end), and versions will
count up to 255 (unsigned char).

This change is in preparation for supporting the newer version of the
custom event sleds that will be emitted by the LLVM compiler.

While we're here, we take the opportunity to stash more registers and
align the stack properly in the __xray_CustomEvent trampoline.

Reviewers: kpw, pcc, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 311524
2017-08-23 04:42:37 +00:00
Hans Wennborg c5e7cee0a2 [profile] Fix warning about C++ style comment in C file
llvm-svn: 311496
2017-08-22 21:54:37 +00:00
Hans Wennborg 67ef655026 [esan] Use stack_t instead of struct sigaltstack (PR34011)
The struct tag is going away in soon-to-be-released glibc 2.26 and the
stack_t typedef seems to have been there forever.

Patch by Bernhard Rosenkraenzer!

llvm-svn: 311495
2017-08-22 21:54:37 +00:00
Matt Morehouse b1fa8255db [SanitizerCoverage] Optimize stack-depth instrumentation.
Summary:
Use the initialexec TLS type and eliminate calls to the TLS
wrapper.  Fixes the sanitizer-x86_64-linux-fuzzer bot failure.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 311490
2017-08-22 21:28:29 +00:00
George Karpenkov 6bb45f793f [libFuzzer] Move check for thread_local back into libFuzzer's CMake,
as it breaks builtin standalone build on some bots.

llvm-svn: 311482
2017-08-22 18:34:28 +00:00
Kostya Serebryany 868e69091c [libFuzzer] disable a test failing on the bot
llvm-svn: 311427
2017-08-22 05:15:57 +00:00
Saleem Abdulrasool 84315ec513 Revert "builtins: erase `struct` modifier for EH personality"
This reverts SVN r311425 which broke one of the buildbots.  It is
unclear what header is being used there.  Revert it until that can be
handled properly.

llvm-svn: 311426
2017-08-22 04:19:51 +00:00
Saleem Abdulrasool 94fd3c41fb builtins: erase `struct` modifier for EH personality
On ARM, the `_Unwind_Exception` is an alias for
`struct _Unwind_Control_Block`.  The extra `struct` modifier causes a
warning due to the locally scoped type.  Special case this to avoid the
warning.  NFC.

llvm-svn: 311425
2017-08-22 04:05:50 +00:00
Kostya Serebryany 33fb36c353 [libFuzzer] fix the stack-depth initialization, add a lit test for DeepRecursionTest.cpp
llvm-svn: 311421
2017-08-22 01:50:00 +00:00
Kostya Serebryany f65cf64fa2 [libFuzzer] apply changes lost during the migration to compiler-rt
llvm-svn: 311420
2017-08-22 01:28:32 +00:00
George Karpenkov e4c5322992 [NFC] do not run linter on libFuzzer's tests.
llvm-svn: 311419
2017-08-22 01:19:17 +00:00
Kostya Serebryany 055f441bd2 [libFuzzer] better README.txt
llvm-svn: 311418
2017-08-22 01:15:40 +00:00
Kostya Serebryany 0977643039 [libFuzzer] remove stale file
llvm-svn: 311417
2017-08-22 01:14:53 +00:00
George Karpenkov 92d8000487 Remove check-fuzzer from check-all, as tests don't pass on some bots.
llvm-svn: 311415
2017-08-22 00:54:57 +00:00
George Karpenkov 10ab2ace13 Move libFuzzer to compiler_rt.
Resulting library binaries will be named libclang_rt.fuzzer*, and will
be placed in Clang toolchain, allowing redistribution.

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

llvm-svn: 311407
2017-08-21 23:25:50 +00:00
Evgeniy Stepanov 753297e634 Fix ASan version list dependency in multi-arch builds.
Fixes PR32390.

Patch by Andrey Krayniak.

llvm-svn: 311394
2017-08-21 22:31:31 +00:00
Kostya Kortchinsky 0d3439a29c [sanitizer] Do not over-dup string flags
Summary:
String flags values appear to be duped twice. Once in `FlagParser::parse_flag`
using the `LowLevelAllocator` via `ll_strndup`, once in
`FlagHandler<const char *>::Parse` using the `InternalAllocator` via
`internal_strdup`. It looks like the second one is redundant, as the memory
for the first one is never freed and not used for anything else.

Assigning the value to the flag instead of duping it has a few advantages:
- if it was the only use of the `InternalAllocator` (which is the case for
  Scudo), then the related code will not be compiled it, which saves us a
  whole instantiation of the CombinedAllocator worth of extra code;
- in the event a string flag is parsed, the `InternalAllocator` would have
  created a whole SizeClassAllocator32 region for a single allocation, which is
  kind of wasteful.
- also, the string is dup'ed twice for the whole lifetime of a process.

I tested check-{sanitizer,asan,tsan,ubsan,scudo} successfully, so as far as I
can tell this doesn't appear to have bad side effects.

Reviewers: eugenis, alekseyshl

Reviewed By: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 311386
2017-08-21 21:25:38 +00:00
George Karpenkov 93e9e8a0d3 [NFC CMake] Do not relink test targets every time in compiler-rt
CMake's add_custom_target is considered to be *always* out of date.
This patch changes it to a combination of add_custom_target and
add_custom_command which actually tracks dependencies' timestamps.

On my machine this reliably saves 6-7 seconds on each test group.
This can be a large difference when debugging small tests.

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

llvm-svn: 311384
2017-08-21 21:19:13 +00:00
George Karpenkov 9d7a75d617 Fix multi-architecture build for lib/xray.
Differential Revision: https://reviews.llvm.org/D36881

llvm-svn: 311379
2017-08-21 20:28:32 +00:00
Kuba Mracek b17fd11e09 Remove "%T" from ASan Darwin tests.
llvm-svn: 311298
2017-08-20 18:31:00 +00:00
Vlad Tsyrklevich 599b11784a [TSan] Update test values
Summary:
This test was broken by the tail duplication logic being changed in
r311139, update the test values and add a note about how to properly run
a benchmark to verify that the values are safe to update.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: dvyukov, kubamracek

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

llvm-svn: 311189
2017-08-18 19:22:39 +00:00
Matt Morehouse 5c7fc76983 [SanitizerCoverage] Add stack depth tracing instrumentation.
Summary:
Augment SanitizerCoverage to insert maximum stack depth tracing for
use by libFuzzer.  The new instrumentation is enabled by the flag
-fsanitize-coverage=stack-depth and is compatible with the existing
trace-pc-guard coverage.  The user must also declare the following
global variable in their code:
  thread_local uintptr_t __sancov_lowest_stack

https://bugs.llvm.org/show_bug.cgi?id=33857

Reviewers: vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, hiraditya, cfe-commits, llvm-commits

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

llvm-svn: 311186
2017-08-18 18:43:30 +00:00
Dean Michael Berris 7eaaa0f0f2 [XRay][compiler-rt][NFC] Expand the PIC test case for XRay
Summary:
Here we add a build with -ffunction-sections -fdata-sections and
-Wl,--gc-sections to ensure that we're still able to generate XRay
traces.

This is just adding a test, no functional changes.

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

llvm-svn: 311145
2017-08-18 05:24:32 +00:00
Francis Ricci 69639c24f9 Add C++17 aligned new/delete interceptors to standalone lsan
Summary: Based on r282019.

Reviewers: kcc, jakubjelinek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 311030
2017-08-16 18:09:29 +00:00
Kostya Kortchinsky 43917720a7 [scudo] Application & platform compatibility changes
Summary:
This patch changes a few (small) things around for compatibility purposes for
the current Android & Fuchsia work:
- `realloc`'ing some memory that was not allocated with `malloc`, `calloc` or
  `realloc`, while UB according to http://pubs.opengroup.org/onlinepubs/009695399/functions/realloc.html
  is more common that one would think. We now only check this if
  `DeallocationTypeMismatch` is set; change the "mismatch" error
  messages to be more homogeneous;
- some sketchily written but widely used libraries expect a call to `realloc`
  to copy the usable size of the old chunk to the new one instead of the
  requested size. We have to begrundingly abide by this de-facto standard.
  This doesn't seem to impact security either way, unless someone comes up with
  something we didn't think about;
- the CRC32 intrinsics for 64-bit take a 64-bit first argument. This is
  misleading as the upper 32 bits end up being ignored. This was also raising
  `-Wconversion` errors. Change things to take a `u32` as first argument.
  This also means we were (and are) only using 32 bits of the Cookie - not a
  big thing, but worth mentioning.
- Includes-wise: prefer `stddef.h` to `cstddef`, move `scudo_flags.h` where it
  is actually needed.
- Add tests for the memalign-realloc case, and the realloc-usable-size one.

(Edited typos)

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 311018
2017-08-16 16:40:48 +00:00
George Karpenkov 4c26922662 Quickfix to the refactoring commit: typo in the link flags variable
name.

llvm-svn: 310973
2017-08-15 23:22:52 +00:00
George Karpenkov 769124dc5e [sanitizers CMake] NFC Refactor the logic for compiling and generating tests
into a function.

Most CMake configuration under compiler-rt/lib/*/tests have
almost-the-same-but-not-quite functions of the form add_X_[unit]tests
for compiling and running the tests.
Much of the logic is duplicated with minor variations across different
sub-folders.
This can harm productivity for multiple reasons:

For newcomers, resulting CMake files are very large, hard to understand,
and hide the intention of the code.
Changes for enabling certain architectures end up being unnecessarily
large, as they get duplicated across multiple folders.
Adding new sub-projects requires more effort than it should, as a
developer has to again copy-n-paste the configuration, and it's not even
clear from which sub-project it should be copy-n-pasted.
With this change the logic of compile-and-generate-a-set-of-tests is
extracted into a function, which hopefully makes writing and reading
CMake much easier.

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

llvm-svn: 310971
2017-08-15 22:56:10 +00:00
George Karpenkov 83ea28116e [CMake compiler-rt] NFC: Minor CMake refactoring.
Detect ObjC files in `clang_compile` and pass an appropriate flag to a
compiler, also change `clang_compile` to a function.

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

llvm-svn: 310945
2017-08-15 18:38:14 +00:00
George Karpenkov cb6be4dd90 [compiler-rt CMake] NFC: Minor CMake refactoring.
Change macro to a function, and use a generic variable instead of
branching for handling multi-output build with
CMAKE_CONFIGURATION_TYPES.

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

llvm-svn: 310944
2017-08-15 18:35:02 +00:00
George Karpenkov d46f17db06 [compiler-rt CMake] CMake refactoring: create directories in helper func.
Change macro to a function, move creating test directory into
`add_compiler_rt_test`.

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

llvm-svn: 310943
2017-08-15 18:32:28 +00:00
Kamil Rytarowski d341194d68 Revert: Enable profile on NetBSD
Requested by V.Kumar.

Not all tests pass.

llvm-svn: 310912
2017-08-15 09:56:47 +00:00
Xinliang David Li 1c9320cd4d Revert r310857 due to internal test failure
llvm-svn: 310907
2017-08-15 03:13:01 +00:00
Weiming Zhao 1c617be054 [builtins] fix build error on non-ARM for r310884
llvm-svn: 310890
2017-08-14 21:44:33 +00:00
Weiming Zhao 8bf15723ae [builtins][ARM] 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()

(This is based off  Michal's patch https://reviews.llvm.org/D30938)

Reviewers: dim, rengolin, compnerd, strejda

Reviewed By: compnerd

Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits

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

llvm-svn: 310884
2017-08-14 20:48:47 +00:00
Evgeniy Stepanov b52b141dd0 Fix a cmake typo.
Also add "libc++" to list of property values (AFAIK that only affects the cmake gui).

llvm-svn: 310883
2017-08-14 20:42:43 +00:00
Xinliang David Li 533d4c90bd [PGO] Add support for relocate profile dumping directory
Differential Revsion: http://reviews.llvm.org/D36648

llvm-svn: 310857
2017-08-14 16:51:05 +00:00
Kostya Kortchinsky e1dde07640 [sanitizers] Add a blocking boolean to GetRandom prototype
Summary:
On platforms with `getrandom`, the system call defaults to blocking. This
becomes an issue in the very early stage of the boot for Scudo, when the RNG
source is not set-up yet: the syscall will block and we'll stall.

Introduce a parameter to specify that the function should not block, defaulting
to blocking as the underlying syscall does.

Update Scudo to use the non-blocking version.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 310839
2017-08-14 14:53:47 +00:00
Sean Eveson cf9525eac2 [llvm-cov] Fix compiler-rt tests failing in build bots after rL310827.
The compiler-rt tests used llvm-cov with -filename-equivelence, which was
replaced with the new option -path-equivalence in rL310827.

llvm-svn: 310836
2017-08-14 12:43:05 +00:00
Kamil Rytarowski c4edc0705c Enable profile on NetBSD
Summary:
make check-profile:

Failing Tests (2):
    Profile-i386 :: instrprof-dlopen.test
    Profile-x86_64 :: instrprof-dlopen.test

  Expected Passes    : 64
  Unsupported Tests  : 42
  Unexpected Failures: 2

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: vsk, llvm-commits, srhines, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310800
2017-08-13 20:18:15 +00:00
Evgeniy Stepanov 3072b539da [compiler-rt] Add SANITIZER_CXX_ABI_LIBNAME=libc++ option.
Summary: This is to support Android where libc++abi is part of libc++.

Reviewers: srhines, EricWF

Subscribers: dberris, mgorny, llvm-commits

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

llvm-svn: 310769
2017-08-11 22:28:02 +00:00
Kamil Rytarowski 7a6b680622 Enable ASAN on NetBSD
Summary:
This enables also static runtime option.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, kcc, fjricci

Reviewed By: vitalybuka

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310651
2017-08-10 19:08:39 +00:00
Kamil Rytarowski 4ad374ea76 Add NetBSD support in asan_linux.cc
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: fjricci, vitalybuka, joerg, kcc, filcab

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310647
2017-08-10 18:51:51 +00:00
Kamil Rytarowski fbd51b954d Enable SafeStack on NetBSD
Summary:
make check-safestack:

-- Testing: 8 tests, 8 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 0.44s
  Expected Passes    : 7
  Unsupported Tests  : 1

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, fjricci, filcab

Reviewed By: vitalybuka

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310646
2017-08-10 18:40:09 +00:00