summaryrefslogtreecommitdiff
path: root/lib/asan
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-19 11:02:46 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-19 11:02:46 +0000
commit0a5efc3fcc9024a59081195e78682603197eec3d (patch)
tree163ceebe32217bf87b0cd61832b7ecf2d5daef13 /lib/asan
parent9559f844f5b9ec092f344c3d13b87ba4b3deebfb (diff)
[asan] Improve stack overflow detection.
There are more cases when those manifest as an access below SP. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r--lib/asan/asan_report.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/asan/asan_report.cc b/lib/asan/asan_report.cc
index 0b6a79a0e..4937773ad 100644
--- a/lib/asan/asan_report.cc
+++ b/lib/asan/asan_report.cc
@@ -570,14 +570,12 @@ class ScopedInErrorReport {
static bool IsStackOverflow(uptr addr, uptr sp) {
uptr stack_frame_bottom = sp;
-#ifdef __x86_64__
- stack_frame_bottom -= 128; // x86_64 stack redzone
-#else
- // call stores return value 1 word below SP.
- stack_frame_bottom -= sizeof(uptr);
-#endif
- // Access below sp (+ redzone on x86_64) is probably something else (like
- // stack of another thread).
+ // x86_64 stack redzone: leaf functions can access up to 128 bytes below SP.
+ // ARM has push-multiple instruction that stores up to 64(?) bytes below SP.
+ stack_frame_bottom -= 128;
+
+ // Access below SP (minus redzone) is probably something else (like stack of
+ // another thread).
if (addr < stack_frame_bottom)
return false;