From 39be9300134ca6e4aa766c296adb3815f9625459 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 4 Mar 2024 11:25:16 -0800 Subject: [PATCH] Fix GC stackwalking for generic calli Fixes #99253 --- src/coreclr/classlibnative/bcltype/system.cpp | 2 +- src/coreclr/vm/eetwain.cpp | 4 ++-- src/coreclr/vm/frames.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/coreclr/classlibnative/bcltype/system.cpp b/src/coreclr/classlibnative/bcltype/system.cpp index 0d6091387a97f6..5ecd966242f42d 100644 --- a/src/coreclr/classlibnative/bcltype/system.cpp +++ b/src/coreclr/classlibnative/bcltype/system.cpp @@ -202,7 +202,7 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce FindFailFastCallerStruct findCallerData; findCallerData.pStackMark = stackMark; findCallerData.retAddress = 0; - StackWalkFunctions(GetThread(), FindFailFastCallerCallback, &findCallerData); + GetThread()->StackWalkFrames(FindFailFastCallerCallback, &findCallerData, FUNCTIONSONLY | QUICKUNWIND); // Managed code injected FailFast maps onto the unmanaged version // (EEPolicy::HandleFatalError) in the following manner: the exit code is diff --git a/src/coreclr/vm/eetwain.cpp b/src/coreclr/vm/eetwain.cpp index 597fda3d45b5d3..5bfa40b14207d2 100644 --- a/src/coreclr/vm/eetwain.cpp +++ b/src/coreclr/vm/eetwain.cpp @@ -4406,10 +4406,10 @@ void promoteVarArgs(PTR_BYTE argsStart, PTR_VASigCookie varArgSig, GCCONTEXT* ct { WRAPPER_NO_CONTRACT; - //Note: no instantiations needed for varargs + SigTypeContext typeContext(varArgSig->classInst, varArgSig->methodInst); MetaSig msig(varArgSig->signature, varArgSig->pModule, - NULL); + &typeContext); PTR_BYTE pFrameBase = argsStart - TransitionBlock::GetOffsetOfArgs(); diff --git a/src/coreclr/vm/frames.cpp b/src/coreclr/vm/frames.cpp index a429ee4ad422b5..c78b4ea6c1fa76 100644 --- a/src/coreclr/vm/frames.cpp +++ b/src/coreclr/vm/frames.cpp @@ -1364,10 +1364,10 @@ void TransitionFrame::PromoteCallerStack(promote_func* fn, ScanContext* sc) { VASigCookie *varArgSig = GetVASigCookie(); - //Note: no instantiations needed for varargs + SigTypeContext typeContext(varArgSig->classInst, varArgSig->methodInst); MetaSig msig(varArgSig->signature, varArgSig->pModule, - NULL); + &typeContext); PromoteCallerStackHelper (fn, sc, pFunction, &msig); } } @@ -1498,10 +1498,10 @@ void TransitionFrame::PromoteCallerStackUsingGCRefMap(promote_func* fn, ScanCont { VASigCookie *varArgSig = dac_cast(*ppObj); - //Note: no instantiations needed for varargs + SigTypeContext typeContext(varArgSig->classInst, varArgSig->methodInst); MetaSig msig(varArgSig->signature, varArgSig->pModule, - NULL); + &typeContext); PromoteCallerStackHelper (fn, sc, NULL, &msig); } break; @@ -1525,10 +1525,10 @@ void PInvokeCalliFrame::PromoteCallerStack(promote_func* fn, ScanContext* sc) return; } - // no instantiations needed for varargs + SigTypeContext typeContext(varArgSig->classInst, varArgSig->methodInst); MetaSig msig(varArgSig->signature, varArgSig->pModule, - NULL); + &typeContext); PromoteCallerStackHelper(fn, sc, NULL, &msig); }