[compiler-rt] r329980 - [asan] Reduce flakiness in stack-overflow detection
Kuba Mracek via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 17:29:24 PDT 2018
Author: kuba.brecka
Date: Thu Apr 12 17:29:24 2018
New Revision: 329980
URL: http://llvm.org/viewvc/llvm-project?rev=329980&view=rev
Log:
[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.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
compiler-rt/trunk/test/asan/TestCases/scariness_score_test.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=329980&r1=329979&r2=329980&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Thu Apr 12 17:29:24 2018
@@ -230,7 +230,9 @@ bool SignalContext::IsStackOverflow() co
// 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__
Modified: compiler-rt/trunk/test/asan/TestCases/scariness_score_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/scariness_score_test.cc?rev=329980&r1=329979&r2=329980&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/scariness_score_test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/scariness_score_test.cc Thu Apr 12 17:29:24 2018
@@ -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)
More information about the llvm-commits
mailing list