Index: lib/asan/asan_stack.h =================================================================== --- lib/asan/asan_stack.h +++ lib/asan/asan_stack.h @@ -33,7 +33,7 @@ void GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc, uptr bp, void *context, bool fast) { #if SANITIZER_WINDOWS - stack->Unwind(max_depth, pc, bp, context, 0, 0, fast); + stack->Unwind(max_depth, pc, 0, context, 0, 0, false); #else AsanThread *t; stack->size = 0; @@ -43,8 +43,11 @@ uptr stack_bottom = t->stack_bottom(); ScopedUnwinding unwind_scope(t); if (!SANITIZER_MIPS || IsValidFrame(bp, stack_top, stack_bottom)) { - stack->Unwind(max_depth, pc, bp, context, stack_top, stack_bottom, - fast); + if (StackTrace::WillUseFastUnwind(fast)) + stack->Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, + true); + else + stack->Unwind(max_depth, pc, 0, context, 0, 0, false); } } else if (!t && !fast) { /* If GetCurrentThread() has failed, try to do slow unwind anyways. */ Index: lib/hwasan/hwasan.cpp =================================================================== --- lib/hwasan/hwasan.cpp +++ lib/hwasan/hwasan.cpp @@ -157,8 +157,11 @@ SymbolizerScope sym_scope; return stack->Unwind(max_s, pc, bp, context, 0, 0, request_fast_unwind); } - stack->Unwind(max_s, pc, bp, context, t->stack_top(), t->stack_bottom(), - request_fast_unwind); + if (StackTrace::WillUseFastUnwind(request_fast_unwind)) + stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), + true); + else + stack->Unwind(max_s, pc, 0, context, 0, 0, false); } static void HWAsanCheckFailed(const char *file, int line, const char *cond, Index: lib/lsan/lsan.h =================================================================== --- lib/lsan/lsan.h +++ lib/lsan/lsan.h @@ -55,7 +55,10 @@ stack_bottom = t->stack_begin(); } if (!SANITIZER_MIPS || IsValidFrame(bp, stack_top, stack_bottom)) { - stack->Unwind(max_depth, pc, bp, context, stack_top, stack_bottom, fast); + if (StackTrace::WillUseFastUnwind(fast)) + stack->Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, true); + else + stack->Unwind(max_depth, pc, 0, context, 0, 0, false); } } Index: lib/msan/msan.cc =================================================================== --- lib/msan/msan.cc +++ lib/msan/msan.cc @@ -227,10 +227,13 @@ if (!t || !StackTrace::WillUseFastUnwind(request_fast_unwind)) { // Block reports from our interceptors during _Unwind_Backtrace. SymbolizerScope sym_scope; - return stack->Unwind(max_s, pc, bp, context, 0, 0, request_fast_unwind); + return stack->Unwind(max_s, pc, bp, context, 0, 0, false); } - stack->Unwind(max_s, pc, bp, context, t->stack_top(), t->stack_bottom(), - request_fast_unwind); + if (StackTrace::WillUseFastUnwind(request_fast_unwind)) + stack->Unwind(max_s, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), + true); + else + stack->Unwind(max_s, pc, 0, context, 0, 0, false); } void PrintWarning(uptr pc, uptr bp) { Index: lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc =================================================================== --- lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc +++ lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc @@ -57,6 +57,8 @@ void BufferedStackTrace::Unwind(u32 max_depth, uptr pc, uptr bp, void *context, uptr stack_top, uptr stack_bottom, bool request_fast_unwind) { + // Ensures all call sites get what they requested. + CHECK_EQ(request_fast_unwind, WillUseFastUnwind(request_fast_unwind)); top_frame_bp = (max_depth > 0) ? bp : 0; // Avoid doing any work for small max_depth. if (max_depth == 0) { Index: lib/sanitizer_common/sanitizer_symbolizer_report.cc =================================================================== --- lib/sanitizer_common/sanitizer_symbolizer_report.cc +++ lib/sanitizer_common/sanitizer_symbolizer_report.cc @@ -103,9 +103,11 @@ GET_CALLER_PC_BP_SP; (void)sp; bool fast = common_flags()->fast_unwind_on_fatal; - if (StackTrace::WillUseFastUnwind(fast)) + if (StackTrace::WillUseFastUnwind(fast)) { GetThreadStackTopAndBottom(false, &top, &bottom); - stack->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, fast); + stack->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, true); + } else + stack->Unwind(kStackTraceMax, pc, 0, nullptr, 0, 0, false); Printf("%s", d.Warning()); Report("WARNING: %s: writable-executable page usage\n", SanitizerToolName); Index: lib/tsan/rtl/tsan_rtl.cc =================================================================== --- lib/tsan/rtl/tsan_rtl.cc +++ lib/tsan/rtl/tsan_rtl.cc @@ -331,9 +331,11 @@ uptr top = 0; uptr bottom = 0; bool fast = common_flags()->fast_unwind_on_fatal; - if (StackTrace::WillUseFastUnwind(fast)) + if (StackTrace::WillUseFastUnwind(fast)) { GetThreadStackTopAndBottom(false, &top, &bottom); - stack->Unwind(kStackTraceMax, sig.pc, sig.bp, sig.context, top, bottom, fast); + stack->Unwind(kStackTraceMax, sig.pc, sig.bp, nullptr, top, bottom, true); + } else + stack->Unwind(kStackTraceMax, sig.pc, 0, sig.context, 0, 0, false); } static void TsanOnDeadlySignal(int signo, void *siginfo, void *context) { Index: lib/tsan/rtl/tsan_rtl_report.cc =================================================================== --- lib/tsan/rtl/tsan_rtl_report.cc +++ lib/tsan/rtl/tsan_rtl_report.cc @@ -732,14 +732,15 @@ uptr bp = 0; uptr top = 0; uptr bottom = 0; - if (__sanitizer::StackTrace::WillUseFastUnwind(false)) { - bp = GET_CURRENT_FRAME(); - __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); - } BufferedStackTrace *ptrace = new(internal_alloc(MBlockStackTrace, sizeof(BufferedStackTrace))) BufferedStackTrace(); - ptrace->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, false); + if (__sanitizer::StackTrace::WillUseFastUnwind(false)) { + bp = GET_CURRENT_FRAME(); + __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); + ptrace->Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, true); + } else + ptrace->Unwind(kStackTraceMax, pc, 0, nullptr, 0, 0, false); for (uptr i = 0; i < ptrace->size / 2; i++) { uptr tmp = ptrace->trace_buffer[i]; ptrace->trace_buffer[i] = ptrace->trace_buffer[ptrace->size - i - 1]; Index: lib/ubsan/ubsan_diag.cc =================================================================== --- lib/ubsan/ubsan_diag.cc +++ lib/ubsan/ubsan_diag.cc @@ -30,9 +30,11 @@ uptr bp, void *context, bool fast) { uptr top = 0; uptr bottom = 0; - if (StackTrace::WillUseFastUnwind(fast)) + if (StackTrace::WillUseFastUnwind(fast)) { GetThreadStackTopAndBottom(false, &top, &bottom); - stack->Unwind(max_depth, pc, bp, context, top, bottom, fast); + stack->Unwind(max_depth, pc, bp, nullptr, top, bottom, true); + } else + stack->Unwind(max_depth, pc, bp, context, 0, 0, false); } static void MaybePrintStackTrace(uptr pc, uptr bp) { Index: lib/ubsan/ubsan_diag_standalone.cc =================================================================== --- lib/ubsan/ubsan_diag_standalone.cc +++ lib/ubsan/ubsan_diag_standalone.cc @@ -22,14 +22,15 @@ uptr top = 0; uptr bottom = 0; bool request_fast_unwind = common_flags()->fast_unwind_on_fatal; - if (__sanitizer::StackTrace::WillUseFastUnwind(request_fast_unwind)) - __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); - GET_CURRENT_PC_BP_SP; (void)sp; BufferedStackTrace stack; - stack.Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, - request_fast_unwind); + if (__sanitizer::StackTrace::WillUseFastUnwind(request_fast_unwind)) { + __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom); + stack.Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom, true); + } else { + stack.Unwind(kStackTraceMax, pc, 0, nullptr, 0, 0, false); + } stack.Print(); } } // extern "C"