Commit Graph

11197 Commits

Author SHA1 Message Date
Vitaly Buka f5ce42c040 [safestack] Remove dependency of SafeStack on sanitizer_common
Summary:
SafeStack needs just few functions from there, but sanitizer_common
introduces conflicts with other runtimes, e.g. SCUDO.

Reviewers: eugenis, kcc, cryptoad

Subscribers: mgorny, krytarowski, fedor.sergeev, jfb, llvm-commits

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

llvm-svn: 351506
2019-01-18 01:53:37 +00:00
Vitaly Buka dbe4b02eeb [safestack] Replace statics with unnamed namespace
Reviewers: eugenis

Subscribers: jfb, llvm-commits

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

llvm-svn: 351503
2019-01-18 01:36:09 +00:00
Peter Collingbourne 48807d0d35 xray: Add missing header to list of installed headers.
Spotted by gn's llvm/utils/gn/build/sync_source_lists_from_cmake.py script.

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

llvm-svn: 351479
2019-01-17 21:11:49 +00:00
Jonathan Metzman b795c31dff [libFuzzer][MSVC] Make attribute-use compatible with MSVC
Summary:
Replace attributes with macros that use equivalent declspecs
for MSVC.

Reviewers: vitalybuka

Reviewed By: vitalybuka

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

llvm-svn: 351456
2019-01-17 16:36:05 +00:00
Dan Liew c7700127ae Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.

Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).

Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.

For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.

rdar://problem/47143078

Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski

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

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

llvm-svn: 351398
2019-01-16 23:37:31 +00:00
Nico Weber e5653be62a compiler-rt tests: Unbreak cmake with LLVM_ENABLE_PIC=OFF on mac
The LTO target doesn't exist with LLVM_ENABLE_PIC turned off.

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

llvm-svn: 351373
2019-01-16 20:36:27 +00:00
Nico Weber 07d8b321b3 Make compiler-rt CMakeLists.txt formatting a bit more like LLVM's usual formatting
llvm-svn: 351363
2019-01-16 18:12:45 +00:00
Julian Lettner ac855d3ea9 [TSan] Use switches when dealing with enums
Summary:
Small refactoring: replace some if-else cascades with switches so that the compiler warns us about missing cases.
Maybe found a small bug?

Reviewers: dcoughlin, kubamracek, dvyukov, delcypher, jfb

Reviewed By: dvyukov

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 351288
2019-01-16 01:45:12 +00:00
Peter Collingbourne f12c754b02 compiler-rt/test: Bring back -pie on Android.
Looks like the sanitizer-x86_64-linux-android bot started failing
because -pie is still needed when targeting API levels < 16 (which
is the case by default for arm and i686).

llvm-svn: 351270
2019-01-15 22:53:24 +00:00
Jonathan Metzman 9e14cccf6f [libFuzzer] Remove unstable edge handling
Summary:
Remove code for handling unstable edges from libFuzzer since
it has not been found useful.

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

llvm-svn: 351262
2019-01-15 22:12:51 +00:00
Peter Collingbourne 6498fbb22b compiler-rt/test: Add a couple of convenience features for Android.
Add a ANDROID_SERIAL_FOR_TESTING CMake variable. This lets you
run the tests with multiple devices attached without having to set
ANDROID_SERIAL.

Add a mechanism for pushing files to the device. Currently most
sanitizers require llvm-symbolizer and the sanitizer runtime to
be pushed to the device. This lets the sanitizer make this happen
automatically before running the tests by specifying the paths in
the lit.site.cfg file.

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

llvm-svn: 351260
2019-01-15 22:06:48 +00:00
Rong Xu 3e9e7fb961 [profile] Sync up InstrProfData.inc with llvm copy /NFC
llvm-svn: 351257
2019-01-15 21:59:17 +00:00
Peter Collingbourne f6627ce834 compiler-rt/test: Clean up Android specific workarounds in lit.common.cfg.
-pie -Wl,--enable-new-dtags are no longer needed because
the driver passes them by default as of r316606.

Prepend -fuse-ld=gold instead of appending it so that the linker can
be overridden using COMPILER_RT_TEST_COMPILER_CFLAGS.

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

llvm-svn: 351252
2019-01-15 21:27:44 +00:00
Hans Wennborg eb60fbfdb4 Update year in license files
In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

