-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt][nsan] Update UnwindImpl #107313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[compiler-rt][nsan] Update UnwindImpl #107313
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Alexander Shaposhnikov (alexander-shaposhnikov) ChangesImplement __sanitizer::BufferedStackTrace::UnwindImpl following msan. Full diff: https://github.com/llvm/llvm-project/pull/107313.diff 1 Files Affected:
diff --git a/compiler-rt/lib/nsan/nsan.cpp b/compiler-rt/lib/nsan/nsan.cpp
index 4be9c673bd4e00..c2e7690e12ab10 100644
--- a/compiler-rt/lib/nsan/nsan.cpp
+++ b/compiler-rt/lib/nsan/nsan.cpp
@@ -195,12 +195,19 @@ template <typename T> T max(T a, T b) { return a < b ? b : a; }
} // end anonymous namespace
-void __sanitizer::BufferedStackTrace::UnwindImpl(uptr pc, uptr bp,
- void *context,
- bool request_fast,
- u32 max_depth) {
- using namespace __nsan;
- return Unwind(max_depth, pc, bp, context, 0, 0, false);
+void __sanitizer::BufferedStackTrace::UnwindImpl(
+ uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {
+ using namespace __msan;
+ NsanThread *t = GetCurrentThread();
+ if (!t || !StackTrace::WillUseFastUnwind(request_fast)) {
+ // Block reports from our interceptors during _Unwind_Backtrace.
+ return Unwind(max_depth, pc, bp, context, t ? t->stack_top() : 0,
+ t ? t->stack_bottom() : 0, false);
+ }
+ if (StackTrace::WillUseFastUnwind(request_fast))
+ Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), true);
+ else
+ Unwind(max_depth, pc, 0, context, 0, 0, false);
}
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __nsan_print_accumulated_stats() {
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
1c0558e
to
eecdb01
Compare
eecdb01
to
b232bdb
Compare
…l following msan's example
b232bdb
to
5251ae2
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/3488 Here is the relevant piece of the build log for the reference
|
Implement __sanitizer::BufferedStackTrace::UnwindImpl following msan.