[ASan] Fix stack-overflow test for PowerPC
authorJay Foad <jay.foad@gmail.com>
Sat, 8 Nov 2014 09:51:45 +0000 (09:51 +0000)
committerJay Foad <jay.foad@gmail.com>
Sat, 8 Nov 2014 09:51:45 +0000 (09:51 +0000)
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

compiler-rt/lib/asan/asan_posix.cc

index da92619..f8c4e4c 100644 (file)
@@ -41,12 +41,12 @@ void AsanOnSIGSEGV(int, void *siginfo, void *context) {
   GetPcSpBp(context, &pc, &sp, &bp);
 
   // Access at a reasonable offset above SP, or slightly below it (to account
-  // for x86_64 redzone, ARM push of multiple registers, etc) is probably a
-  // stack overflow.
+  // for x86_64 or PowerPC redzone, ARM push of multiple registers, etc) is
+  // probably a stack overflow.
   // We also check si_code to filter out SEGV caused by something else other
   // then hitting the guard page or unmapped memory, like, for example,
   // unaligned memory access.
-  if (addr + 128 > sp && addr < sp + 0xFFFF &&
+  if (addr + 512 > sp && addr < sp + 0xFFFF &&
       (code == si_SEGV_MAPERR || code == si_SEGV_ACCERR))
     ReportStackOverflow(pc, sp, bp, context, addr);
   else