llvm-svn: 351194
2019-01-15 15:10:32 +00:00
David Carlier c5b8eb2714 Revert little bad rebasing.
llvm-svn: 351191
2019-01-15 13:08:20 +00:00
David Carlier bd27e4c156 [Sanitizer] Intercept sl_add api on FreeBSD/NetBSD
Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 351189
2019-01-15 11:21:33 +00:00
Roman Lebedev 0aa9153d48 [compiler-rt] alignment-assumption-blacklist.cpp test apparently passes on android, un-XFAIL it.
llvm-svn: 351184
2019-01-15 10:48:51 +00:00
Roman Lebedev d8bc31a849 [compiler-rt] fuzzer-alignment-assumption.test: fixup the expected column number
llvm-svn: 351181
2019-01-15 10:25:14 +00:00
Roman Lebedev a06ad18669 [compiler-rt][UBSan] Sanitization for alignment assumptions.
Summary:
This is the compiler-rt part.
The clang part is D54589.

This is a second commit, the original one was r351106,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Now, i have fundamentally changed the testing approach:
i malloc a few bytes, intentionally mis-align the pointer
(increment it by one), and check that. Also, i have decreased
the expected alignment. This hopefully should be enough to pacify
all the bots. If not, i guess i might just drop the two 'bad' tests.

Reviewers: filcab, vsk, #sanitizers, vitalybuka, rsmith, morehouse

Reviewed By: morehouse

Subscribers: rjmccall, krytarowski, rsmith, kcc, srhines, kubamracek, dberris, llvm-commits

Tags: #sanitizers

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

llvm-svn: 351178
2019-01-15 09:44:27 +00:00
Dan Liew cf34faa3e5 Explicitly set C++ standard for `Posix/no-fd.cc` ASan test.
Summary:
The test uses `nullptr` which can break running the test if the
compiler happens to be using something older than C++11 as the default
language standard. Avoid this by explicitly setting the standard.

rdar://problem/47253542

Reviewers: eugenis, yln, vitalybuka

Subscribers: kubamracek, #sanitizers, llvm-commits

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

llvm-svn: 351169
2019-01-15 08:54:10 +00:00
Vlad Tsyrklevich 86e68fda3b Revert alignment assumptions changes
Revert r351104-6, r351109, r351110, r351119, r351134, and r351153. These
changes fail on the sanitizer bots.

llvm-svn: 351159
2019-01-15 03:38:02 +00:00
Vlad Tsyrklevich 07d5b7f47e Silence failing tests
r351134 tried to disable these tests by using 'UNSUPPORTED: *' but '*'
is not supported for UNSUPPORTED like it is for XFAIL. Update these
tests to use XFAIL for now in order to silence x86_64-linux and
x86_64-linux-android.

llvm-svn: 351153
2019-01-15 02:22:14 +00:00
Jonathan Metzman a4d569bc19 [libFuzzer][MSVC] Use alternatename for ext functions
Summary:
Use alternatename for external functions only when using
MSVC since Clang doesn't support it and MSVC doesn't support
Clang's method (weak aliases).

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: rnk, thakis, mgorny

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

llvm-svn: 351152
2019-01-15 02:20:53 +00:00
Roman Lebedev deb8089a71 [compiler-rt] UBSan: just completely disable two alignment-assumption tests for now.
And they are faling on clang-cmake-armv7-full too.
*ONLY* these two.
I'm not sure what to make of it.

Perhaps doing a malloc and checking that pointer will
make them fail as expected?

llvm-svn: 351134
2019-01-14 22:44:19 +00:00
Roman Lebedev add3080cb9 [compiler-rt] UBSan: Disable 3 of the new alignment assumption tests on android.
Once again, just like with r338296, these tests seem to only have
failed sanitizer-x86_64-linux-android, so let's just disable them,
since that seems like the pre-established practice here..

To be noted, they failed on some configs there, but not all,
so it is not XFAIL.

llvm-svn: 351119
2019-01-14 21:02:25 +00:00
Shoaib Meenai 6e39af016f [compiler-rt] Add option to disable libc++ build
Having libc++ checked out doesn't necessarily mean it should be built;
for example, the same source tree might be used for multiple build
configurations, and libc++ might not build in some of those
configurations. Add an option to compiler-rt's build to disable building
libc++. This defaults to ON, so it shouldn't change any existing build
configurations.

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

llvm-svn: 351117
2019-01-14 20:33:30 +00:00
Roman Lebedev fd10ac3584 [compiler-rt] Update ubsan_interface.inc with alignment assumption handlers
Somehow this escaped my local testing.
A follow-up for r351106.

