[PATCH] D18895: [sanitizer] [SystemZ] Fix stack traces.

Marcin Koƛcielnicki via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 03:21:04 PDT 2016


koriakin created this revision.
koriakin added reviewers: uweigand, samsonov, eugenis.
koriakin added a subscriber: llvm-commits.
koriakin set the repository for this revision to rL LLVM.
koriakin added a project: Sanitizers.

On s390, the return address is in %r14, which is saved 14 words from
the frame pointer.

Unfortunately, there's no way to do a proper fast backtrace on SystemZ
with current LLVM - the saved %r15 in fixed-layout register save
area points to the containing frame itself, and not to the next one.
Likewise for %r11 - it's identical to %r15, unless alloca is used
(and even if it is, it's still useless).  There's just no way to
determine frame size / next frame pointer.  -mbackchain would fix that
(and make the current code just work), but that's not yet supported
in LLVM.  The end result is that stack traces show only 2 functions.
We will thus need to XFAIL some asan tests
(Linux/stack-trace-dlclose.cc, deep_stack_uaf.cc).


Repository:
  rL LLVM

http://reviews.llvm.org/D18895

Files:
  lib/sanitizer_common/sanitizer_stacktrace.cc

Index: lib/sanitizer_common/sanitizer_stacktrace.cc
===================================================================
--- lib/sanitizer_common/sanitizer_stacktrace.cc
+++ lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -92,6 +92,8 @@
         !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
       break;
     uhwptr pc1 = caller_frame[2];
+#elif defined(__s390__)
+    uhwptr pc1 = frame[14];
 #else
     uhwptr pc1 = frame[1];
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18895.53011.patch
Type: text/x-patch
Size: 439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160408/3e2a1450/attachment.bin>


More information about the llvm-commits mailing list