diff options
author | Kuba Mracek <mracek@apple.com> | 2018-04-13 00:29:24 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2018-04-13 00:29:24 +0000 |
commit | a33ed44a99ba5d2bbb24ae494b044921bb31303b (patch) | |
tree | 9e06d77a512dd8bf6c011bcda8e900dc35190631 /lib | |
parent | 21c7e612f7e3070cd46306ba98882270b3665907 (diff) |
[asan] Reduce flakiness in stack-overflow detection
IsStackOverflow only treats accesses within 512 bytes of SP as stack-overflow. This should really be the size of a page instead.
The scariness_score_test.cc triggers stack overflow with frames that are even larger than a page, which can also trigger a fault that will not be recognized as stack-overflow. Let's just use smaller frames.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sanitizer_common/sanitizer_posix_libcdep.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_posix_libcdep.cc index 7fbb93975..e7576000c 100644 --- a/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -230,7 +230,9 @@ bool SignalContext::IsStackOverflow() const { // take it into account. bool IsStackAccess = addr >= (sp & ~0xFFF) && addr < sp + 0xFFFF; #else - bool IsStackAccess = addr + 512 > sp && addr < sp + 0xFFFF; + // Let's accept up to a page size away from top of stack. Things like stack + // probing can trigger accesses with such large offsets. + bool IsStackAccess = addr + GetPageSizeCached() > sp && addr < sp + 0xFFFF; #endif #if __powerpc__ |