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

Commit 7ae6fbd

Browse files
author
Rahul Kumar
authored
fail fast on exceptions that indicate corrupted process state (#10957)
1 parent 98a41f0 commit 7ae6fbd

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/vm/exceptionhandling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,10 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
10111011
CEHelper::SetupCorruptionSeverityForActiveException((STState == ExceptionTracker::STS_FirstRethrowFrame), (pTracker->GetPreviousExceptionTracker() != NULL),
10121012
CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
10131013
}
1014+
1015+
// Failfast if exception indicates corrupted process state
1016+
if (pTracker->GetCorruptionSeverity() == ProcessCorrupting)
1017+
EEPOLICY_HANDLE_FATAL_ERROR(pExceptionRecord->ExceptionCode);
10141018
}
10151019
#endif // FEATURE_CORRUPTING_EXCEPTIONS
10161020

src/vm/i386/excepx86.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,11 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
10881088
// of the active exception.
10891089
CEHelper::SetupCorruptionSeverityForActiveException(bRethrownException, bNestedException,
10901090
CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
1091+
1092+
// Failfast if exception indicates corrupted process state
1093+
if (pExInfo->GetCorruptionSeverity() == ProcessCorrupting)
1094+
EEPOLICY_HANDLE_FATAL_ERROR(exceptionCode);
1095+
10911096
END_SO_INTOLERANT_CODE;
10921097
}
10931098
#endif // FEATURE_CORRUPTING_EXCEPTIONS

tests/src/JIT/Directed/pinvoke/calli_excep.il

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
int32 V_1)
3434
.try
3535
{
36-
ldc.i4 0xc0000005
36+
ldc.i4 0xC0000017
3737
ldc.i4.0
3838
dup
3939
dup
@@ -44,7 +44,7 @@
4444
calli void (unsigned int32, unsigned int32, unsigned int32, native uint)
4545
leave.s IL_001d
4646
} // end .try
47-
catch [mscorlib]System.AccessViolationException
47+
catch [mscorlib]System.OutOfMemoryException
4848
{
4949
IL_000f: stloc.0
5050
IL_0010: ldloc.0

0 commit comments

Comments
 (0)