Commit Graph

4817 Commits

Author SHA1 Message Date
Evgeniy Stepanov e0a026f8ad [asan] Re-enable zero_page_pc test on Android.
It's not failing anymore. Not sure what has changed (the bot was down for a
long time), but lets keep it this way.

llvm-svn: 222236
2014-11-18 14:28:57 +00:00
Evgeniy Stepanov ca72ebb9ce [asan] Fix CMake CMP0046 warning in standalone build.
Make FileCheck an "imported dependency" in standalone build.

llvm-svn: 222234
2014-11-18 14:04:12 +00:00
Evgeniy Stepanov 7555f5ed1f [msan] Remove MSanDR and supporting code.
MSanDR is a dynamic instrumentation tool that can instrument the code
(prebuilt libraries and such) that could not be instrumented at compile time.

This code is unused (to the best of our knowledge) and unmaintained, and
starting to bit-rot.

llvm-svn: 222232
2014-11-18 10:33:15 +00:00
Dmitry Vyukov bd167973b4 tsan: add description of AcquireGlobal function
llvm-svn: 222228
2014-11-18 06:44:43 +00:00
Jay Foad 670bdb5a64 Revert r222091 because it caused a buildbot failure.
llvm-svn: 222095
2014-11-16 09:44:37 +00:00
Jay Foad 83c97c6997 [ASan] Fix leak tests on 64-bit targets other than x86-64
Summary:
This test explicitly sets ASAN_OPTIONS=detect_leaks=1 which is only
supported on x86-64. The test is currently restricted to run only on
64-bit targets, but needs to be restricted further so it only runs on
x86-64.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 222091
2014-11-15 23:00:14 +00:00
Jay Foad eb392de411 As a follow up to r222001, Peter Bergner pointed out that there is
nothing 64-bit-specific about the PowerPC stack overflow detection.

llvm-svn: 222084
2014-11-15 13:52:10 +00:00
Kostya Serebryany 183cb6e35d [asan] add interface function __sanitizer_get_total_unique_coverage; useful for coverage-guided in-process fuzzers
llvm-svn: 222060
2014-11-14 23:15:55 +00:00
Jay Foad 1180c05db2 [ASan] Improved stack overflow detection for PowerPC64
Summary:
AsanOnSIGSEGV has some heuristics for detecting stack overflow, but
they don't cope with a PowerPC store-with-update instruction which
modifies sp and stores to the modified address in one instruction.

This patch adds some PowerPC-specific code to check for this case.

This fixes the last few cases of the stack-overflow test.

Reviewers: kcc, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 222001
2014-11-14 15:30:39 +00:00
Evgeniy Stepanov ceaebb8ebb [sanitizer] Extend a comment in SlowUnwind.
This better explains a change in r221520.

llvm-svn: 222000
2014-11-14 15:13:23 +00:00
Evgeniy Stepanov ba7308c07e [asan] Revert r221882.
This code is not part of ASan runtime (as it may be linked into a different
DSO), and thus can not call non-exported functions.

llvm-svn: 221986
2014-11-14 13:02:28 +00:00
Alexey Samsonov cbbd2fd8d6 [Profile] Always build profile runtime library with -fPIC.
This change removes libclang_rt.profile-pic-<arch>.a version of
profile runtime. Instead, it's sufficient to always build
libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into
both executables and shared objects.

llvm-svn: 221952
2014-11-14 00:16:26 +00:00
Alexey Samsonov 4925fd4b05 Fix -Wcast-qual warnings in sanitizers
llvm-svn: 221936
2014-11-13 22:40:59 +00:00
Jay Foad 66928be0af [ASan] Really fix zero_page_pc test for PowerPC
Summary:
As a follow-up to D6167, this patch fixes the test to account for
another difference between PowerPC and x86 systems.

On x86 if you branch to an invalid address, you get a SIGSEGV with PC
set to the invalid address (and si_addr in the siginfo struct also set
to the same address).

