From: Jay Foad Date: Sat, 8 Nov 2014 09:51:45 +0000 (+0000) Subject: [ASan] Fix stack-overflow test for PowerPC X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f945ba85f06dca9f106d35098234cd43b588ad4;p=platform%2Fupstream%2Fllvm.git [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 llvm-svn: 221578 --- diff --git a/compiler-rt/lib/asan/asan_posix.cc b/compiler-rt/lib/asan/asan_posix.cc index da92619..f8c4e4c 100644 --- a/compiler-rt/lib/asan/asan_posix.cc +++ b/compiler-rt/lib/asan/asan_posix.cc @@ -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