diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2015-09-08 13:23:13 +0200 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2015-09-08 13:42:29 +0200 |
commit | 468666bc8bd0c58268187cea5749cef63479b30e (patch) | |
tree | 4627399a7dd80737b91bb5375d87d46faea78878 /src/vm/prestub.cpp | |
parent | 1165038551b7ca20f230d867dc5fd2357ede14fe (diff) | |
download | coreclr-468666bc8bd0c58268187cea5749cef63479b30e.tar.gz coreclr-468666bc8bd0c58268187cea5749cef63479b30e.tar.bz2 coreclr-468666bc8bd0c58268187cea5749cef63479b30e.zip |
Fix managed exception dispatching
The managed exception dispatching is initiated from the UNINSTALL_MANAGED_EXCEPTION_DISPATCHER
macro and it should be used only at the border between managed and native code, when managed
code calls native one. This macro is part of the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE
macro. However, it turns out that the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE
(or the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER that uses it) is also used at places where
there is no managed / native border. In that case, the managed dispatching results incorrectly
in skipping native frames that would otherwise handle the exception.
The fix removes the INSTALL_MANAGED_EXCEPTION_DISPATCHER / UNINSTALL_MANAGED_EXCEPTION_DISPATCHER
from the INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE
and puts them to specific places where INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE /
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE and INSTALL_UNWIND_AND_CONTINUE_HANDLER /
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER are used at the border between managed and native code.
Diffstat (limited to 'src/vm/prestub.cpp')
-rw-r--r-- | src/vm/prestub.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index ff455b9e00..06d1967313 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -968,6 +968,7 @@ extern "C" PCODE STDCALL PreStubWorker(TransitionBlock * pTransitionBlock, Metho pPFrame->Push(CURRENT_THREAD); + INSTALL_MANAGED_EXCEPTION_DISPATCHER; INSTALL_UNWIND_AND_CONTINUE_HANDLER; ETWOnStartup (PrestubWorker_V1,PrestubWorkerEnd_V1); @@ -1036,6 +1037,7 @@ extern "C" PCODE STDCALL PreStubWorker(TransitionBlock * pTransitionBlock, Metho pbRetVal = pMD->DoPrestub(pDispatchingMT); UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; + UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; // Give debugger opportunity to stop here ThePreStubPatch(); @@ -1822,6 +1824,7 @@ EXTERN_C PCODE STDCALL ExternalMethodFixupWorker(TransitionBlock * pTransitionBl pEMFrame->Push(CURRENT_THREAD); // Push the new ExternalMethodFrame onto the frame stack + INSTALL_MANAGED_EXCEPTION_DISPATCHER; INSTALL_UNWIND_AND_CONTINUE_HANDLER; bool fVirtual = false; @@ -2048,6 +2051,7 @@ EXTERN_C PCODE STDCALL ExternalMethodFixupWorker(TransitionBlock * pTransitionBl // Ready to return UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; + UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; pEMFrame->Pop(CURRENT_THREAD); // Pop the ExternalMethodFrame from the frame stack @@ -2586,6 +2590,7 @@ extern "C" SIZE_T STDCALL DynamicHelperWorker(TransitionBlock * pTransitionBlock pFrame->Push(CURRENT_THREAD); + INSTALL_MANAGED_EXCEPTION_DISPATCHER; INSTALL_UNWIND_AND_CONTINUE_HANDLER; #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) @@ -2689,6 +2694,7 @@ extern "C" SIZE_T STDCALL DynamicHelperWorker(TransitionBlock * pTransitionBlock } UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; + UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; pFrame->Pop(CURRENT_THREAD); |