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


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221337 91177308-0d34-0410-b5e6-96231b3b80d8
Disable XFAIL on ARM since the x86_64 specific code is isolated

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221347 91177308-0d34-0410-b5e6-96231b3b80d8
When run on a ppc64le based platform, the check-sanitizer build looks for
objects with the powerpc64le name. i.e. asan-powerpc64le.a
This change allows those objects to be built.

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




git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221356 91177308-0d34-0410-b5e6-96231b3b80d8
[dfsan] Modify build-libc-list.py to filter out local functions in generated
ABI list.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221361 91177308-0d34-0410-b5e6-96231b3b80d8
[dfsan] Upgrade ABI list to Ubuntu 14.04.

This incorporates some of the newer functions used by (e.g.) the Go runtime.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221362 91177308-0d34-0410-b5e6-96231b3b80d8
[dfsan] Add libgo functions to ABI list.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221363 91177308-0d34-0410-b5e6-96231b3b80d8
[dfsan] Add runtime function for aborting on indirect calls to
uninstrumented vararg functions.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221364 91177308-0d34-0410-b5e6-96231b3b80d8
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



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221379 91177308-0d34-0410-b5e6-96231b3b80d8
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



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221380 91177308-0d34-0410-b5e6-96231b3b80d8
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



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221381 91177308-0d34-0410-b5e6-96231b3b80d8
[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

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221409 91177308-0d34-0410-b5e6-96231b3b80d8
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

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221445 91177308-0d34-0410-b5e6-96231b3b80d8
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




git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221457 91177308-0d34-0410-b5e6-96231b3b80d8
[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.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221469 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] Never remove the last frame off the stack trace.

It can only make it worse.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221520 91177308-0d34-0410-b5e6-96231b3b80d8
[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

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221542 91177308-0d34-0410-b5e6-96231b3b80d8
PPC fix works for ARM, too

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221551 91177308-0d34-0410-b5e6-96231b3b80d8
Use @rpath for ASan dylib in Makefiles

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



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221556 91177308-0d34-0410-b5e6-96231b3b80d8
[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

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221578 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizers] Enable stack traces on FreeBSD
Differential Revision: http://reviews.llvm.org/D6086


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221595 91177308-0d34-0410-b5e6-96231b3b80d8