[asan] Increase LocatePcInTrace threshold.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 20 Apr 2016 22:45:25 +0000 (22:45 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 20 Apr 2016 22:45:25 +0000 (22:45 +0000)
Not sure what changed, but on my machine this is literally one byte
short. Only happens when malloc_context_size <= 2 due to the special
case in GET_STACK_TRACE definition (see asan_stack.h):
StackTrace::GetCurrentPc() on the right (context size > 2) branch
returns the address that is 200-something bytes from the return
address it is later matched to, while the same call on the left
branch is 321 bytes away from it.

This fixes the double-free test on my machine.

llvm-svn: 266932

compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc

index 4d95dc9..bf5456f 100644 (file)
@@ -115,7 +115,7 @@ void BufferedStackTrace::PopStackFrames(uptr count) {
 uptr BufferedStackTrace::LocatePcInTrace(uptr pc) {
   // Use threshold to find PC in stack trace, as PC we want to unwind from may
   // slightly differ from return address in the actual unwinded stack trace.
-  const int kPcThreshold = 320;
+  const int kPcThreshold = 350;
   for (uptr i = 0; i < size; ++i) {
     if (MatchPc(pc, trace[i], kPcThreshold))
       return i;