From f3a2277c8c37a29417562cfa478935ddbb801fe7 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Fri, 29 Apr 2016 13:23:52 -0700 Subject: Eliminate SEH interactions between the JIT and the EE during verification. For compatibility reasons, `BadImageFormatException`s that are thrown when resolving tokens during verification are transformed instead into verification exceptions. This transformation currently takes place in the JIT: the JIT wraps relevant calls to `ICorJitInfo::resolveToken` with a `__try`/`__except` that handles any exceptions that arise due to invalid metadata. This method cannot be relied on when consuming the JIT as a dynamic library on non-Windows platforms due to type identity problems in the runtime's SEH emulation. Furthermore, these filters cannot use the proposed solution to the JIT's other uses of SEH across the JIT/EE interface, since they are more complex than a call to `ICorJitInfo::FilterException`. Instead, this change introduces a new method, `ICorJitInfo::tryResolveToken`, which is only used during verification. This method implements filtering that is equivalent to the current implementation, but does so in the EE rather than in the JIT. This is part of GitHub bugs #3058 and #4130. [tfs-changeset: 1600443] --- src/zap/zapinfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/zap/zapinfo.cpp') diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 345a920902..4d2d7f8636 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -3454,6 +3454,12 @@ void ZapInfo::resolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken) m_pEEJitInfo->resolveToken(pResolvedToken); } +//----------------------------------------------------------------------------- +bool ZapInfo::tryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken) +{ + return m_pEEJitInfo->tryResolveToken(pResolvedToken); +} + //----------------------------------------------------------------------------- void ZapInfo::findSig(CORINFO_MODULE_HANDLE tokenScope, unsigned sigTOK, -- cgit v1.2.3