Commit Graph

563 Commits

Author SHA1 Message Date
Viktor Kutuzov d98b348cb9 Enable running Ubsan tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D6089

llvm-svn: 221599
2014-11-10 15:31:56 +00:00
Viktor Kutuzov eb5e79550a [Ubsan] Fix the missing_return.cpp test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D6088

llvm-svn: 221597
2014-11-10 15:27:13 +00:00
Viktor Kutuzov f686063f57 [Ubsan] Fix the cast-overflow.cpp test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D6087

llvm-svn: 221596
2014-11-10 15:25:01 +00:00
Renato Golin 03603439e3 PPC fix works for ARM, too
llvm-svn: 221551
2014-11-07 21:55:11 +00:00
Jay Foad 46d5df53ab [ASan] Fix zero_page_pc test for PowerPC
Summary:
In the Power architecture, all branch instructions ignore the 2 least
significant bits of the target address. Consequently if you branch to an
invalid address, the address reported along with the SIGSEGV will have
been rounded down to a multiple of 4. Tweak this test accordingly.

This may fix the test for ARM too, in which case we could remove
the XFAIL, but I have no way of testing that.

Reviewers: kcc, willschm, glider, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221542
2014-11-07 20:42:11 +00:00
Alexey Samsonov fbaaed6b58 [Sanitizer] Introduce "stack_trace_format" runtime flag.
This flag can be used to specify the format of stack frames - user
can now provide a string with placeholders, which should be printed
for each stack frame with placeholders replaced with actual data.
For example "%p" will be replaced by PC, "%s" will be replaced by
the source file name etc.

"DEFAULT" value enforces default stack trace format currently used in
all the sanitizers except TSan.

This change also implements __sanitizer_print_stack_trace interface
function in TSan.

llvm-svn: 221469
2014-11-06 18:43:45 +00:00
Will Schmidt ae4236ac6a Use GET_CURRENT_FRAME() to calculate the memory layout for power. This works
for both PPC64 Big and Little endian modes, so also eliminates the need for
the BIG_ENDIAN/LITTLE_ENDIAN #ifdeffery.

By trial and error, it also looks like the kPPC64_ShadowOffset64 value is
valid using (1ULL << 41) for both BE and LE, so that #if/#elif/#endif block
has also been simplified.

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

llvm-svn: 221457
2014-11-06 14:58:06 +00:00
David Majnemer 3400563ea6 UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases
When the __virtual_mask is set, __offset_flags >> __offset_shift yields
an offset into the vtable.  Dereferencing this vtable slot gets us the
vbase offset.

Adjust a test case to verify that this, in fact, works.

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

llvm-svn: 221445
2014-11-06 08:55:23 +00:00
Kuba Brecka fe4e7c1716 Fix failing allow_user_segv.cc test on OS X 10.10
The current ASan testcase Posix/allow_user_segv.cc expects SIGBUS to be triggered on 32-bit Darwin. This has apparently changed on 10.10 to trigger SIGSEGV instead, just as on 64-bit. Let's just install handlers for both SIGSEGV and SIGBUS instead of #ifdef'ing.

Reviewed at http://reviews.llvm.org/D6121

llvm-svn: 221381
2014-11-05 18:58:41 +00:00
Peter Collingbourne f20091118c [dfsan] Add runtime function for aborting on indirect calls to
uninstrumented vararg functions.

llvm-svn: 221364
2014-11-05 17:21:11 +00:00
Renato Golin 883abab1e8 Disable XFAIL on ARM since the x86_64 specific code is isolated
llvm-svn: 221347
2014-11-05 14:44:58 +00:00
Jay Foad 70a3841a8f Get the Linux ptrace test working on PowerPC64
The test refers to user_regs_struct.rip so it can only ever have worked
on x86-64. Put this code inside an appropriate #if, and add a similar
case for PowerPC64. (If we do likewise for ARM we can probably remove
the XFAILs, but I have no way of testing that.)

Those changes are enough to get the test working for me on big-endian
PowerPC64 Fedora 19.

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

llvm-svn: 221337
2014-11-05 08:42:48 +00:00
Kuba Brecka 6c22aec23c Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.

Reviewed at http://reviews.llvm.org/D6018

llvm-svn: 221278
2014-11-04 17:34:50 +00:00
Alexey Samsonov 8f1632d5c1 [TSan] Don't strip binary/library name until the moment we print it.
This commit changes the place where TSan runtime turns full path
to binary or shared library into its basename
(/usr/foo/mybinary -> mybinary). Instead of doing it as early as possible
(when we obtained the full path from the symbolizer), we now do it as
late as possible (right before printing the error report).

