Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit deb00ad

Browse files
parjongjkotas
authored andcommitted
Check PAL_VirtualUnwind failure during GC (#6598)
As discussed in #6525, PAL_VirtualUnwind sometimes fails during GC. This GC failure leads to very unpredicatble behavior (which is very hard to analyze). This commit tries to stop the execution at the point where error happens.
1 parent 5976ffa commit deb00ad

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/vm/amd64/gmsamd64.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
6262
DacError(hr);
6363
}
6464
#else
65-
PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
65+
BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
66+
if (!success)
67+
{
68+
_ASSERTE(!"unwindLazyState: Unwinding failed");
69+
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
70+
}
6671
#endif // DACCESS_COMPILE
6772

6873
pvControlPc = GetIP(&ctx);

src/vm/arm/stubs.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
544544
DacError(hr);
545545
}
546546
#else // DACCESS_COMPILE
547-
PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
547+
BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs);
548+
if (!success)
549+
{
550+
_ASSERTE(!"unwindLazyState: Unwinding failed");
551+
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
552+
}
548553
#endif // DACCESS_COMPILE
549554
pvControlPc = GetIP(&ctx);
550555
#endif // !FEATURE_PAL

src/vm/arm64/stubs.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
330330
DacError(hr);
331331
}
332332
#else // DACCESS_COMPILE
333-
PAL_VirtualUnwind(&context, &nonVolContextPtrs);
333+
BOOL success = PAL_VirtualUnwind(&ctx, &nonVolContextPtrs);
334+
if (!success)
335+
{
336+
_ASSERTE(!"unwindLazyState: Unwinding failed");
337+
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
338+
}
334339
#endif // DACCESS_COMPILE
335340
pvControlPc = GetIP(&context);
336341
#endif // !FEATURE_PAL

0 commit comments

Comments
 (0)