Commit Graph

8964 Commits

Author SHA1 Message Date
Vitaly Buka 993bbbf19e [asan] Allocator support for Fuchsia
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: alekseyshl

Subscribers: srhines, cryptoad, kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309914
2017-08-03 02:22:11 +00:00
Dean Michael Berris 449fdf816e [XRay][compiler-rt] Allow for building the XRay runtime without PREINIT initialization.
Summary:
Define a build-time configuration option for the XRay runtime to
determine whether the archive will add an entry to the `.preinit_array`
section of the binary. We also allow for initializing the XRay data
structures with an explicit call to __xray_init(). This allows us to
give users the capability to initialize the XRay data structures on
demand.

This can allow us to start porting XRay to platforms where
`.preinit_array` isn't a supported section. It also allows us to limit
the effects of XRay in the initialization sequence for applications that
are sensitive to this kind of interference (i.e. large binaries) or
those that want to package XRay control in libraries.

Future changes should allow us to build two different library archives
for the XRay runtime, and allow clang users to determine which version
to link.

Reviewers: dblaikie, kpw, pelikan

Subscribers: mgorny, llvm-commits

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

llvm-svn: 309909
2017-08-03 00:58:45 +00:00
Kostya Kortchinsky 0357e8de3b [tsan] Check for pvalloc overlow
Summary:
`CheckForPvallocOverflow` was introduced with D35818 to detect when pvalloc
would wrap when rounding up to the next multiple of the page size.

Add this check to TSan's pvalloc implementation.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 309897
2017-08-02 22:47:54 +00:00
Sterling Augustine a0213850e5 Use a more standard method to mark these tests as unsupported on powerpc64.
llvm-svn: 309892
2017-08-02 21:52:23 +00:00
Kostya Kortchinsky 94380ed406 [msan] Check for pvalloc overflow
Summary:
CheckForPvallocOverflow was introduced with D35818 to detect when pvalloc
would wrap when rounding up to the next multiple of the page size.

Add this check to MSan's pvalloc implementation.

This time I made sure I was actually running (and writing) the correct tests,
and that they are passing...

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 309883
2017-08-02 20:32:12 +00:00
Kostya Serebryany 1ca948a2b4 Add new ASAN_OPTION: sleep_after_init.
Summary: As mentioned in https://github.com/google/sanitizers/issues/834, suggested option can be handy for debugging.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 309854
2017-08-02 18:48:45 +00:00
Sterling Augustine f67036b62c This ppc64 implementation of clear_cache works for both big and little endian.
llvm-svn: 309848
2017-08-02 18:13:59 +00:00
Vedant Kumar 8adb8d5d0d [ubsan] Test -fsanitize=vptr without -fsanitize=null
This reverts commit r309042, thereby adding a test for -fsanitize=vptr
functionality without -fsanitize=null. It also removes -fsanitize=null
from another -fsanitize=vptr test.

llvm-svn: 309847
2017-08-02 18:10:36 +00:00
Vitaly Buka 411533009d [asan] Interceptors for Fuchsia
Summary:
Fuchsia uses the "memintrinsics" interceptors, though not via any
generalized interception mechanism.  It doesn't use any other interceptors.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309798
2017-08-02 07:59:30 +00:00
Vitaly Buka 137c9c2a6a [sanitizer_common] Fuchsia-specific implementation of SanitizerCoverage
Submitted on behalf of Roland McGrath.

Reviewers: kcc, eugenis, alekseyshl, vitalybuka

Reviewed By: kcc

Subscribers: filcab, vitalybuka, phosek, llvm-commits, kubamracek, mgorny

Tags: #sanitizers

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

llvm-svn: 309797
2017-08-02 07:51:38 +00:00
Dean Michael Berris 9952d95921 [XRay][compiler-rt] Remove use of std::mutex and std::shared_ptr from global scope.
Summary:
This change attempts to remove all the dependencies we have on
std::mutex and any std::shared_ptr construction in global variables. We
instead use raw pointers to these objects, and construct them on the
heap. In cases where it's possible, we lazily initialize these pointers.

While we do not have a replacement for std::shared_ptr yet in
compiler-rt, we use this work-around to avoid having to statically
initialize the objects as globals. Subsequent changes should allow us to
completely remove our dependency on std::shared_ptr and instead have our
own implementation of the std::shared_ptr and std::weak_ptr semantics
(or completely rewrite the implementaton to not need these
standard-library provided abstractions).

Reviewers: dblaikie, kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 309792
2017-08-02 04:51:40 +00:00
Vitaly Buka f4891c2a66 [sanitizer_common] Fuchsia-specific symbolizer
Summary:
Fuchsia doesn't support built-in symbolization per se at all.
Instead, it always emits a Fuchsia-standard "symbolizer markup"
format that makes it possible for a post-processing filter to
massage the logs into symbolized format.  Hence, it does not
support user-specified formatting options for backtraces or other
symbolization.

Reviewers: vitalybuka, alekseyshl, kcc

