diff options
author | Tobias Loew <tobias-loew@users.noreply.github.com> | 2018-11-05 20:28:01 +0100 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2018-11-05 20:28:01 +0100 |
commit | 9f5aabc89487eeb2b1621cfb3b9ed8f5db243d9e (patch) | |
tree | 8b68061a348b967d9156e0598f869ba7850e1120 | |
parent | 2c2cab344c4909da0bd0ebcd6a80c6c16c2598dc (diff) | |
download | coreclr-9f5aabc89487eeb2b1621cfb3b9ed8f5db243d9e.tar.gz coreclr-9f5aabc89487eeb2b1621cfb3b9ed8f5db243d9e.tar.bz2 coreclr-9f5aabc89487eeb2b1621cfb3b9ed8f5db243d9e.zip |
Fiber-friendly Vectored Exception Handling (#20746)
* Fiber-friendly Vectored Exception Handling
Check during exception handling if the cached and the current stack-base match to detect Fibers.
-rw-r--r-- | src/vm/excep.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 6eb91053a3..013c8fe286 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -8172,6 +8172,24 @@ LONG WINAPI CLRVectoredExceptionHandlerShim(PEXCEPTION_POINTERS pExceptionInfo) // this thread will bypass all our locks. Thread *pThread = GetThread(); + if (pThread) + { + // Fiber-friendly Vectored Exception Handling: + // Check if the current and the cached stack-base match. + // If they don't match then probably the thread is running on a different Fiber + // than during the initialization of the Thread-object. + void* stopPoint = pThread->GetCachedStackBase(); + void* currentStackBase = Thread::GetStackUpperBound(); + if (currentStackBase != stopPoint) + { + CantAllocHolder caHolder; + STRESS_LOG2(LF_EH, LL_INFO100, "In CLRVectoredExceptionHandler: mismatch of cached and current stack-base indicating use of Fibers, return with EXCEPTION_CONTINUE_SEARCH: current = %p; cache = %p\n", + currentStackBase, stopPoint); + return EXCEPTION_CONTINUE_SEARCH; + } + } + + // Also check if the exception was in the EE or not BOOL fExceptionInEE = FALSE; if (!pThread) |