mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-11 02:13:38 +09:00
Mitigation for a GC Stress race after an inline pinvoke (#38246)
In the post-call part of a pinvoke inline call frame, it's not safe to start a stress mode GC in the window between checking `g_TrapReturningThreads` and the call to `CORINFO_HELP_STOP_FOR_GC`. The call instruction is already getting special treatement, but there may be other instructions between the check and call. Instead of trying to pattern match them all, suppress GC stress if `g_TrapReturningThreads` is true, the thread is in cooperative mode, and there's an active inline call frame. Closes #37236.
This commit is contained in:
parent
3052acc56d
commit
d6b8109177
1 changed files with 12 additions and 0 deletions
|
@ -1425,6 +1425,18 @@ BOOL OnGcCoverageInterrupt(PCONTEXT regs)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// If we're in cooperative mode, we're supposed to stop for GC,
|
||||
// and there's an active ICF, don't initiate a stress GC.
|
||||
if (g_TrapReturningThreads && pThread->PreemptiveGCDisabled())
|
||||
{
|
||||
Frame* pFrame = pThread->GetFrame();
|
||||
if (InlinedCallFrame::FrameHasActiveCall(pFrame))
|
||||
{
|
||||
RemoveGcCoverageInterrupt(instrPtr, savedInstrPtr);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_REDIRECT_FOR_GCSTRESS) && !defined(TARGET_UNIX)
|
||||
// If we're unable to redirect, then we simply won't test GC at this
|
||||
// location.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue