Skip to content

Commit dd754cd

Browse files
[compiler-rt][nsan] Update UnwindImpl (#107313)
Implement __sanitizer::BufferedStackTrace::UnwindImpl following msan.
1 parent 1ff8657 commit dd754cd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler-rt/lib/nsan/nsan.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,14 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(uptr pc, uptr bp,
200200
bool request_fast,
201201
u32 max_depth) {
202202
using namespace __nsan;
203-
return Unwind(max_depth, pc, bp, context, 0, 0, false);
203+
NsanThread *t = GetCurrentThread();
204+
if (!t || !StackTrace::WillUseFastUnwind(request_fast))
205+
return Unwind(max_depth, pc, bp, context, t ? t->stack_top() : 0,
206+
t ? t->stack_bottom() : 0, false);
207+
if (StackTrace::WillUseFastUnwind(request_fast))
208+
Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), true);
209+
else
210+
Unwind(max_depth, pc, 0, context, 0, 0, false);
204211
}
205212

206213
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_print_accumulated_stats() {

0 commit comments

Comments
 (0)