[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

llvm-svn: 266593
This commit is contained in:
Marcin Koscielnicki 2016-04-18 09:01:19 +00:00
parent cf6bbd3909
commit 48f32510da
1 changed files with 8 additions and 0 deletions

View File

@ -43,7 +43,15 @@ void AsanOnDeadlySignal(int signo, void *siginfo, void *context) {
// 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.