Subscribers: kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309760
2017-08-01 22:54:51 +00:00
Vitaly Buka 5d960ec420 [sanitizer_common] Fuchsia OS support code
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: cryptoad, srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309756
2017-08-01 22:22:25 +00:00
Vitaly Buka 51ca757e61 [sanitizer_common] Disable filesystem-related code for Fuchsia
Summary:
Fuchsia doesn't support filesystem access per se at low level.
So it won't use any of the filesystem-oriented code in sanitizer_common.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309749
2017-08-01 21:28:39 +00:00
Vitaly Buka d4e03d59cb [sanitizer_common] Fuchsia support for interceptors
Summary:
Actually Fuchsia non-support for interceptors.  Fuchsia doesn't use
interceptors in the common sense at all.  Almost all system library
functions don't need interception at all, because the system
libraries are just themselves compiled with sanitizers enabled and
have specific hook interfaces where needed to inform the sanitizer
runtime about thread lifetimes and the like.  For the few functions
that do get intercepted, they don't use a generic mechanism like
dlsym with RTLD_NEXT to find the underlying system library function.
Instead, they use specific extra symbol names published by the
system library (e.g. __unsanitized_memcpy).

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc, filcab

Reviewed By: filcab

Subscribers: kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309745
2017-08-01 21:15:19 +00:00
Vitaly Buka 6886061dab [ubsan] Enable UBSan build for Fuchsia
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309742
2017-08-01 20:48:36 +00:00
Sterling Augustine f6b2e770ea Revert rL309634 until upstream buildbots have upgraded libc.
llvm-svn: 309704
2017-08-01 17:16:05 +00:00
Vitaly Buka 2ae1edd139 [sanitizer-coverage] Fix Windows build broken by r309655
llvm-svn: 309665
2017-08-01 07:45:46 +00:00
Kostya Serebryany d6cfed6060 [sanitizer-coverage] dummy definitions for __sanitizer_cov_8bit_counters_init and __sanitizer_cov_pcs_init
llvm-svn: 309655
2017-08-01 04:24:05 +00:00
Evgeniy Stepanov 6ff4412375 [sancov] Fix coverage-reset test on Android/i686.
DSO coverage may be dumped in any order.

llvm-svn: 309639
2017-07-31 23:08:27 +00:00
Petr Hosek a14a2cc5ce [sanitizer] Fix the sanitizer build on Android
Android uses libgcc name even for shared library unlike other platforms
which use libgcc_s. Furthemore, Android libstdc++ has a dependency on
libdl. These need to be handled while performing CMake checks.

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

llvm-svn: 309638
2017-07-31 22:46:43 +00:00
Kostya Kortchinsky 9d52cedb24 [msan] Reverting D36093
Summary:
Reverting D36093 until I can figure out how to launch the correct tests :/
My apologies.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 309637
2017-07-31 22:46:01 +00:00
Sterling Augustine 81fd449238 Add powerpc64 to compiler-rt build infrastructure.
Summary: Add powerpc64 to compiler-rt build infrastructure.

Reviewers: timshen

Reviewed By: timshen

Subscribers: nemanjai, dberris, mgorny, aheejin, cfe-commits

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

llvm-svn: 309634
2017-07-31 22:23:17 +00:00
Peter Collingbourne 36df72b50a Remove STL/microsoft-specific CFI blacklist entries
Patch by Vlad Tsyrklevich!

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

llvm-svn: 309617
2017-07-31 20:39:32 +00:00
Kostya Kortchinsky 56f5f17349 [msan] Check for pvalloc overflow
Summary:
`CheckForPvallocOverflow` was introduced with D35818 to detect when pvalloc
would wrap when rounding up to the next multiple of the page size.

Add this check to MSan's pvalloc implementation.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 309601
2017-07-31 18:45:17 +00:00
Dean Michael Berris 432fec23c5 [XRay][compiler-rt] Fix test to not be too strict with output order.
Follow-up to D35789.

llvm-svn: 309543
2017-07-31 06:58:09 +00:00
Vitaly Buka 0aeb0fe2ab [asan] Move shadow memory setup into its own file
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Subscribers: kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309542
2017-07-31 06:48:34 +00:00
Dean Michael Berris 8443f7ba64 [XRay][compiler-rt] Fix typo for REQUIRES.
Follow-up on D35789.

llvm-svn: 309540
2017-07-31 06:21:38 +00:00
Vitaly Buka 0a6464aa98 [sanitizer_common] Add SANITIZER_FUCHSIA
Summary: More changes to follow will add the Fuchsia port.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, phosek, filcab

Tags: #sanitizers

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

llvm-svn: 309539
2017-07-31 06:21:13 +00:00
Dean Michael Berris 598bc37e27 [XRay][compiler-rt] Require build-in-tree and x86_64-linux.
The quiet-start.cc test currently fails for arm (and potentially other
platforms). This change limits it to x86_64-linux.

Follow-up to D35789.

llvm-svn: 309538
2017-07-31 06:09:57 +00:00
Martin Storsjo adf4489009 [builtins] Fix mingw-w64 cross compilation
Lowercase the Windows.h include in enable_execute_stack.c, just as in
emutls.c in SVN r302340.

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