On PowerPC, you get a SIGSEGV with PC pointing at the branch
instruction, but si_addr set to the invalid address.

You can see this difference if you run the test case under gdb.

Reviewers: kcc, glider, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221929
2014-11-13 21:53:00 +00:00
Alexey Samsonov 829da45631 [CMake] Detect if -Wfoo is supported instead of -Wno-foo, as GCC occasionally silently discards unknown -Wno-foo flags.
llvm-svn: 221925
2014-11-13 21:19:53 +00:00
Yury Gribov ecfa592671 Removed r221896, it seems to break build in various ways.
llvm-svn: 221912
2014-11-13 19:37:30 +00:00
Yury Gribov 17072ef348 [ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.
Reviewed at http://reviews.llvm.org/D5724

llvm-svn: 221896
2014-11-13 16:01:23 +00:00
Evgeniy Stepanov 3217c6a52c [asan] Switch to AsanInitFromRtl in .preinit_array.
There is no functionality change due to a check in AsanActivate.

llvm-svn: 221882
2014-11-13 09:50:56 +00:00
Jay Foad 8e586617c4 InstrProf: support PowerPC64
Summary:
I don't know anything about profiling but it seems to work out of the
box on PowerPC64. At least "make check-profile" works.

A few tests needed tweaking because PowerPC64 IR declares main with
"define signext i32 @main" instead of just "define i32 @main".

This also fixes the asan asan_and_llvm_coverage_test test, which
compiles with -coverage so requires that a profiling version of
libclang_rt has been built.

Reviewers: dexonsmith, kcc, samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

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

llvm-svn: 221877
2014-11-13 09:24:32 +00:00
Jay Foad 347a2b7cd4 [ASan] Fix large allocator test case to cope with 64k pages
Summary: My PowerPC64 Linux box has 64k pages. The test assumes 4k pages. Fix it.

Reviewers: glider, eugenis, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221875
2014-11-13 09:15:15 +00:00
Bob Wilson ec9a8c8b10 PR21518: Use unsigned arithmetic for trapping add/sub functions.
The code in {add,sub}v.i3 routines does not trap when it should, because
it performs the actual add/subtract operation in signed arithmetic,
rather than unsigned.

Patch by Francois-Xavie Coudert!

llvm-svn: 221826
2014-11-12 23:01:24 +00:00
Timur Iskhodzhanov c80bd6974e Add a test for PR21528 to make sure ASan C++ symbolization doesn't regress
llvm-svn: 221814
2014-11-12 20:37:57 +00:00
Kostya Serebryany 2dd74371b2 [asan] [mips] added support of asan for mips64/mips64el, patch by Kumar Sukhani
llvm-svn: 221800
2014-11-12 18:23:16 +00:00
Jay Foad 9b70a919db [ASan] Skip dump_instruction_bytes test on non-x86 targets
Summary: This test case is blatantly x86-specific, so skip it on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221778
2014-11-12 09:45:40 +00:00
Jay Foad 854655886b [ASan] Skip ptrace test on non-x86 targets
Summary:
Address sanitization of ptrace(2) is only implemented for x86, so skip
the test on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221777
2014-11-12 09:42:01 +00:00
Richard Trieu b6b141d601 delete => delete[] for arrays.
llvm-svn: 221769
2014-11-12 04:19:57 +00:00
Kostya Serebryany 8278644dc8 [asan] fix coverage tests to use the new flag syntax (-fsanitize-coverage=N)
llvm-svn: 221720
2014-11-11 22:15:44 +00:00
Jay Foad cf2d4b8ea4 [ASan] Fix use of -asan-instrument-assembly in tests
Summary:
The option -asan-instrument-assembly is declared in the X86 backend.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=All then the
option is tolerated but ignored.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=PowerPC then
the testsuite fails with:
[ 93%] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64-inline.o
clang (LLVM option parsing): Unknown command line argument '-asan-instrument-assembly'.  Try: 'clang (LLVM option parsing) -help'

Fix this inconsistency by only adding the option if that toolchain was
built with the X86 backend included.

Reviewers: kcc, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 221687
2014-11-11 13:44:08 +00:00
Bob Wilson fc410b6aaf Add a missing parenthesis mistakenly dropped in r221621.
llvm-svn: 221656
2014-11-11 02:05:56 +00:00
Bob Wilson 442e1e05e9 Clean up indentation after previous change.
llvm-svn: 221622
2014-11-10 19:38:18 +00:00
Bob Wilson 8aa9ab104c Build Darwin libclang_rt libraries against real SDKs.
The minimal fake SDK was very useful in allowing us to build for all
Darwin platforms without needing access to the real SDKs, but it did
not support building any of the sanitizer runtimes. It's important to
fix that. As a consequence, if you don't have the iOS SDKs installed,
we will now skip building the iOS-specific libclang_rt libraries.
rdar://problem/18825276

llvm-svn: 221621
2014-11-10 19:38:15 +00:00
Bob Wilson da37021cf3 Do not build a separate x86_64h Haswell slice for the iOS simulator.
r199996 added new x86_64h slices for all the Darwin compiler_rt libraries
that had an x86_64 slice, but that is overkill for the iOS Simulator
platform where the x86_64h slice is never used.

llvm-svn: 221610
2014-11-10 17:05:21 +00:00
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
Viktor Kutuzov dc6cbfe859 [Sanitizers] Enable stack traces on FreeBSD
Differential Revision: http://reviews.llvm.org/D6086

llvm-svn: 221595
2014-11-10 15:22:04 +00:00
Jay Foad 2f945ba85f [ASan] Fix stack-overflow test for PowerPC
Summary:
Tweak the asan stack overflow heuristics to cope with PowerPC64 redzones,
which are larger than on x86-64: 288 bytes for big-endian and 512 bytes
for little-endian.

Reviewers: kcc, willschm, samsonov, eugenis

Reviewed By: samsonov, eugenis

Subscribers: llvm-commits

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

llvm-svn: 221578
2014-11-08 09:51:45 +00:00
Kuba Brecka 98e486e11c Use @rpath for ASan dylib in Makefiles
Reviewed at http://reviews.llvm.org/D6176

llvm-svn: 221556
2014-11-07 22:27:12 +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
Evgeniy Stepanov 70075620b3 [sanitizer] Never remove the last frame off the stack trace.
It can only make it worse.

llvm-svn: 221520
2014-11-07 12:03:07 +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
Alexey Samsonov 70f3897b0a [Sanitizer] Introduce generic stack frame rendering machinery
Summary:
This commit introduces function __sanitizer::RenderFrame()
that allows to render the contents of AddressInfo (essentially, symbolized stack frame)
using the custom format string. This function can be used to
implement stack frame formatting for both ThreadSanitizer and
generic StackTrace::Print(), used in another places. This paves the
way towards allowing user to control the format of stack frames,
obtaining them in any format he desires, and/or enforcing the consistent
output from all sanitizers.

Test Plan: compiler-rt test suite

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 221409
2014-11-05 22:44:36 +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
Kuba Brecka 0078cea792 Extend the OS X pthread_get_stacksize_np workaround to 10.10
Fixes a failing ASan testcase (TestCases/stack-use-after-return.cc) on OS X 10.10.

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

llvm-svn: 221380
2014-11-05 18:55:38 +00:00
Kuba Brecka f4bdbde26f Extend Mac OS versions to Yosemite
This also fixes the test/asan/TestCases/Darwin/malloc_zone-protected.cc test failure on OS X 10.10.

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

llvm-svn: 221379
2014-11-05 18:53:22 +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
Peter Collingbourne 4da39395b0 [dfsan] Add libgo functions to ABI list.
llvm-svn: 221363
2014-11-05 17:21:08 +00:00