diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc index 7fbb939753cc..e7576000cbc7 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/compiler-rt/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__ diff --git a/compiler-rt/test/asan/TestCases/scariness_score_test.cc b/compiler-rt/test/asan/TestCases/scariness_score_test.cc index 171bea9ee191..fb174eb52b2b 100644 --- a/compiler-rt/test/asan/TestCases/scariness_score_test.cc +++ b/compiler-rt/test/asan/TestCases/scariness_score_test.cc @@ -115,7 +115,7 @@ void DoubleFree() { } void StackOverflow(int Idx) { - int some_stack[10000]; + int some_stack[256]; static volatile int *x; x = &some_stack[0]; if (Idx > 0)