[compiler-rt] r266593 - [asan] [SystemZ] Add slop for stack address detection.

Marcin Koscielnicki via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 02:01:21 PDT 2016


Author: koriakin
Date: Mon Apr 18 04:01:19 2016
New Revision: 266593

URL: http://llvm.org/viewvc/llvm-project?rev=266593&view=rev
Log:
[asan] [SystemZ] Add slop for stack address detection.

On s390, siginfo reports the faulting address with page granularity -
we need to mask off the low bits of sp before comparison.

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

Modified:
    compiler-rt/trunk/lib/asan/asan_posix.cc

Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=266593&r1=266592&r2=266593&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_posix.cc Mon Apr 18 04:01:19 2016
@@ -43,7 +43,15 @@ void AsanOnDeadlySignal(int signo, void
   // 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__
+  // On s390, the fault address in siginfo points to start of the page, not
+  // to the precise word that was accessed.  Mask off the low bits of sp to
+  // take it into account.
+  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.




More information about the llvm-commits mailing list