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/dllimport.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/dllimport.cpp')
-rw-r--r-- | src/vm/dllimport.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index a57353f65b..71842eef9c 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -7336,6 +7336,7 @@ EXTERN_C LPVOID STDCALL NDirectImportWorker(NDirectMethodDesc* pMD) } CONTRACTL_END; + INSTALL_MANAGED_EXCEPTION_DISPATCHER; // this function is called by CLR to native assembly stubs which are called by // managed code as a result, we need an unwind and continue handler to translate // any of our internal exceptions into managed exceptions. @@ -7392,6 +7393,7 @@ EXTERN_C LPVOID STDCALL NDirectImportWorker(NDirectMethodDesc* pMD) ret = pMD->GetNDirectTarget(); UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; + UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; END_PRESERVE_LAST_ERROR; @@ -7478,6 +7480,7 @@ PCODE GetILStubForCalli(VASigCookie *pVASigCookie, MethodDesc *pMD) PCODE pTempILStub = NULL; + INSTALL_MANAGED_EXCEPTION_DISPATCHER; // this function is called by CLR to native assembly stubs which are called by // managed code as a result, we need an unwind and continue handler to translate // any of our internal exceptions into managed exceptions. @@ -7576,6 +7579,7 @@ PCODE GetILStubForCalli(VASigCookie *pVASigCookie, MethodDesc *pMD) NULL); UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; + UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; RETURN pVASigCookie->pNDirectILStub; } |