[PATCH] D19112: [asan] [SystemZ] Add slop for stack address detection.

Marcin Koƛcielnicki via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 06:26:26 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, siginfo reports the faulting address with page granularity -
we need to mask off the low bits of sp before comparison.

Repository:
  rL LLVM

http://reviews.llvm.org/D19112

Files:
  lib/asan/asan_posix.cc

Index: lib/asan/asan_posix.cc
===================================================================
--- lib/asan/asan_posix.cc
+++ lib/asan/asan_posix.cc
@@ -43,7 +43,14 @@
   // Access at a reasonable offset above SP, or slightly below it (to account
   // for x86_64 or PowerPC redzone, ARM push of multiple registers, etc) is
   // probably a stack overflow.
+#ifdef __s390__
+  // For s390, allow a full page of slop - the address from siginfo only has
+  // page granularity.
+  bool IsStackAccess = sig.addr >= (sig.sp & ~0xFFF) &&
+                       sig.addr < sig.sp + 0xFFFF;
+#else
   bool IsStackAccess = sig.addr + 512 > sig.sp && sig.addr < sig.sp + 0xFFFF;
+#endif
 
 #if __powerpc__
   // Large stack frames can be allocated with e.g.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19112.53702.patch
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160414/0ea0f4da/attachment-0001.bin>


More information about the llvm-commits mailing list