llvm-svn: 309537
2017-07-31 06:01:39 +00:00
Vitaly Buka 8c809eb7cd [sanitizer_common] Rename SI_NOT_WINDOWS to SI_POSIX
Summary:
New systems might be neither Windows nor POSIX.  The SI_NOT_WINDOWS
macro in sanitizer_platform_interceptors.h was already effectively
the same as SI_POSIX, so just use SI_POSIX instead.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: phosek, filcab, llvm-commits, kubamracek

Tags: #sanitizers

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

llvm-svn: 309536
2017-07-31 05:58:15 +00:00
Dean Michael Berris 5ca1955627 [XRay][compiler-rt] Do not print the warning when the binary is not XRay instrumented.
Summary:
Currently when the XRay runtime is linked into a binary that doesn't
have the instrumentation map, we print a warning unconditionally. This
change attempts to make this behaviour more quiet.

Reviewers: kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 309534
2017-07-31 05:16:20 +00:00
Vedant Kumar 4fb45077c4 [ubsan] Diagnose invalid uses of builtins (compiler-rt)
Differential Revision: https://reviews.llvm.org/D34591

llvm-svn: 309461
2017-07-29 00:20:02 +00:00
Reid Kleckner 3bcad2b2e6 Try to fix asan test on sanitizer-windows
llvm-svn: 309440
2017-07-28 21:43:23 +00:00
Krzysztof Parzyszek 48a34c684b [compiler-rt] Add missing quotation marks to msan_compile invocation
llvm-svn: 309430
2017-07-28 20:29:29 +00:00
Matt Morehouse 74ddba0c95 Add end-to-end tests for overflows of byval arguments.
Summary:
Included is one test for passing structs by value and one test for
passing C++
objects by value.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 309424
2017-07-28 19:52:31 +00:00
Sterling Augustine dd9173420f Add clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.
llvm-svn: 309423
2017-07-28 19:49:22 +00:00
Matt Morehouse 6848e05d8b Revert r308677.
Incorrect directories were created by the patch.

llvm-svn: 309420
2017-07-28 19:11:16 +00:00
George Karpenkov a6f43a68d3 [sanitizers test CMake] further refactor testing CMake for tsan
TSan tests on Darwin first link all libraries into a static archive file.
With this change, the linking is done once per all architecture,
and previously the linking step was repeated per each architecture per
each add_tsan_test call.
Furthermore, the code is cleared up.

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

llvm-svn: 309406
2017-07-28 17:38:44 +00:00
George Karpenkov 831875b4bf [sanitizer tests CMake] Factor out CMake logic for compiling sanitizer tests
Currently there's a large amount of CMake logic duplication for
compiling sanitizer tests.
If we add more sanitizers, the duplication will get even worse.

This change factors out common compilation commands into a macro
available to all sanitizers.

llvm-svn: 309405
2017-07-28 17:32:37 +00:00
Dehao Chen ab360d6015 Change INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE from 8 to 16.
Summary: In the current implementation, the defaul number of values per site tracked by value profiler is 8, which is too small and could introduce inaccuracies to profile. Changing it to 16 will be able to gain more accurate value profiler.

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 309388
2017-07-28 15:00:30 +00:00
Petr Hosek a7a9ca4ad1 Support libc++abi in addition to libstdc++
This change adds sanitizer support for LLVM's libunwind and libc++abi
as an alternative to libstdc++. This allows using the in tree version
of libunwind and libc++abi which is useful when building a toolchain
for different target.

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

llvm-svn: 309362
2017-07-28 03:39:39 +00:00
Petr Hosek 2bbb6ad217 Support compiler-rt builtins
This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

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

llvm-svn: 309361
2017-07-28 03:39:38 +00:00
Kostya Serebryany ce5e65ee93 [sanitizer-coverage] add a run-time test for -fsanitize-coverage=inline-8bit-counters,pc-table
llvm-svn: 309351
2017-07-28 01:38:43 +00:00
George Karpenkov 50dd3fe903 [sanitizers] Sanitizer tests CMake clean up: try #2
This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

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

llvm-svn: 309341
2017-07-28 00:50:56 +00:00
Evgeniy Stepanov fea50c286a [sancov] Add missing line breaks in test. NFC.
llvm-svn: 309339
2017-07-28 00:22:42 +00:00
Evgeniy Stepanov 59b5e9c00c [sancov] Implement __sanitizer_cov_reset.
Summary: Clears all collected coverage.

Reviewers: kcc

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 309333
2017-07-27 23:22:37 +00:00
George Karpenkov 1bf535daae Revert "[sanitizers] Sanitizer tests CMake clean up"
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a.

Fails on some bots, reverting until I can fix it.

llvm-svn: 309318
2017-07-27 20:44:33 +00:00
George Karpenkov 165a1edc85 [sanitizers] Sanitizer tests CMake clean up
This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

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

llvm-svn: 309306
2017-07-27 18:40:38 +00:00