This seems like a right thing to do - stripping to basename is a detail
of report formatting implementation, and should belong there. Also, we
might need the full path at some point - for example, to match the
suppressions.

llvm-svn: 221225
2014-11-04 01:55:20 +00:00
Kostya Serebryany b6eae0c2bc [asan] run-time part of the caller-callee coverage instrumentation
llvm-svn: 220975
2014-10-31 17:19:11 +00:00
Peter Collingbourne b190e1b74b Update __dfsw_s{,n}printf custom functions for new calling convention.
Differential Revision: http://reviews.llvm.org/D6029

llvm-svn: 220907
2014-10-30 13:23:01 +00:00
Viktor Kutuzov c8f3435f0e [Tsan] Enable thread sanitizer tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D5995

llvm-svn: 220676
2014-10-27 11:28:53 +00:00
Alexey Samsonov 3ca50c34ec Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer
llvm-svn: 220582
2014-10-24 18:34:43 +00:00
Dmitry Vyukov e9a5f03716 tsan: support mmap(MAP_32BIT)
Allow user memory in the first TB of address space.
This also enabled non-pie binaries and freebsd.
Fixes issue:
https://code.google.com/p/thread-sanitizer/issues/detail?id=5

llvm-svn: 220571
2014-10-24 17:07:29 +00:00
Viktor Kutuzov f266601ce9 [Tsan] Fix the thread_name tests to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5855

