fail fast on exceptions that indicate corrupted process state (#10957)
authorRahul Kumar <rahku@microsoft.com>
Tue, 18 Apr 2017 18:33:59 +0000 (11:33 -0700)
committerGitHub <noreply@github.com>
Tue, 18 Apr 2017 18:33:59 +0000 (11:33 -0700)
src/vm/exceptionhandling.cpp
src/vm/i386/excepx86.cpp
tests/src/JIT/Directed/pinvoke/calli_excep.il

index ee0ff29..15346fc 100644 (file)
@@ -1011,6 +1011,10 @@ ProcessCLRException(IN     PEXCEPTION_RECORD   pExceptionRecord
                 CEHelper::SetupCorruptionSeverityForActiveException((STState == ExceptionTracker::STS_FirstRethrowFrame), (pTracker->GetPreviousExceptionTracker() != NULL),
                                                                     CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
             }
+
+            // Failfast if exception indicates corrupted process state            
+            if (pTracker->GetCorruptionSeverity() == ProcessCorrupting)
+                EEPOLICY_HANDLE_FATAL_ERROR(pExceptionRecord->ExceptionCode);
         }
 #endif // FEATURE_CORRUPTING_EXCEPTIONS
 
index 9680e87..8c65db7 100644 (file)
@@ -1088,6 +1088,11 @@ CPFH_RealFirstPassHandler(                  // ExceptionContinueSearch, etc.
             // of the active exception.
             CEHelper::SetupCorruptionSeverityForActiveException(bRethrownException, bNestedException, 
                 CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
+
+            // Failfast if exception indicates corrupted process state   
+            if (pExInfo->GetCorruptionSeverity() == ProcessCorrupting)
+                EEPOLICY_HANDLE_FATAL_ERROR(exceptionCode);
+                
             END_SO_INTOLERANT_CODE;
         }
 #endif // FEATURE_CORRUPTING_EXCEPTIONS
index 157643f..8768344 100644 (file)
@@ -33,7 +33,7 @@
                int32 V_1)
       .try
       {
-                       ldc.i4     0xc0000005
+                       ldc.i4   0xC0000017
                        ldc.i4.0
                        dup
                        dup
@@ -44,7 +44,7 @@
                        calli   void (unsigned int32, unsigned int32, unsigned int32, native uint)
                        leave.s    IL_001d
       }  // end .try
-      catch [mscorlib]System.AccessViolationException 
+      catch [mscorlib]System.OutOfMemoryException 
       {
         IL_000f:  stloc.0
         IL_0010:  ldloc.0