[asan] make use-after-return mode more robust: allow to call instrumented functions while reporting an error
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@146231 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index d0b1da4..3ea2875 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -586,13 +586,22 @@
}
}
+ AsanThread *curr_thread = asanThreadRegistry().GetCurrent();
+ int curr_tid = asanThreadRegistry().GetCurrentTidOrMinusOne();
+
+ if (curr_thread) {
+ // We started reporting an error message. Stop using the fake stack
+ // in case we will call an instrumented function from a symbolizer.
+ curr_thread->fake_stack().StopUsingFakeStack();
+ }
+
Report("ERROR: AddressSanitizer %s on address "
"%p at pc 0x%lx bp 0x%lx sp 0x%lx\n",
bug_descr, addr, pc, bp, sp);
Printf("%s of size %d at %p thread T%d\n",
access_size ? (is_write ? "WRITE" : "READ") : "ACCESS",
- access_size, addr, asanThreadRegistry().GetCurrentTidOrMinusOne());
+ access_size, addr, curr_tid);
if (FLAG_debug) {
PrintBytes("PC: ", (uintptr_t*)pc);