llvm-svn: 220552
2014-10-24 09:27:34 +00:00
Viktor Kutuzov 9003426e2f [Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5841

llvm-svn: 220550
2014-10-24 09:20:20 +00:00
Evgeniy Stepanov 35eb265421 [msan] Handle param-tls overflow.
ParamTLS (shadow for function arguments) is of limited size. This change
makes all arguments that do not fit unpoisoned, and avoids writing
past the end of a TLS buffer.

llvm-svn: 220351
2014-10-22 00:12:40 +00:00
Kostya Serebryany c9855da6d9 [asan] the run-time part of intra-object-overflow detector (-fsanitize-address-field-padding=1). Note that all of this is still experimental; don't use unless you are brave.
llvm-svn: 220013
2014-10-17 01:22:37 +00:00
Kostya Serebryany 87b70fc823 [asan] make sure coverage is dumped even if leaks are reported
llvm-svn: 219946
2014-10-16 18:59:07 +00:00
Renato Golin 6d41f7ae22 UBSAN stable runtime more generic with arm* targets
llvm-svn: 219924
2014-10-16 12:43:10 +00:00
Renato Golin 45abb8c969 Adds stable-runtime to ubsan to avoid broken ARM tests with asan
llvm-svn: 219906
2014-10-16 07:48:27 +00:00
Viktor Kutuzov 6b862f22e5 [Tsan] Fix the sunrpc.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5730

llvm-svn: 219791
2014-10-15 12:47:48 +00:00
Viktor Kutuzov adcf1ce904 [Tsan] Make the mutex_robust tests Linux-specific
Differential Revision: http://reviews.llvm.org/D5729

llvm-svn: 219790
2014-10-15 12:43:04 +00:00
Dmitry Vyukov 6373829449 tsan: fix false positive related to signals
Write interceptor calls malloc, which causes a false
unsafe-call-in-signal-handler report. See the test.

llvm-svn: 219784
2014-10-15 08:56:43 +00:00
Renato Golin 498b223eec Re-enable ASAN/UBSAN tests on ARM, with VFP3 they began to pass
When compiling with -mfpu=vfpv3, those tests began to pass, like the others
with "Illegal Instruction" error, so removing the XFAIL from them should
get the bot green (and have more tests!).

llvm-svn: 219721
2014-10-14 21:00:22 +00:00
Alexey Samsonov 37efdf0033 [UBSan] XFAIL test added in r219642 on Darwin
llvm-svn: 219699
2014-10-14 17:31:15 +00:00
Dmitry Vyukov ea2f3bffca tsan: refactor atexit handling
The current handling (manual execution of atexit callbacks)
is overly complex and leads to constant problems due to mutual ordering of callbacks.
Instead simply wrap callbacks into our wrapper to establish
the necessary synchronization.
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=80

llvm-svn: 219675
2014-10-14 09:32:45 +00:00
Alexey Samsonov eb47d8a2c8 Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642
2014-10-13 23:59:00 +00:00
Dmitry Vyukov 02ff8bb986 tsan: better reporting for virtual-call-after-free
Previously we said that it's a data race, which is confusing
if it happens in the same thread.

llvm-svn: 219600
2014-10-13 08:46:25 +00:00
Chandler Carruth 30bdfa7f99 [UBSan] Disable one run line of this test to allow the test as a whole
to pass in an opt build.

The test case in question does show UBSan catching the error, but it
doesn't then successfully set the exit code of the program. I'll let the
UBSan folks sort out why. It should reproduce trivially with an
optimized build.

llvm-svn: 219563
2014-10-11 06:49:00 +00:00
Alexey Samsonov 19c2e631bd [UBSan] Fix UBSan testcase for float->int conversion after LLVM r219542.
llvm-svn: 219559
2014-10-11 01:34:16 +00:00
Petar Jovanovic a1ac4b2f6a [asan][mips] Adding support of asan for mipsel arch
cmake/config-ix.cmake: Enabled building of asan for mipsel arch
test/asan/CMakeLists.txt: Enabled testing of asan for mipsel

Patch by Kumar Sukhani

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

llvm-svn: 219496
2014-10-10 13:46:55 +00:00
Renato Golin 1a8093c3a7 Disabling main() check on UBSAN, since the noreturn check is already made
llvm-svn: 219488
2014-10-10 10:26:14 +00:00
Viktor Kutuzov e3b6a6a379 [Tsan] Fix the getline_nohang.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5666

llvm-svn: 219482
2014-10-10 07:07:26 +00:00
Viktor Kutuzov 348758bbca [Tsan] Fix comments in the user_fopen.cc and user_malloc.cc tests
Related revision: http://reviews.llvm.org/D5670

llvm-svn: 219481
2014-10-10 07:01:52 +00:00
Viktor Kutuzov 918df1abd8 [Tsan] Make the user_fopen.cc and user_malloc.cc tests Linux-specific
Differential Revision: http://reviews.llvm.org/D5670

llvm-svn: 219478
2014-10-10 06:55:17 +00:00
Renato Golin e68963a986 XFAIL some more sanitiser ARMv7l tests
Some more tests failing on the ARMv7 buildbot.

llvm-svn: 219404
2014-10-09 11:34:40 +00:00
Viktor Kutuzov e17b55be69 [Tsan] Fix the signal_errno.cc and signal_malloc.cc tests to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5669

llvm-svn: 219399
2014-10-09 09:40:02 +00:00
Viktor Kutuzov c2e274dc2c [Tsan] Fix the global_race tests to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5668

llvm-svn: 219398
2014-10-09 09:35:25 +00:00
Viktor Kutuzov 27781f993d [Tsan] Fix the blacklist2.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D5665

llvm-svn: 219397
2014-10-09 09:04:26 +00:00
Renato Golin 1aaa4bcdd1 Mark sanitizer tests XFAIL on ARMv7
ASAN, UBSAN and profile tests that don't work with arm-linux-gnueabi and
android also don't work on armv7l-linux-gnueabihf. Some of the tests have
known causes, others not yet. In order to get a green bot, I'm disabling
those tests for now and will investigate when the priority rises.

llvm-svn: 219343
2014-10-08 21:13:23 +00:00
Lorenzo Martignoni 60ebffc12f Custom wrappers for DFSanitizing sprintf & snprintf.
Differential Revision: http://reviews.llvm.org/D5561

llvm-svn: 219293
2014-10-08 10:01:42 +00:00
Ed Maste 1419e9adb5 Run profile tests on FreeBSD
FreeBSD does not have libdl, so set it via lit.cfg instead of the test
input, as with asan.  Also remove it from Darwin test runs - it's not
necessary, but harmless there.

Add FreeBSD to the list of hosts to test.

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

llvm-svn: 219227
2014-10-07 19:24:24 +00:00
Yuri Gorshenin d6c04770c1 Fixed asan-asm-stacktrace-test.cc
Summary: Fixed asan-asm-stacktrace-test.cc. Now it's supported on x86_64 and added test run when no debug info is generated.

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

llvm-svn: 219200
2014-10-07 11:12:55 +00:00
Kostya Serebryany 36aa17a4e3 [asan] make new_array_cookie_test more robust
llvm-svn: 218841
2014-10-01 23:24:54 +00:00