llvm-svn: 351110
2019-01-14 19:35:12 +00:00
Michal Gorny 965517fdad [test] Disable sunrpc tests when rpc/xdr.h is missing
Disable tests requiring sunrpc when the relevant headers are missing.
In order to accommodate that, move the header check
from sanitizer_common to base-config-ix, and define the check result
as a global variable there.  Use it afterwards both for definition
needed by sanitizer_common, and to control 'sunrpc' test feature.

While at it, remove the append_have_file_definition macro that was used
only once, and no longer fits the split check-definition.

Bug report: https://github.com/google/sanitizers/issues/974

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

llvm-svn: 351109
2019-01-14 19:18:34 +00:00
Roman Lebedev cc10d54432 [compiler-rt][UBSan] Sanitization for alignment assumptions.
Summary:
This is the compiler-rt part.
The clang part is D54589.

Reviewers: filcab, vsk, #sanitizers, vitalybuka, rsmith, morehouse

Reviewed By: morehouse

Subscribers: rjmccall, krytarowski, rsmith, kcc, srhines, kubamracek, dberris, llvm-commits

Tags: #sanitizers

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

llvm-svn: 351106
2019-01-14 19:09:29 +00:00
Diana Picus 2e3aaed7e7 [asan] Add fallback for Thumb after r350139
This reverts r350806 which marked some tests as UNSUPPORTED on ARM and
instead reintroduces the old code path only for Thumb, since that seems
to be the only target that broke.

It would still be nice to find the root cause of the breakage, but with
the branch point for LLVM 8.0 scheduled for next week it's better to put
things in a stable state while we investigate.

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

llvm-svn: 351040
2019-01-14 09:45:49 +00:00
Evgeniy Stepanov 0df20e893f [sanitizer] Move android's GetPageSize to a header (NFC)
No need to pay function call overhead for a function that returns a
constant.

llvm-svn: 350983
2019-01-12 00:09:24 +00:00
Peter Collingbourne c1fde4fa94 sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing to stdout.
This makes the script a little more gn friendly; gn does not support
redirecting the output of a script.

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

llvm-svn: 350980
2019-01-11 23:30:24 +00:00
Stefan Granitz 8c026e44cf [CMake] Fix standalone build after LLVM exports utility targets
LLVM started exporting targets for utilites with https://reviews.llvm.org/rL350959, which broke compiler-rt standalone builds because it was used to define FileCheck manually.
Changed this, so FileCheck gets imported now.

llvm-svn: 350973
2019-01-11 21:59:58 +00:00
David Carlier d0de9890d3 [Sanitizer] Disable getusershell interception for Android
Reviewers: vitalybuka, pcc, eugenis

Reviewed By: eugenis

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

llvm-svn: 350965
2019-01-11 20:09:24 +00:00
Dan Liew cb09a6f20c Provide storage for `true_type::value` and `false_type::value`.
Summary:
This fixes linker errors that occurs when the
`sanitizer_type_traits_test.cc` is built without optimizations.

The error occurs because the test tries to take a reference.
A possible workaround is to give the GTest macros take boolean rvalues
by doing something like:

```
ASSERT_TRUE(bool(is_same<uptr, uptr>::value));
```

However this only hides the problem. Unfortunately Using `constexpr`
won't fix the problem unless we are using C++17.

Reviewers: vitalybuka, kubamracek, george.karpenkov, yln

Subscribers: mgorny, #sanitizers, llvm-commits

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

llvm-svn: 350940
2019-01-11 17:59:52 +00:00
Matt Morehouse 1d36253fd8 XFAIL getusershell.cc on Android.
Android does not implement [set|get|end]usershell().

llvm-svn: 350935
2019-01-11 17:26:11 +00:00
David Carlier 8a81b29215 [Sanitizer] Intercept getusershell
- If entries are properly copied (there were a bug in FreeBSD implementation in earlier version), or list properly reset.

Reviewers: vitalybuka, krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350919
2019-01-11 05:53:09 +00:00
Julian Lettner 7d1085cbb0 [TSan] Remove ignore_interceptors_accesses flag
Summary:
It has been superseded by the `ignore_noninstrumented_modules` flag and is no longer needed.

Also simplify a test that checks that `mmap_interceptor` respects ignore annotations (`thr->ignore_reads_and_writes `).
Relevant: https://reviews.llvm.org/rL269855

<rdar://problem/46263073> Remove obsolete Apple-specific suppression option

Reviewers: dcoughlin, kubamracek, dvyukov, delcypher

Reviewed By: dvyukov

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350883
2019-01-10 20:04:33 +00:00
Michal Gorny 1765839052 [sanitizer_common] Define __sanitizer_FILE on NetBSD
Differential Revision: https://reviews.llvm.org/D56109

