From: Jonghyun Park Date: Mon, 8 Aug 2016 01:35:54 +0000 (+0900) Subject: Check PAL_VirtualUnwind failure during GC (dotnet/coreclr#6598) X-Git-Tag: submit/tizen/20210909.063632~11030^2~9698 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbe53e709875db679fa5dc1e6db4d06457f55cab;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Check PAL_VirtualUnwind failure during GC (dotnet/coreclr#6598) As discussed in dotnet/coreclr#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. Commit migrated from https://github.com/dotnet/coreclr/commit/deb00ad58acf627763b6c0a7833fa789e3bb1cd0 --- diff --git a/src/coreclr/src/vm/amd64/gmsamd64.cpp b/src/coreclr/src/vm/amd64/gmsamd64.cpp index b6e596e..29d7872 100644 --- a/src/coreclr/src/vm/amd64/gmsamd64.cpp +++ b/src/coreclr/src/vm/amd64/gmsamd64.cpp @@ -62,7 +62,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, DacError(hr); } #else - PAL_VirtualUnwind(&ctx, &nonVolRegPtrs); + BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs); + if (!success) + { + _ASSERTE(!"unwindLazyState: Unwinding failed"); + EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); + } #endif // DACCESS_COMPILE pvControlPc = GetIP(&ctx); diff --git a/src/coreclr/src/vm/arm/stubs.cpp b/src/coreclr/src/vm/arm/stubs.cpp index 9868cb6..0b069da 100644 --- a/src/coreclr/src/vm/arm/stubs.cpp +++ b/src/coreclr/src/vm/arm/stubs.cpp @@ -544,7 +544,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, DacError(hr); } #else // DACCESS_COMPILE - PAL_VirtualUnwind(&ctx, &nonVolRegPtrs); + BOOL success = PAL_VirtualUnwind(&ctx, &nonVolRegPtrs); + if (!success) + { + _ASSERTE(!"unwindLazyState: Unwinding failed"); + EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); + } #endif // DACCESS_COMPILE pvControlPc = GetIP(&ctx); #endif // !FEATURE_PAL diff --git a/src/coreclr/src/vm/arm64/stubs.cpp b/src/coreclr/src/vm/arm64/stubs.cpp index 7db8a31..2b239cd 100644 --- a/src/coreclr/src/vm/arm64/stubs.cpp +++ b/src/coreclr/src/vm/arm64/stubs.cpp @@ -330,7 +330,12 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, DacError(hr); } #else // DACCESS_COMPILE - PAL_VirtualUnwind(&context, &nonVolContextPtrs); + BOOL success = PAL_VirtualUnwind(&ctx, &nonVolContextPtrs); + if (!success) + { + _ASSERTE(!"unwindLazyState: Unwinding failed"); + EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); + } #endif // DACCESS_COMPILE pvControlPc = GetIP(&context); #endif // !FEATURE_PAL