diff options
author | Reid Kleckner <rnk@google.com> | 2016-08-04 20:05:13 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-08-04 20:05:13 +0000 |
commit | c696467530b81c7283d44a1f058ba64a1cfe266d (patch) | |
tree | 0ccbeec7a25473ee76019bf0eb27da946773b9b9 | |
parent | d938e88e89bc01fd2ec73163159795cd86bdde10 (diff) | |
download | bcm5719-llvm-c696467530b81c7283d44a1f058ba64a1cfe266d.tar.gz bcm5719-llvm-c696467530b81c7283d44a1f058ba64a1cfe266d.zip |
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.
llvm-svn: 277763
-rw-r--r-- | compiler-rt/lib/asan/asan_win.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_win.cc b/compiler-rt/lib/asan/asan_win.cc index cb038212e94..97a913ea9c8 100644 --- a/compiler-rt/lib/asan/asan_win.cc +++ b/compiler-rt/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); } |