summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2018-10-31 18:02:36 +0100
committerGitHub <noreply@github.com>2018-10-31 18:02:36 +0100
commitc34a0c0e5ebb2170ccc52d5a26a5c346d97ea7b6 (patch)
tree397b5b30fd11f8c231bd22cdfa0d241c93e9d6db
parent4bcbb70ea3b20b959c50eb7132783ead33e2e1e9 (diff)
downloadcoreclr-c34a0c0e5ebb2170ccc52d5a26a5c346d97ea7b6.tar.gz
coreclr-c34a0c0e5ebb2170ccc52d5a26a5c346d97ea7b6.tar.bz2
coreclr-c34a0c0e5ebb2170ccc52d5a26a5c346d97ea7b6.zip
Fix Windows x86 EH for exception from UMThunkPrestub (#20704)
The exception handling was poping an explicit frame in UMThunkPrestubHandler down the call chain from CallRtlUnwindSafe, but it was not updating the tct.pBottomFrame after returning from that function back to CPFH_RealFirstPassHandler. And the call to COMPlusAfterUnwind then called UnwindFrames starting at the old frame that was already removed from the chain.
-rw-r--r--src/vm/i386/excepx86.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp
index bc85ad3d62..d4079f4f00 100644
--- a/src/vm/i386/excepx86.cpp
+++ b/src/vm/i386/excepx86.cpp
@@ -1255,6 +1255,13 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
CallRtlUnwindSafe(pEstablisherFrame, RtlUnwindCallback, pExceptionRecord, 0);
// on x86 at least, RtlUnwind always returns
+ // The CallRtlUnwindSafe could have popped the explicit frame that the tct.pBottomFrame points to (UMThunkPrestubHandler
+ // does that). In such case, the tct.pBottomFrame needs to be updated to point to the first valid explicit frame.
+ Frame* frame = pThread->GetFrame();
+ if ((tct.pBottomFrame != NULL) && (frame > tct.pBottomFrame))
+ {
+ tct.pBottomFrame = frame;
+ }
// Note: we've completed the unwind pass up to the establisher frame, and we're headed off to finish our
// cleanup and end up back in jitted code. Any more FS0 handlers pushed from this point on out will _not_ be
// unwound.