[compiler-rt] r277763 - Avoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 13:05:13 PDT 2016
Author: rnk
Date: Thu Aug 4 15:05:13 2016
New Revision: 277763
URL: http://llvm.org/viewvc/llvm-project?rev=277763&view=rev
Log:
Avoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException
Our Report implementation calls OutputDebugString, which calls
RtlRaiseException, which can re-enter back into the ASan runtime and
cause a hang.
Don't treat this special debugger-only exception code as a noreturn
event, since the stack won't really unwind all the way.
Modified:
compiler-rt/trunk/lib/asan/asan_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=277763&r1=277762&r2=277763&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Thu Aug 4 15:05:13 2016
@@ -71,9 +71,12 @@ void __asan_default_on_error() {}
} // extern "C"
// ---------------------- Windows-specific interceptors ---------------- {{{
-INTERCEPTOR_WINAPI(void, RtlRaiseException, void *ExceptionRecord) {
+INTERCEPTOR_WINAPI(void, RtlRaiseException, EXCEPTION_RECORD *ExceptionRecord) {
CHECK(REAL(RtlRaiseException));
- __asan_handle_no_return();
+ // This is a noreturn function, unless it's one of the exceptions raised to
+ // communicate with the debugger, such as the one from OutputDebugString.
+ if (ExceptionRecord->ExceptionCode != DBG_PRINTEXCEPTION_C)
+ __asan_handle_no_return();
REAL(RtlRaiseException)(ExceptionRecord);
}
More information about the llvm-commits
mailing list