llvm-svn: 350882
2019-01-10 19:56:57 +00:00
Michal Gorny 5b2b63e524 [sanitizer_common] Remove support for tirpc/rpc/xdr.h
Remove the partial support for rpc/xdr.h from libtirpc.  Since it is
an entirely external library, we ought to build it sanitized separately
and not attempt to intercept like the libc implementation.  Besides,
the existing code for tirpc support was neither complete nor working.

Noted by @krytarowski.

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

llvm-svn: 350881
2019-01-10 19:56:50 +00:00
Amy Kwan 0b7c9e535b [compiler-rt][builtins][PowerPC] Implemented __floattitf builtin on PowerPC
This patch implements the long double __floattitf (int128_t) method for
PowerPC -- specifically to convert a 128 bit integer into a long double
(IBM double-double).

To invoke this method, one can do so by linking against compiler-rt, via the
--rtlib=compiler-rt command line option supplied to clang.

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

llvm-svn: 350818
2019-01-10 13:23:33 +00:00
Amy Kwan 941dacc360 [compiler-rt][builtins][PowerPC] Implemented __fixunstfti builtin on PowerPC
This patch implements the __uint128_t __fixunstfti (long double) method for
PowerPC -- specifically to convert a long double (IBM double-double) to an
unsigned 128 bit integer.

The general approach of this algorithm is to convert the high and low doubles
of the long double and add them together if the doubles fit within 64 bits.
However, additional adjustments and scaling is performed when the high or low
double does not fit within a 64 bit integer.

To invoke this method, one can do so by linking against compiler-rt, via the
--rtlib=compiler-rt command line option supplied to clang.

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

llvm-svn: 350815
2019-01-10 12:30:12 +00:00
Diana Picus decce55758 [asan] Mark tests as UNSUPPORTED on arm
Temporarily mark a couple of tests as UNSUPPORTED until we figure out
why they fail on the thumb bots.

The failure was introduced in
r350139 - Add support for background thread on NetBSD in ASan.

llvm-svn: 350806
2019-01-10 09:40:56 +00:00
David Carlier c1ba1eec69 i[Sanitizer] Enable pututxline interception
Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350796
2019-01-10 04:19:30 +00:00
Jonathan Metzman 55ddb2c790 [libfuzzer][MSVC] Make calls to builtin functions work with MSVC
Summary:
Replace calls to builtin functions with macros or functions that call the
Windows-equivalents when targeting windows and call the original
builtin functions everywhere else.
This change makes more parts of libFuzzer buildable with MSVC.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: mgorny, rnk, thakis

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

llvm-svn: 350766
2019-01-09 21:46:09 +00:00
David Carlier 5e53818be5 [asan] Disable TSD dtor leak unit tests on FreeBSD x86 64
- Assertion fails in the third iteration.

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350744
2019-01-09 17:14:57 +00:00
Michal Gorny 2c2d65efab [test] Detect glibc-2.27+ and XFAIL appropriate tests
XFAIL the tests known to fail with glibc-2.27+.  This takes away
the burden of handling known failures from users, and ensures that
we will be verbosely informed when they actually start working again.

Bug report: https://bugs.llvm.org/show_bug.cgi?id=37804

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

llvm-svn: 350717
2019-01-09 13:27:29 +00:00
Peter Collingbourne fdef020d80 hwasan: Ignore loads and stores of size 0.
Now that memory intrinsics are instrumented, it's more likely that
CheckAddressSized will be called with size 0. (It was possible before
with IR like:

  %val = load [0 x i8], [0 x i8]* %ptr

but I don't think clang will generate IR like that and the optimizer
would normally remove it by the time it got anywhere near our pass
anyway). The right thing to do in both cases is to disable the
addressing checks (since the underlying memory intrinsic is a no-op),
so that's what we do.

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

llvm-svn: 350683
2019-01-09 00:44:13 +00:00
David Carlier bfce66fbc1 [Sanitizer] Intercept fdevname on FreeBSD
- Is a file descriptor flavor FreeBSD's specific.
- reentrant version included.

Reviewers: vitalybuka, krytarowski, emaste

Reviewed By: emaste

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

llvm-svn: 350658
2019-01-08 21:49:37 +00:00
Evgeniy Stepanov 43cba99775 Fix Mac compilation.
Provide an implementation of MemoryMappingLayout::Error() for Mac.

llvm-svn: 350601
2019-01-08 02:02:27 +00:00