Commit Graph

5606 Commits

Author SHA1 Message Date
Evgeniy Stepanov
42fb96652b [sanitizer] Add -lrt to dyndd link line.
llvm-svn: 238626
2015-05-29 22:57:15 +00:00
Justin Bogner
ba6e2ae0c5 profile: Fix link errors in this test on darwin
llvm-svn: 238622
2015-05-29 22:41:25 +00:00
Evgeniy Stepanov
8e9c70be7f Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.
This is done by creating a named shared memory region, unlinking it
and setting up a private (i.e. copy-on-write) mapping of that instead
of a regular anonymous mapping. I've experimented with regular
(sparse) files, but they can not be scaled to the size of MSan shadow
mapping, at least on Linux/X86_64 and ext3 fs.

Controlled by a common flag, decorate_proc_maps, disabled by default.

This patch has a few shortcomings:
* not all mappings are annotated, especially in TSan.
* our handling of memset() of shadow via mmap() puts small anonymous
  mappings inside larger named mappings, which looks ugly and can, in
  theory, hit the mapping number limit.

llvm-svn: 238621
2015-05-29 22:31:28 +00:00
Reid Kleckner
ea09c99a4c Use sanitizer_atomic_clang.h with clang-cl instead of the MSVC variant
llvm-svn: 238585
2015-05-29 17:56:39 +00:00
Yury Gribov
9ebb303459 [ASan] Fix flaky tests (see https://llvm.org/bugs/show_bug.cgi?id=23230).
Patch by Maria Guseva!

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

llvm-svn: 238545
2015-05-29 06:45:13 +00:00
Evgeniy Stepanov
bab1a075df [asan] Add new(unsigned int) to ASan interface list.
Also, sized-delete with size_t == unsigned int.
These guys appear when building for Android with gnu-stl.

Fixes a number of ASan tests in that particular configuration.

llvm-svn: 238484
2015-05-28 20:37:50 +00:00
Ed Maste
3fa1b65c1c Use /usr/bin/env to find python
Python may not be /usr/bin/python on some systems. For example, on
FreeBSD it will be /usr/local/bin/python.

Reviewers: samsonov
Differential Revision: http://reviews.llvm.org/D9914

llvm-svn: 238428
2015-05-28 14:53:14 +00:00
Yury Gribov
83aaa8e05c [ASan] Disable alloca tests on ARM targets due to flakiness.
llvm-svn: 238426
2015-05-28 14:29:12 +00:00
Yury Gribov
64c701b3f7 [ASan] XFAIL VLA tests on ARM and PowerPC. Patch by Max Ostapenko!
llvm-svn: 238409
2015-05-28 10:30:46 +00:00
Yury Gribov
73570f4323 [ASan] Add new interceptors to asan_win_dll_thunk.cc to fix build errors on Windows.
Patch by Maria Guseva!

llvm-svn: 238407
2015-05-28 10:21:59 +00:00
Yury Gribov
0ca65fd83d [sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, strpbrk.
Patch by Maria Guseva.

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

llvm-svn: 238406
2015-05-28 09:24:33 +00:00
Yury Gribov
63d9764585 [ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!
Differential Revision: http://reviews.llvm.org/D7098

llvm-svn: 238401
2015-05-28 07:49:05 +00:00
Evgeniy Stepanov
1f1d9f27fd [asan] Fix build dependency issues with ASan version list file.
CMake pre-3.1 has a bug where a shared library depending on a custom_target
does not really depend on it.

This commit implements a hilariously ugly workaround for this problem, see
code comments for more details.

llvm-svn: 238367
2015-05-27 22:38:01 +00:00
Diego Novillo
c88d5b6acd Test case for PR 23499.
llvm-svn: 238338
2015-05-27 17:03:26 +00:00
Evgeniy Stepanov
d99717226d [msan] Fix mmap test on Fedora.
llvm-svn: 238226
2015-05-26 18:02:54 +00:00
Evgeniy Stepanov
45328240dc [msan] Mprotect all inaccessible memory regions.
Fix 2 bugs in memory mapping setup:
- the invalid region at offset 0 was not protected because mmap at
  address 0 fails with EPERM on most Linux systems. We did not
  notice this because the check condition was flipped: the code was
  checking that mprotect has failed. And the test that was supposed
  to catch this was weakened by the mitigations in the mmap
  interceptor.
- when running without origins, the origin shadow range was left
  unprotected.

The new test ensures that mmap w/o MAP_FIXED always returns valid
application addresses.

llvm-svn: 238109
2015-05-24 02:47:59 +00:00
Kostya Serebryany
05425a88cd [dfsan] ignore more __sanitizer callbacks
llvm-svn: 238085
2015-05-23 01:56:39 +00:00
Saleem Abdulrasool
a3b3952ccd builtins: mark functions as aapcs on Windows
Windows does not use AAPCS, but rather AAPCS-VFP, and thus the functions which
are assumed to be AAPCS will cause invalid argument setup.  Ensure that the
functions are marked as AAPCS.

llvm-svn: 238056
2015-05-22 21:47:24 +00:00
Nick Kledzik
506813892e [darwin] fix libcompiler_rt.dylib build
The dylib build of compiler-rt has been broken on darwin since the
directory restructuring to push some things down into /builtins/.

llvm-svn: 237848
2015-05-20 22:37:46 +00:00
Reid Kleckner
868a6c3023 Revert some of "Silence some CMake 3.3 dev warnings in compiler-rt"
This reverts part of r237808.

The CMP0057 warnings came from an old development build of CMake that
nobody else has. We don't need the cruft.

llvm-svn: 237819
2015-05-20 18:39:59 +00:00
Reid Kleckner
aa9029691f Silence some CMake 3.3 dev warnings in compiler-rt
Fix a trivial instance of CMP0054 that came up on llvmdev.

The other warnings were CMP0057, which is about using the same file as a
MAIN_DEPENDENCY multiple times.  The old behavior hasn't been a problem
yet, so I silenced the warning and filed PR23595 to document the issue
if someone cares.

llvm-svn: 237808
2015-05-20 16:56:17 +00:00
Peter Collingbourne
c6c660b3dd Factor out LTO detection to common configuration.
This will allow us to test other sanitizers with LTO.

llvm-svn: 237747
2015-05-19 23:50:13 +00:00
Peter Collingbourne
47b4e4ca01 CFI: Remove <utility> include.
It is unused, and causes a test failure on Darwin.

llvm-svn: 237746
2015-05-19 23:50:11 +00:00
Reid Kleckner
1cdd948f5b [ASan/Win] Add DLL thunk for new coverage hook
Should fix dll_host.cc test failing on bots.

llvm-svn: 237725
2015-05-19 21:02:23 +00:00
Sagar Thakur
3ee5bd9377 [sanitizer][MIPS] Add --target flag for MIPS32
Without the --target flag, clang uses the mips64 triple which selects the n64 abi. We need to add --target=mips-linux-gnu, so that clang can select the correct abi for mips32r2.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9249

llvm-svn: 237675
2015-05-19 09:07:37 +00:00
Evgeniy Stepanov
270c5257e6 [asan] Disable static-tls test on PowerPC.
llvm-svn: 237534
2015-05-17 05:24:09 +00:00
Evgeniy Stepanov
7f6290ca9a [sanitizer] Recognize static TLS in __tls_get_addr interceptor.
Current code tries to find the dynamic TLS header to the left of the
TLS block without checking that it's not a static TLS allocation.

llvm-svn: 237495
2015-05-16 00:34:15 +00:00
Kostya Serebryany
7747762df9 [tsan] deflakify one more tsan test
llvm-svn: 237387
2015-05-14 20:27:12 +00:00
Ahmed Bougacha
c9fa0b8e21 [Builtins] Wire half-precision conversions through cc_kext makefiles.
Kernel side of r237329.

llvm-svn: 237330
2015-05-14 02:21:02 +00:00
Ahmed Bougacha
a5d1a91163 [Builtins] Wire half-precision conversions through Darwin makefiles.
Follow-up to r237161, modeled after r236805.

Note that arm64 is omitted on purpose, as the conversions are supported
natively there.

llvm-svn: 237329
2015-05-14 01:47:32 +00:00
Ahmed Bougacha
9a43d5be2f [Builtins] Implement f2h/h2f by jumping to trunc/extend.
Follow-up to r237161; seems like we can't use aliases, but we
can do better than duplicating the bodies, especially when that
body, after inlining, isn't as small as it looks.

Better approaches welcome.  Perhaps the best thing is just to have
an #ifndef __APPLE__ over the GNUEABI names, since they're not used
there.

llvm-svn: 237323
2015-05-14 00:50:28 +00:00
Ismail Pazarbasi
0da8da5898 Include missing 'sanitizer_platform_limits_posix.h'
Unbreak Mac builds. `#include` seems to be forgotten during staging.

llvm-svn: 237190
2015-05-12 21:30:16 +00:00
Ismail Pazarbasi
6fb3b4ba89 Call system's sigfillset and sigprocmask functions from sanitizers
Reviewers: kcc, glider, dvyukov

Subscribers: llvm-commits

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

llvm-svn: 237177
2015-05-12 20:56:44 +00:00
Ismail Pazarbasi
b981dc8479 Sanitizers: Implement GetRSS on Mac OS X
Reviewers: kcc, glider, dvyukov

Subscribers: llvm-commits

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

llvm-svn: 237173
2015-05-12 20:47:21 +00:00
Ahmed Bougacha
f1ac850e77 [Builtins] Implement half-precision conversions.
Mostly uninteresting, except:
- in __extendXfYf2, when checking if the number is normal, the old
  code relied on the unsignedness of src_rep_t, which is a problem
  when sizeof(src_rep_t) < sizeof(int): the result gets promoted to
  int, the signedness of which breaks the comparison.
  I added an explicit cast; it shouldn't affect other types.
- we can't pass __fp16, so src_t and src_rep_t are the same.
- the gnu_*_ieee symbols are simply duplicated definitions, as aliases
  are problematic on mach-o (where only weak aliases are supported;
  that's not what we want).

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

llvm-svn: 237161
2015-05-12 18:33:42 +00:00
Sergey Matveev
f57fb6ce1a [sanitizer] Update "sancov.py missing" to allow __sanitizer_cov_with_check().
llvm-svn: 237149
2015-05-12 16:46:54 +00:00
Sergey Matveev
2680fe5f07 [sanitizer] Override pipefail in coverage-missing test.
This should finally fix it.

llvm-svn: 237147
2015-05-12 16:32:41 +00:00
Sergey Matveev
1a66c0ba53 [sanitizer] Re-enable a broken test with debug output.
llvm-svn: 237137
2015-05-12 14:43:31 +00:00
Evgeniy Stepanov
d7b3ef65bb [asan] Disable coverage-missing test failing on the bots.
llvm-svn: 237049
2015-05-11 21:16:18 +00:00
Alexey Samsonov
c200b5c6ea [UBSan] Add missing header that defines SANITIZER_CAN_USE_PREINIT_ARRAY
Otherwise this compile definition was undefined, and .preinit_array
was never used on the platforms that support it.

llvm-svn: 237045
2015-05-11 21:06:49 +00:00
Viktor Kutuzov
104a383e12 [Msan] Fix the if_indextoname.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9456

llvm-svn: 236999
2015-05-11 14:46:16 +00:00
Kostya Serebryany
8fd66a71c4 [asan/fuzzer] define a dummy weak __sanitizer_cov_trace_cmp
llvm-svn: 236907
2015-05-08 21:32:03 +00:00
Sergey Matveev
42cc8fa592 [sanitizer] Attempt to fix the test for missing coverage script.
llvm-svn: 236877
2015-05-08 16:30:01 +00:00
Sagar Thakur
3e493037be [TSan][MIPS] XFAIL long jump tests for MIPS64
Mark longjmp tests as XFAIL because longjmp assembly for mips is not yet implemented.

Reviewers: dsanders, dvyukov, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9526

llvm-svn: 236847
2015-05-08 12:58:03 +00:00
Sagar Thakur
6c253006b8 [ASAN] Use regex for addresses in kernel_area.cc test
This test was failing on mips because mips addresses are 40-bit long.
Using regex for address solves this issue.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9516

llvm-svn: 236844
2015-05-08 12:47:10 +00:00
Viktor Kutuzov
b0d28db6f1 [Msan] Fix the report-demangling.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9554

llvm-svn: 236833
2015-05-08 12:10:46 +00:00
Viktor Kutuzov
7d5dfe1f34 [Msan] Make the obstack.cc test Linux-specific
Differential Revision: http://reviews.llvm.org/D9552

llvm-svn: 236831
2015-05-08 12:07:20 +00:00
Justin Bogner
fa7525935b builtins: Implement the functions from stdatomic.h
Talking to John and Doug, we concluded that these functions from
stdatomic really do belong here in compiler-rt rather than in libc,
since the compiler owns stdatomic.h and these need to refer to
clang-specific builtins. Nonetheless, I've only added these on darwin
for now - other platforms should probably do the same unless their
libc does implement these functions.

llvm-svn: 236805
2015-05-08 05:39:05 +00:00
Alexey Samsonov
8e5e8fb2f3 [SanitizerCoverage] Upgrade lit tests to new -fsanitize-coverage= flags.
llvm-svn: 236796
2015-05-07 23:20:47 +00:00
Viktor Kutuzov
d046d24461 Intercept scandir() on FreeBSD
Committed unreviewed with premission.

llvm-svn: 236720
2015-05-07 12:14:32 +00:00