diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2016-04-29 13:23:52 -0700 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2016-04-29 13:23:52 -0700 |
commit | f3a2277c8c37a29417562cfa478935ddbb801fe7 (patch) | |
tree | b58c58a12bb30f832222426ae487992f21dd103b /src/inc | |
parent | 23d0b7a74a67094c070af3477d06677bf19173d0 (diff) | |
download | coreclr-f3a2277c8c37a29417562cfa478935ddbb801fe7.tar.gz coreclr-f3a2277c8c37a29417562cfa478935ddbb801fe7.tar.bz2 coreclr-f3a2277c8c37a29417562cfa478935ddbb801fe7.zip |
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]
Diffstat (limited to 'src/inc')
-rw-r--r-- | src/inc/corinfo.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h index fb839996c0..8978b951a5 100644 --- a/src/inc/corinfo.h +++ b/src/inc/corinfo.h @@ -231,11 +231,11 @@ TODO: Talk about initializing strutures before use #if COR_JIT_EE_VERSION > 460 // Update this one -SELECTANY const GUID JITEEVersionIdentifier = { /* 27626524-7315-4ed0-b74e-a0e4579883bb */ - 0x27626524, - 0x7315, - 0x4ed0, - { 0xb7, 0x4e, 0xa0, 0xe4, 0x57, 0x98, 0x83, 0xbb } +SELECTANY const GUID JITEEVersionIdentifier = { /* 8c8e61ca-2b88-4bc5-b03f-d390acdc7fc3 */ + 0x8c8e61ca, + 0x2b88, + 0x4bc5, + { 0xb0, 0x3f, 0xd3, 0x90, 0xac, 0xdc, 0x7f, 0xc3 } }; #else @@ -2153,9 +2153,19 @@ public: // /**********************************************************************************/ - // Resolve metadata token into runtime method handles. + // Resolve metadata token into runtime method handles. This function may not + // return normally (e.g. it may throw) if it encounters invalid metadata or other + // failures during token resolution. virtual void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0; +#if COR_JIT_EE_VERSION > 460 + // Attempt to resolve a metadata token into a runtime method handle. Returns true + // if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata + // during token reoslution). This method should be used instead of `resolveToken` in + // situations that need to be resilient to invalid metadata. + virtual bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0; +#endif + // Signature information about the call sig virtual void findSig ( CORINFO_MODULE_HANDLE module, /* IN */ |