summaryrefslogtreecommitdiff
path: root/src/vm/runtimehandles.h
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-05-06 23:51:25 +0200
committerJan Vorlicek <janvorli@microsoft.com>2016-05-06 23:51:25 +0200
commit3c7e477ac50e50b616a64c72efb81388c045e63f (patch)
tree63a1b9e41502c7f7dc2d4d977c1cda2a1433d43a /src/vm/runtimehandles.h
parent2308fbf2253abef97628bde2a04d8fb910ce1018 (diff)
downloadcoreclr-3c7e477ac50e50b616a64c72efb81388c045e63f.tar.gz
coreclr-3c7e477ac50e50b616a64c72efb81388c045e63f.tar.bz2
coreclr-3c7e477ac50e50b616a64c72efb81388c045e63f.zip
Fix Windows x86 exception handling issue (#4830)
This change fixes an exception handling issue that happens on x86 on Windows when exception is raised in System.RuntimeType.MakeGenericType. The problem was caused by GCPROTECT_HOLDER macro in RuntimeTypeHandle::GetTypeByName that causes popping of GCFrame (and zeroing its m_next field) that's in the middle of the thread's frames list during the stack unwinding. That breaks the list and when UnwindFrames happen later and tries to walk the stack, the StackFrameIterator::NextRaw asserts when checking the validity of the list. The fix is to move the keepAlive to the managed caller of the RuntimeTypeHandle::GetTypeByName QCall, which removes the need for the GCPROTECT_HOLDER. Since it was the only usage of that holder and of the underlying FrameWithCookieHolder class, I've removed those. In addition to that, I've modified COMModule::GetType and AssemblyNative::GetType to use the same pattern, since they could also suffer from the problem the GCPROTECT_HOLDER was attempting to fix.
Diffstat (limited to 'src/vm/runtimehandles.h')
-rw-r--r--src/vm/runtimehandles.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vm/runtimehandles.h b/src/vm/runtimehandles.h
index 73aa58bd87..ecb5c154c1 100644
--- a/src/vm/runtimehandles.h
+++ b/src/vm/runtimehandles.h
@@ -183,7 +183,8 @@ public:
#ifdef FEATURE_HOSTED_BINDER
ICLRPrivBinder * pPrivHostBinder,
#endif
- BOOL bLoadTypeFromPartialNameHack, QCall::ObjectHandleOnStack retType);
+ BOOL bLoadTypeFromPartialNameHack, QCall::ObjectHandleOnStack retType,
+ QCall::ObjectHandleOnStack keepAlive);
static FCDECL1(AssemblyBaseObject*, GetAssembly, ReflectClassBaseObject *pType);
static FCDECL1(ReflectClassBaseObject*, GetBaseType, ReflectClassBaseObject* pType);