Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Mosier <smosier@microsoft.com>2016-01-07 03:09:02 +0300
committerScott Mosier <smosier@microsoft.com>2016-01-07 03:09:02 +0300
commitff6fb1968ce5dbdaec33b22733b7c55fc07b9846 (patch)
tree8d4cc2bd6861f2bfc48c5ffa500681c29b010ad9 /src/Runtime.Base
parentc089cdb0a87ac5f0b9c298967fc9842a33a68389 (diff)
Fix two EH bugs
The first issue here is another FailFast problem. Essentially, my last change to RhpPInvokeExceptionGuard--where I tried to account for x86 SEH being different from arm/amd64--failed to handle both modes in which it gets invoked properly. In both cases, we are handling the situation where we've experienced an SEH exception of some kind that hits our backstop handler in managed code. The issue occurs only when we didn't find the exception IP to be in managed code. Usually this means that the exception originated form native code, but this is not true if we, for example, have a call indirect through a bad pointer. The bad pointer is the exception IP in this case and if the caller was managed, we'll be in cooperative mode. In this case, it doesn't make sense to use the current thread's "pinvoke callsite return address". So, for the case where we're in cooperative mode, I've put it back to using the dispatcher context ControlPc on amd64/arm and switched to using the EstablisherFrame on x86. The handler address in the exception registration record is a managed code stub address, so I also had to adjust FindModuleRespectingReturnAddressHijacks to consider all addresses when attempting to find the managed module. The second issue is a long-standing problem with filter invocation. Preserved registers should not be seeded to the filter and they should most definitely not be restored back to the REGDISPLAY when the filter is done. This is because filter invocation happens during the first pass and, as such, the stackwalker resets its state when it passes over the filter invoke. This means that the REGDISPLAY at the throw site is the 'live' location of any GC references in preserved registers -- i.e. the REGDISPLAY gets updated during GC (not the new stack locations downstream of the filter). So having the filter invocation code trample on the REGDISPLAY values when it's done has the effect of putting back stale values, thus creating a GC hole. [tfs-changeset: 1561874]
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r--src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs4
-rw-r--r--src/Runtime.Base/src/System/Runtime/InternalCalls.cs5
2 files changed, 2 insertions, 7 deletions
diff --git a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
index 88090e747..0f792ff7d 100644
--- a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
+++ b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
@@ -952,9 +952,9 @@ namespace System.Runtime
FailFastViaClasslib(RhFailFastReason.PN_UnhandledExceptionFromPInvoke, null, PInvokeCallsiteReturnAddr);
}
[RuntimeExport("RhpFailFastForPInvokeExceptionCoop")]
- static public void RhpFailFastForPInvokeExceptionCoop(IntPtr PInvokeCallsiteReturnAddr, void* pExceptionRecord, void* pContextRecord)
+ static public void RhpFailFastForPInvokeExceptionCoop(IntPtr classlibBreadcrumb, void* pExceptionRecord, void* pContextRecord)
{
- FailFastViaClasslib(RhFailFastReason.PN_UnhandledExceptionFromPInvoke, null, PInvokeCallsiteReturnAddr);
+ FailFastViaClasslib(RhFailFastReason.PN_UnhandledExceptionFromPInvoke, null, classlibBreadcrumb);
}
} // static class EH
}
diff --git a/src/Runtime.Base/src/System/Runtime/InternalCalls.cs b/src/Runtime.Base/src/System/Runtime/InternalCalls.cs
index c4e1c91ea..1f37d866e 100644
--- a/src/Runtime.Base/src/System/Runtime/InternalCalls.cs
+++ b/src/Runtime.Base/src/System/Runtime/InternalCalls.cs
@@ -129,11 +129,6 @@ namespace System.Runtime
[ManuallyManaged(GcPollPolicy.Never)]
internal unsafe extern static bool RhpEHEnumNext(void* pEHEnum, void* pEHClause);
- [RuntimeImport(Redhawk.BaseName, "RhpGetUnhijackedReturnAddress")]
- [MethodImpl(MethodImplOptions.InternalCall)]
- [ManuallyManaged(GcPollPolicy.Never)]
- internal unsafe extern static void* RhpGetUnhijackedReturnAddress(void** ppvReturnAddressLocation);
-
[RuntimeImport(Redhawk.BaseName, "RhpGetArrayBaseType")]
[MethodImpl(MethodImplOptions.InternalCall)]
[ManuallyManaged(GcPollPolicy.Never)]