Commit Graph

10008 Commits

Author SHA1 Message Date
Petr Hosek fb6a4a7907 [CMake] Support statically linked libc++abi and libunwind
This expands the CMake check to handle both statically and dynamically
linked version of libc++abi and libunwind and matches the implemnetation
used elsewhere in LLVM.

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

llvm-svn: 329205
2018-04-04 16:27:33 +00:00
Kostya Kortchinsky 9336ab6996 [sanitizer] Split stacktrace/symbolizer: Windows unwind
Summary:
The purpose of this set of changes is to separate stackframe/symbolizer support into their own RT within sanitizer_common.
Sanitizers with no use for those could then be built without the extraneous dependencies pulled in by the default visibility interface functions.
I am aiming to do small changes for specific platforms.

In this one, we split the unwind functions from sanitizer_win.cc into their own sanitizer_unwind_win.cc.

Reviewers: alekseyshl, rnk

Reviewed By: alekseyshl, rnk

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

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

llvm-svn: 329204
2018-04-04 15:23:30 +00:00
Dean Michael Berris fe79b04a74 [XRay][compiler-rt] Build XRay runtime for OpenBSD
Summary:
This is D45125; the patch enables the build of XRay on OpenBSD. We also
introduce some OpenBSD specific changes to the runtime implementation,
involving how we get the TSC rate through the syscall interface specific
to OpenBSD.

Reviewers: dberris

Authored by: devnexen

Subscribers: dberris, mgorny, krytarowski, llvm-commits

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

