summaryrefslogtreecommitdiff
path: root/lib/asan/asan_win.cc
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-08-04 20:05:13 +0000
committerReid Kleckner <rnk@google.com>2016-08-04 20:05:13 +0000
commit156db7c6e14dad40f78f66cf3647d6ced0dd3f1a (patch)
tree35288388e8cb287d4b7204638cdb1c23eff987f3 /lib/asan/asan_win.cc
parentc750de680c2afbd6a54ca033e7db0710b7303720 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_win.cc')
-rw-r--r--lib/asan/asan_win.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/asan/asan_win.cc b/lib/asan/asan_win.cc
index cb038212e..97a913ea9 100644
--- a/lib/asan/asan_win.cc
+++ b/lib/asan/asan_win.cc
@@ -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);
}