llvm-svn: 329189
2018-04-04 13:04:15 +00:00
Kostya Kortchinsky 2c5f944015 [sanitizer] Remove empty Symbolizer PrepareForSandboxing
Summary:
`Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently
has been for a while (D10213). Remove it, and shuffle things around so that the
platform specific code is now in `PlatformPrepareForSandboxing`.

This allows to have one less symbolizer dependency in a common file, which
helps for the upcoming split.

Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not
be used anywhere.

Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr

Reviewed By: alekseyshl

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

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

llvm-svn: 329094
2018-04-03 18:07:22 +00:00
Rong Xu 1a45e0cccc [profile] Move newly added test to the supported platform
Move test/profile/instrprof-value-merge.c from r328987 to Linux directory.

llvm-svn: 329016
2018-04-02 21:24:07 +00:00
Rong Xu 95ab7582f0 [profile] Fix value profile runtime merging issues
This patch fixes the following issues:
(1) The strong definition of the merge hook function was not working which
breaks the online value profile merging. This patch removes the weak
attribute of VPMergeHook and assigns the value dynamically.
(2) Truncate the proifle file so that we don't have garbage data at the end of
the file.
(3) Add new __llvm_profile_instrument_target_value() interface to do the value
profile update in batch. This is needed as the original incremental by 1
in __llvm_profile_instrument_target() is too slow for online merge.

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

llvm-svn: 328987
2018-04-02 16:57:00 +00:00
Alex Shlyapnikov 0ee5a5577c [ASan] Disable new ASan error reporting tests on various ARMs.
As many other ASan tests already, has to disable these failing tests on
arm, armhf and aarch64 configs.

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

llvm-svn: 328849
2018-03-30 00:03:36 +00:00
Dan Liew 0f08dff1b5 [asan] Split the `throw_invoke_test.cc` into a Linux specific variant
and the general version to avoid use of libstdc++ on non-Linux
platforms.

This is motivated by the fact that using `libstdc++` is deprecated on
Darwin and maybe removed some day.

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

llvm-svn: 328775
2018-03-29 13:53:50 +00:00
Alex Shlyapnikov b43b558012 [ASan] Disable aligned_alloc-alignment.cc on PPC64.
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328753
2018-03-29 02:18:57 +00:00
Alex Shlyapnikov 239533319f [ASan] Disable aligned_alloc-alignment.cc on ppc64be
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328742
2018-03-29 00:09:12 +00:00
Alex Shlyapnikov 5062d7a22d [ASan] Disable aligned_alloc-alignment.cc test on gcc.
This check "CHECK: {{#0 0x.* in .*aligned_alloc}}" fails on ppc64be, gcc
build. Disabling the test for gcc for now.

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

llvm-svn: 328741
2018-03-28 23:01:04 +00:00
Alex Shlyapnikov b276621d3d [ASan] Disable aligned_alloc-alignment.cc on Android.
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328734
2018-03-28 22:00:08 +00:00
Alex Shlyapnikov 506b8388ed [ASan] Add aligned_alloc declaration to aligned_alloc-alignment.cc test.
aligned_alloc is not always defined in headers.

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

llvm-svn: 328726
2018-03-28 19:53:55 +00:00
Alex Shlyapnikov 10f50a44c1 [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ing
Summary:
Currently many allocator specific errors (OOM, for example) are reported as
a text message and CHECK(0) termination, not stack, no details, not too
helpful nor informative. To improve the situation, ASan detailed errors were
defined and reported under the appropriate conditions.

Issue: https://github.com/google/sanitizers/issues/887

Reviewers: eugenis

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

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

llvm-svn: 328722
2018-03-28 18:22:40 +00:00
Evgeniy Stepanov 29e6fd6785 [asan] Add vfork to the list of reasons for stack errors.
Until we figure out what to do with it, vfork can cause stack-based
false positives.

llvm-svn: 328681
2018-03-28 00:45:20 +00:00
Alex Shlyapnikov 0e44f5eb8b [HWASan] Make use-after-free c, not c++ test.
To minimize testing surface (remove libstdc++ from the picture, for
one), make use-after-free c, not c++ test.

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

llvm-svn: 328646
2018-03-27 17:45:53 +00:00
Matt Morehouse 86db6dd2ed [libFuzzer] Disable optimization for exit_on_src_pos.test.
Test fails on Darwin with -O2.

llvm-svn: 328634
2018-03-27 16:40:34 +00:00
Matt Morehouse 22a1afd99f [libFuzzer] Place volatile after pointer types.
For a few tests, volatile was placed before the '*' in pointer
declarations, resulting in it applying to the underlying data rather
than the pointer itself.  Placing volatile after the '*' allows us to
switch those tests to -O2.

llvm-svn: 328633
2018-03-27 16:40:20 +00:00
Alex Shlyapnikov b66b8fd0f2 [HWASan] Relax use-after-free.cc test matching rules.
Relax use-after-free.cc test matching rules to cover more malloc/free
interceptor names variations.

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

llvm-svn: 328630
2018-03-27 16:04:40 +00:00
Kostya Kortchinsky eeee252d50 [scudo] Fuchsia minimal shared runtime
Summary:
Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they
don't use UBSan in conjunction with Scudo, we can just remove the runtime,
and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage
either. This allows to keep things going while working on additional splits
of sanitizer_commong and a more minimal runtime.

Reviewers: phosek, flowerhack, alekseyshl

Reviewed By: phosek, alekseyshl

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

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

llvm-svn: 328625
2018-03-27 14:40:39 +00:00
Evgeniy Stepanov 7989d8da20 Revert "[asan] Replace vfork with fork."
Replacing vfork with fork results in significant slowdown of certain
apps (in particular, memcached).

This reverts r327752.

llvm-svn: 328600
2018-03-27 00:31:16 +00:00
Matt Morehouse 93ce24838c [libFuzzer] Do not optimize minimize_two_crashes.test.
Speculative fix for build bot breakage on Mac.

llvm-svn: 328576
2018-03-26 19:36:20 +00:00
Vitaly Buka 48d19f6961 [sanitizer] Make test compatible with Darwin
llvm-svn: 328467
2018-03-26 01:29:48 +00:00
Vitaly Buka f791c9659b [sanitizer] Fix Darwin build
llvm-svn: 328417
2018-03-24 08:13:18 +00:00
Vitaly Buka 8616363017 Mmap interceptor providing mprotect support
Summary:
- Intercepting mprotect calls.
- Fixing forgotten flag check.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328415
2018-03-24 07:45:24 +00:00
Vitaly Buka eb8a3674ec [sanitizer] Fix strlcpy and strlcat interceptors on Darwin
llvm-svn: 328414
2018-03-24 07:31:59 +00:00
Alex Shlyapnikov 53ddbac32b [HWASan] Fix use-after-free.cc test on x86-64
Differential Revision: https://reviews.llvm.org/D44705

llvm-svn: 328407
2018-03-24 02:10:49 +00:00
Alex Shlyapnikov 3e65a06015 Remove duplicated const qualifier.
llvm-svn: 328403
2018-03-24 00:40:51 +00:00
Alex Shlyapnikov 5cd35ed4fe [HWASan] Port HWASan to Linux x86-64 (compiler-rt)
Summary:
Porting HWASan to Linux x86-64, first of the three patches, compiler-rt part.

The approach is similar to ARM case, trap signal is used to communicate
memory tag check failure. int3 instruction is used to generate a signal,
access parameters are stored in nop [eax + offset] instruction immediately
following the int3 one

Had to add HWASan init on malloc because, due to much less interceptors
defined (most other sanitizers intercept much more and get initalized
via one of those interceptors or don't care about malloc), HWASan was not
initialized yet when libstdc++ was trying to allocate memory for its own
fixed-size heap, which led to CHECK-fail in AllocateFromLocalPool.

Also added the CHECK() failure handler with more detailed message and
stack reporting.

Reviewers: eugenis

Subscribers: kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 328385
2018-03-23 23:38:04 +00:00
Matt Morehouse 5317f2e4c9 [libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.
Summary:
Disables certain CMP optimizations to improve fuzzing signal under -O1
and -O2.

Switches all fuzzer tests to -O2 except for a few leak tests where the
leak is optimized out under -O2.

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 328384
2018-03-23 23:35:28 +00:00
Vitaly Buka b53180846b FreeBSD sanitizer common, intercept couple of more functions
Summary:
Intercepts lstat, acct, access, faccessat and strlcpy/strlcat

Patch by David CARLIER

Reviewers: visa, vitalybuka

Subscribers: krytarowski, fedor.sergeev, srhines, kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328376
2018-03-23 21:44:59 +00:00
Vitaly Buka bb096c27bf Revert "Mmap interceptor providing mprotect support"
Breaks Darwin.

This reverts commit r328369.

llvm-svn: 328375
2018-03-23 21:44:59 +00:00
Vitaly Buka e4d34c0d56 Mmap interceptor providing mprotect support
Summary:
- Intercepting mprotect calls.
- Fixing forgotten flag check.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

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

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

llvm-svn: 328369
2018-03-23 20:59:51 +00:00
Vitaly Buka c038b2f441 [sanitizer] Fix PPC bot
llvm-svn: 328279
2018-03-23 00:15:10 +00:00
Petr Hosek f4ec686bf7 [sanitizer] zx_vmo_write on Fuchsia takes only 4 arguments now
The system call now fails when it cannot write the requested size.
Update the sanitizer runtime Fuchsia implementation accordingly.

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

llvm-svn: 328273
2018-03-22 23:58:37 +00:00
Vitaly Buka 022a82cb15 More OpenBSD fixes
Summary:
- Use internal_syscall_ptr in internal_readlink
- use sigcontext on OpenBSD

Patch by David CARLIER

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328239
2018-03-22 20:42:28 +00:00
Kostya Kortchinsky 988fab3f66 [sanitizer] Split coverage into separate RT in sanitizer_common
Summary:
`sanitizer_common`'s coverage support is fairly well separated, and libcdep by
default. Several sanitizers don't make use of coverage, and as far as I can
tell do no benefit from the extra dependencies pulled in by the coverage public
interface functions.

The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan,
LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should
add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan.

So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc
anyway), XRay, and the upcoming Scudo minimal runtime.

I tested this with all the sanitizers check-* with gcc & clang, and in
standalone on Linux & Android, and there was no issue. I couldn't test this on
Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of
people for additional scrunity. I couldn't test HWAsan either.

Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski

Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris

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

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

llvm-svn: 328204
2018-03-22 15:04:31 +00:00
Vitaly Buka 8980449bb6 Mmap interceptor new option, Write Exec runtime detector
Summary:
Following-up the refactoring of mmap interceptors, adding a new common
option to detect PROT_WRITE|PROT_EXEC pages request.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: krytarowski, #sanitizers

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

llvm-svn: 328151
2018-03-21 21:25:07 +00:00
George Karpenkov 430aa7405f [libFuzzer] Disable equivalence-signals test on Darwin due to persistent failures
llvm-svn: 328125
2018-03-21 17:55:36 +00:00
Nemanja Ivanovic 212227ed10 [PowerPC] Disable failing dynamic tls test cases
Due to recent kernel upgrades, these test case fail on PowerPC buildbots.
This is a known problem on affected kernels.

llvm-svn: 328091
2018-03-21 11:58:37 +00:00
Dmitry Vyukov 625f757837 tsan: fix darwin build after 328079
328079 introduced a weak hook without default implementation.
This broke darwin build:
http://green.lab.llvm.org/green//job/clang-stage1-configure-RA/43731/consoleFull#-119213188149ba4694-19c4-4d7e-bec5-911270d8a58c

Provide default impl for the hook.

llvm-svn: 328082
2018-03-21 09:26:29 +00:00
Dmitry Vyukov f5675e7e2a tsan: support inlined frames in external symbolization
New API passes a callback function to the external symbolizer,
allowing it to add multiple frames to the traceback. Note that
the old interface API will be still supported until the clients
migrate to the new one.

Author: asmundak (Alexander Smundak)
Reviewed in: https://reviews.llvm.org/D44714

llvm-svn: 328079
2018-03-21 08:44:14 +00:00
Vitaly Buka f1fc25eb74 Fix declaration of environ after r327923
llvm-svn: 328077
2018-03-21 07:50:02 +00:00
Mandeep Singh Grang a9e74a9165 Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"
This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e.

llvm-svn: 327936
2018-03-20 01:17:18 +00:00
Mandeep Singh Grang dc09ebf71b [compiler-rt] Change std::sort to llvm::sort in response to r327219
Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Reviewers: kcc, rsmith, RKSimon, eugenis

Reviewed By: RKSimon

Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits

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

llvm-svn: 327929
2018-03-20 00:44:59 +00:00
Vitaly Buka 544a5555c5 OpenBSD UBsan support missing bits
Summary:
Lost bits since the WIP ticket

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327923
2018-03-19 23:12:14 +00:00
Vitaly Buka edeeb58f2a Cleanup of "extern char **environ" declaration
llvm-svn: 327904
2018-03-19 20:44:06 +00:00
Vitaly Buka d03bc7c26a Fix CMake/MSVC when compiler-rt and llvm are built separately
Summary:
For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`.

Patch by Loo Rong Jie

Reviewers: rnk, vitalybuka

Reviewed By: rnk, vitalybuka

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

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

llvm-svn: 327876
2018-03-19 18:22:35 +00:00
Vitaly Buka ec6327bab8 Revert "Mmap interceptor new option, Write Exec runtime detector"
Breaks Android bot.

This reverts commit r327747.

llvm-svn: 327762
2018-03-17 00:31:41 +00:00
Petr Hosek 961235d335 [Fuzzer] Build the shared memory hooks for Fuchsia
This is needed otherwise we'll get undefined references when trying
to use the libFuzzer built for Fuchsia.

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

llvm-svn: 327759
2018-03-16 22:40:55 +00:00