diff options
author | danmosemsft <danmose@microsoft.com> | 2017-02-10 21:53:12 -0800 |
---|---|---|
committer | danmosemsft <danmose@microsoft.com> | 2017-02-10 21:53:54 -0800 |
commit | b0dab0d6de90a38dfbf0d6b2039a7b8f5269d802 (patch) | |
tree | b34dd8b5235af7703faf31e847148b21c9b325bb | |
parent | 52009b8919ba55690f21cdc8f04e012a53eb8ef4 (diff) | |
download | coreclr-b0dab0d6de90a38dfbf0d6b2039a7b8f5269d802.tar.gz coreclr-b0dab0d6de90a38dfbf0d6b2039a7b8f5269d802.tar.bz2 coreclr-b0dab0d6de90a38dfbf0d6b2039a7b8f5269d802.zip |
Remove always defined FEATURE_CORRUPTING_EXCEPTIONS
-rw-r--r-- | src/inc/ex.h | 11 | ||||
-rw-r--r-- | src/inc/utilcode.h | 2 | ||||
-rw-r--r-- | src/utilcode/util.cpp | 2 | ||||
-rw-r--r-- | src/vm/callhelpers.cpp | 6 | ||||
-rw-r--r-- | src/vm/callhelpers.h | 2 | ||||
-rw-r--r-- | src/vm/classfactory.cpp | 38 | ||||
-rw-r--r-- | src/vm/clrex.h | 2 | ||||
-rw-r--r-- | src/vm/comdelegate.cpp | 2 | ||||
-rw-r--r-- | src/vm/crossdomaincalls.cpp | 6 | ||||
-rw-r--r-- | src/vm/eeconfig.cpp | 2 | ||||
-rw-r--r-- | src/vm/eeconfig.h | 4 | ||||
-rw-r--r-- | src/vm/excep.cpp | 50 | ||||
-rw-r--r-- | src/vm/excep.h | 12 | ||||
-rw-r--r-- | src/vm/exceptionhandling.cpp | 10 | ||||
-rw-r--r-- | src/vm/exceptionhandling.h | 6 | ||||
-rw-r--r-- | src/vm/exceptmacros.h | 4 | ||||
-rw-r--r-- | src/vm/exinfo.cpp | 2 | ||||
-rw-r--r-- | src/vm/exinfo.h | 2 | ||||
-rw-r--r-- | src/vm/exstate.cpp | 2 | ||||
-rw-r--r-- | src/vm/exstate.h | 2 | ||||
-rw-r--r-- | src/vm/frames.h | 2 | ||||
-rw-r--r-- | src/vm/i386/excepx86.cpp | 10 | ||||
-rw-r--r-- | src/vm/jithelpers.cpp | 2 | ||||
-rw-r--r-- | src/vm/listlock.cpp | 2 | ||||
-rw-r--r-- | src/vm/listlock.h | 2 | ||||
-rw-r--r-- | src/vm/methodtable.cpp | 8 | ||||
-rw-r--r-- | src/vm/namespace.h | 2 | ||||
-rw-r--r-- | src/vm/reflectioninvocation.cpp | 6 | ||||
-rw-r--r-- | src/vm/stdinterfaces_wrapper.cpp | 6 | ||||
-rw-r--r-- | src/vm/threads.cpp | 6 | ||||
-rw-r--r-- | src/vm/util.hpp | 2 |
31 files changed, 1 insertions, 214 deletions
diff --git a/src/inc/ex.h b/src/inc/ex.h index 80b9aa0a07..760aefa8a5 100644 --- a/src/inc/ex.h +++ b/src/inc/ex.h @@ -751,7 +751,6 @@ private: // ///////////////////////////////////////////////////////////////////// -#ifdef FEATURE_CORRUPTING_EXCEPTIONS #define CORRUPTING_EXCEPTIONS_ONLY(expr) expr #define COMMA_CORRUPTING_EXCEPTIONS_ONLY(expr) ,expr @@ -804,16 +803,6 @@ private: EX_RETHROW; \ } -#else // !FEATURE_CORRUPTING_EXCEPTIONS - -#define CORRUPTING_EXCEPTIONS_ONLY(expr) -#define COMMA_CORRUPTING_EXCEPTIONS_ONLY(expr) - -// When we dont have support for CE, just map it to SwallowAllExceptions -#define RethrowCorruptingExceptionsEx(expr) SwallowAllExceptions -#define RethrowCorruptingExceptionsExAndHookRethrow(shouldRethrowExpr, aboutToRethrowExpr) SwallowAllExceptions -#define SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr) !TRUE -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Map to RethrowCorruptingExceptionsEx so that it does the "right" thing #define RethrowCorruptingExceptions RethrowCorruptingExceptionsEx(TRUE) diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index 5394f1beb2..3f70041ce1 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -5145,12 +5145,10 @@ void OnUninitializedCoreClrCallbacks(); #endif //_DEBUG -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Corrupting Exception limited support for outside the VM folder BOOL IsProcessCorruptedStateException(DWORD dwExceptionCode, BOOL fCheckForSO = TRUE); -#endif // FEATURE_CORRUPTING_EXCEPTIONS BOOL IsV2RuntimeLoaded(void); diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp index 67e353b359..7cde4f7941 100644 --- a/src/utilcode/util.cpp +++ b/src/utilcode/util.cpp @@ -3362,7 +3362,6 @@ lDone: ; return param.fRet; } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // To include definition of EXCEPTION_SOFTSO #include "corexcep.h" @@ -3412,7 +3411,6 @@ BOOL IsProcessCorruptedStateException(DWORD dwExceptionCode, BOOL fCheckForSO /* return fIsCorruptedStateException; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS void EnableTerminationOnHeapCorruption() { diff --git a/src/vm/callhelpers.cpp b/src/vm/callhelpers.cpp index addd5192da..0e0efb583d 100644 --- a/src/vm/callhelpers.cpp +++ b/src/vm/callhelpers.cpp @@ -251,9 +251,7 @@ void DispatchCall( CallDescrData * pCallDescrData, OBJECTREF *pRefException, ContextTransitionFrame* pFrame /* = NULL */ -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity *pSeverity /*= NULL*/ -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { CONTRACTL @@ -269,13 +267,11 @@ void DispatchCall( g_pDebugInterface->TraceCall((const BYTE *)pCallDescrData->pTarget); #endif // DEBUGGING_SUPPORTED -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (pSeverity != NULL) { // By default, assume any exception that comes out is NotCorrupting *pSeverity = NotCorrupting; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS EX_TRY { @@ -287,13 +283,11 @@ void DispatchCall( { *pRefException = GET_THROWABLE(); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (pSeverity != NULL) { // By default, assume any exception that comes out is NotCorrupting *pSeverity = GetThread()->GetExceptionState()->GetLastActiveExceptionCorruptionSeverity(); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } EX_END_CATCH(RethrowTransientExceptions); diff --git a/src/vm/callhelpers.h b/src/vm/callhelpers.h index 446105bfba..3175d9ae75 100644 --- a/src/vm/callhelpers.h +++ b/src/vm/callhelpers.h @@ -61,9 +61,7 @@ void DispatchCall( CallDescrData * pCallDescrData, OBJECTREF * pRefException, ContextTransitionFrame* pFrame = NULL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity * pSeverity = NULL -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); // Helper for VM->managed calls with simple signatures. diff --git a/src/vm/classfactory.cpp b/src/vm/classfactory.cpp index 9d60b5b086..e636c1a880 100644 --- a/src/vm/classfactory.cpp +++ b/src/vm/classfactory.cpp @@ -145,7 +145,6 @@ public: STDMETHODIMP CreateInstance(LPUNKNOWN punkOuter, REFIID riid, void** ppv) { HRESULT hr = S_OK; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape // through this boundary but all it does is (in addition to checking that no exception has escaped it) @@ -156,17 +155,10 @@ public: // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); -#else // !FEATURE_CORRUPTING_EXCEPTIONS - SetupForComCallHR(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS CONTRACTL { -#ifdef FEATURE_CORRUPTING_EXCEPTIONS THROWS; // CSE can escape out of this function -#else // !FEATURE_CORRUPTING_EXCEPTIONS - NOTHROW; -#endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; SO_TOLERANT; @@ -183,9 +175,7 @@ public: hr = EEAllocateInstance(punkOuter, m_pMethodTable, m_hasLicensing, riid, TRUE, NULL, ppv); } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS EndSetupForComCallHRWithEscapingCorruptingExceptions(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS return hr; } @@ -214,7 +204,6 @@ public: { HRESULT hr = S_OK; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape // through this boundary but all it does is (in addition to checking that no exception has escaped it) @@ -225,17 +214,10 @@ public: // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); -#else // !FEATURE_CORRUPTING_EXCEPTIONS - SetupForComCallHR(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS CONTRACTL { -#ifdef FEATURE_CORRUPTING_EXCEPTIONS THROWS; // CSE can escape out of this function -#else // !FEATURE_CORRUPTING_EXCEPTIONS - NOTHROW; -#endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; @@ -274,9 +256,7 @@ public: } done: ; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS EndSetupForComCallHRWithEscapingCorruptingExceptions(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS return hr; } @@ -285,7 +265,6 @@ done: ; { HRESULT hr = S_OK; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape // through this boundary but all it does is (in addition to checking that no exception has escaped it) @@ -296,17 +275,10 @@ done: ; // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); -#else // !FEATURE_CORRUPTING_EXCEPTIONS - SetupForComCallHR(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS CONTRACTL { -#ifdef FEATURE_CORRUPTING_EXCEPTIONS THROWS; // CSE can escape out of this function -#else // !FEATURE_CORRUPTING_EXCEPTIONS - NOTHROW; -#endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; SO_TOLERANT; @@ -320,9 +292,7 @@ done: ; hr = EEAllocateInstance(punkOuter, m_pMethodTable, m_hasLicensing, riid, TRUE, NULL, ppv); } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS EndSetupForComCallHRWithEscapingCorruptingExceptions(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS return hr; } @@ -592,11 +562,7 @@ HRESULT STDMETHODCALLTYPE EEAllocateInstance(LPUNKNOWN pOuter, MethodTable* pMT, { CONTRACTL { -#ifdef FEATURE_CORRUPTING_EXCEPTIONS THROWS; // CSE can escape out of this function -#else // !FEATURE_CORRUPTING_EXCEPTIONS - NOTHROW; -#endif // FEATURE_CORRUPTING_EXCEPTIONS GC_TRIGGERS; MODE_PREEMPTIVE; SO_TOLERANT; @@ -618,19 +584,16 @@ HRESULT STDMETHODCALLTYPE EEAllocateInstance(LPUNKNOWN pOuter, MethodTable* pMT, HRESULT hr = S_OK; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Get the MethodDesc of the type being instantiated. Based upon it, // we will decide whether to rethrow a CSE or not in // END_EXTERNAL_ENTRYPOINT_RETHROW_CORRUPTING_EXCEPTIONS_EX below. PTR_MethodDesc pMDDefConst = NULL; BOOL fHasConstructor = FALSE; -#endif // FEATURE_CORRUPTING_EXCEPTIONS BEGIN_EXTERNAL_ENTRYPOINT(&hr) { GCX_COOP_THREAD_EXISTS(GET_THREAD()); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Get the MethodDesc of the type being instantiated. Based upon it, // we will decide whether to rethrow a CSE or not in // END_EXTERNAL_ENTRYPOINT_RETHROW_CORRUPTING_EXCEPTIONS_EX below. @@ -639,7 +602,6 @@ HRESULT STDMETHODCALLTYPE EEAllocateInstance(LPUNKNOWN pOuter, MethodTable* pMT, pMDDefConst = pMT->GetDefaultConstructor(); fHasConstructor = (pMDDefConst != NULL); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS EEAllocateInstanceWorker(pOuter, pMT, fHasLicensing, riid, fDesignTime, bstrKey, ppv); } diff --git a/src/vm/clrex.h b/src/vm/clrex.h index 02de452370..c6935a1237 100644 --- a/src/vm/clrex.h +++ b/src/vm/clrex.h @@ -762,7 +762,6 @@ class EEFileLoadException : public EEException #define GET_THROWABLE() CLRException::GetThrowableFromException(GET_EXCEPTION()) -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // For the VM folder, we redefine SET_CE_RETHROW_FLAG_FOR_EX_CATCH to also check the // corruption severity when deciding whether to rethrow them or not. @@ -816,7 +815,6 @@ class EEFileLoadException : public EEException ((!__state.DidCatchSO()) && (!__state.DidCatchCxx()) && \ CEHelper::IsLastActiveExceptionCorrupting(TRUE)))) -#endif // FEATURE_CORRUPTING_EXCEPTIONS #undef EX_TRY #define EX_TRY \ diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp index f0799add07..987ab7f39e 100644 --- a/src/vm/comdelegate.cpp +++ b/src/vm/comdelegate.cpp @@ -3970,7 +3970,7 @@ static void InvokeUnhandledSwallowing(OBJECTREF *pDelegate, // specified would enable this change for builds that dont support // FEATURE_EXCEPTION_NOTIFICATIONS, like CoreCLR. We dont want that to happen // as well. -#if defined(FEATURE_CORRUPTING_EXCEPTIONS) && defined(FEATURE_EXCEPTION_NOTIFICATIONS) +#if defined(FEATURE_EXCEPTION_NOTIFICATIONS) BOOL fCanMethodHandleException = g_pConfig->LegacyCorruptedStateExceptionsPolicy(); if (!fCanMethodHandleException) { diff --git a/src/vm/crossdomaincalls.cpp b/src/vm/crossdomaincalls.cpp index b528915a54..955e81e02e 100644 --- a/src/vm/crossdomaincalls.cpp +++ b/src/vm/crossdomaincalls.cpp @@ -1148,10 +1148,8 @@ CrossDomainChannel::BlitAndCall() } } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Assume that exception at server was NotCorrupting CorruptionSeverity severity = NotCorrupting; -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Push the frame ENTER_DOMAIN_ID(m_pSrvDomain); @@ -1527,9 +1525,7 @@ struct MarshalAndCallArgs : public CtxTransitionBaseArgs UINT64 uRegTypeMap; #endif -#ifdef FEATURE_CORRUPTING_EXCEPTIONS CorruptionSeverity severity; -#endif // FEATURE_CORRUPTING_EXCEPTIONS }; // Simple wrapper to go from C to C++. @@ -2539,10 +2535,8 @@ CrossDomainChannel::MarshalAndCall() args.uRegTypeMap = *(UINT64*)pMap; #endif -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // By default assume that exception thrown across the cross-AD call is NotCorrupting. args.severity = NotCorrupting; -#endif // FEATURE_CORRUPTING_EXCEPTIONS MakeCallWithPossibleAppDomainTransition(m_pSrvDomain, (FPAPPDOMAINCALLBACK) MarshalAndCall_Wrapper2, &args); } diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp index 4abfcc7dc7..9c170d9d98 100644 --- a/src/vm/eeconfig.cpp +++ b/src/vm/eeconfig.cpp @@ -265,10 +265,8 @@ HRESULT EEConfig::Init() fNewComVTableLayout = false; iImpersonationPolicy = IMP_DEFAULT; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // By default, there is not pre-V4 CSE policy fLegacyCorruptedStateExceptionsPolicy = false; -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef _DEBUG fLogTransparencyErrors = false; diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h index 8e21c445da..eb6801fc48 100644 --- a/src/vm/eeconfig.h +++ b/src/vm/eeconfig.h @@ -315,10 +315,8 @@ public: bool LegacyComVTableLayout(void) const {LIMITED_METHOD_CONTRACT; return fLegacyComVTableLayout; } bool NewComVTableLayout(void) const {LIMITED_METHOD_CONTRACT; return fNewComVTableLayout; } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Returns a bool to indicate if the legacy CSE (pre-v4) behaviour is enabled or not bool LegacyCorruptedStateExceptionsPolicy(void) const {LIMITED_METHOD_CONTRACT; return fLegacyCorruptedStateExceptionsPolicy; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // SECURITY unsigned ImpersonationMode(void) const @@ -908,9 +906,7 @@ private: //---------------------------------------------------------------- bool fLegacyUnhandledExceptionPolicy; // Old unhandled exception policy (many are swallowed) bool fLegacyVirtualMethodCallVerification; // Old (pre-whidbey) policy for call (nonvirt) of virtual function -#ifdef FEATURE_CORRUPTING_EXCEPTIONS bool fLegacyCorruptedStateExceptionsPolicy; -#endif // FEATURE_CORRUPTING_EXCEPTIONS bool fLegacyApartmentInitPolicy; // Old nondeterministic COM apartment initialization switch bool fLegacyComHierarchyVisibility; // Old behavior allowing QIs for classes with invisible parents diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 3a4685eb11..8b863ce999 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -162,9 +162,7 @@ PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord(); BOOL IsUnmanagedToManagedSEHHandler(EXCEPTION_REGISTRATION_RECORD*); VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable, BOOL rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity = NotCorrupting -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); //------------------------------------------------------------------------------- @@ -2800,9 +2798,7 @@ LONG RaiseExceptionFilter(EXCEPTION_POINTERS* ep, LPVOID pv) // Throw an object. //========================================================================== VOID DECLSPEC_NORETURN RaiseTheException(OBJECTREF throwable, BOOL rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { STATIC_CONTRACT_THROWS; @@ -2834,7 +2830,6 @@ VOID DECLSPEC_NORETURN RaiseTheException(OBJECTREF throwable, BOOL rethrow _ASSERTE(throwable != CLRException::GetPreallocatedStackOverflowException()); #endif -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (!g_pConfig->LegacyCorruptedStateExceptionsPolicy()) { // This is Scenario 3 described in clrex.h around the definition of SET_CE_RETHROW_FLAG_FOR_EX_CATCH macro. @@ -2884,7 +2879,6 @@ VOID DECLSPEC_NORETURN RaiseTheException(OBJECTREF throwable, BOOL rethrow LOG((LF_EH, LL_INFO100, "RaiseTheException - Set VM thrown managed exception severity to %d.\n", severity)); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS RaiseTheExceptionInternalOnly(throwable,rethrow); } @@ -3126,9 +3120,7 @@ VOID DECLSPEC_NORETURN RaiseTheExceptionInternalOnly(OBJECTREF throwable, BOOL r // INSTALL_COMPLUS_EXCEPTION_HANDLER has a filter, so must put the call in a separate fcn static VOID DECLSPEC_NORETURN RealCOMPlusThrowWorker(OBJECTREF throwable, BOOL rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -3157,18 +3149,14 @@ static VOID DECLSPEC_NORETURN RealCOMPlusThrowWorker(OBJECTREF throwable, BOOL r // TODO: Do we need to install COMPlusFrameHandler here? INSTALL_COMPLUS_EXCEPTION_HANDLER(); RaiseTheException(throwable, rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); UNINSTALL_COMPLUS_EXCEPTION_HANDLER(); } VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable, BOOL rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -3194,18 +3182,14 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable, BOOL rethrow } RealCOMPlusThrowWorker(throwable, rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); GCPROTECT_END(); } VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { CONTRACTL @@ -3217,9 +3201,7 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable CONTRACTL_END; RealCOMPlusThrow(throwable, FALSE -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); } @@ -3942,13 +3924,11 @@ BOOL IsUncatchable(OBJECTREF *pThrowable) if (OBJECTREFToObject(*pThrowable)->GetMethodTable() == g_pExecutionEngineExceptionClass) return TRUE; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Corrupting exceptions are also uncatchable if (CEHelper::IsProcessCorruptedStateException(*pThrowable)) { return TRUE; } -#endif //FEATURE_CORRUPTING_EXCEPTIONS } return FALSE; @@ -8889,12 +8869,10 @@ LONG ReflectionInvocationExceptionFilter( #error Unsupported platform #endif // _WIN64 -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (pEHTracker->GetCorruptionSeverity() == ProcessCorrupting) { EEPolicy::HandleFatalError(COR_E_FAILFAST, reinterpret_cast<UINT_PTR>(pExceptionInfo->ExceptionRecord->ExceptionAddress), NULL, pExceptionInfo); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } return ret; @@ -11417,7 +11395,6 @@ PTR_ExInfo GetEHTrackerForException(OBJECTREF oThrowable, PTR_ExInfo pStartingEH return fFoundTracker ? pEHTracker : NULL; } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // ----------------------------------------------------------------------- // Support for CorruptedState Exceptions // ----------------------------------------------------------------------- @@ -12245,7 +12222,6 @@ BOOL CEHelper::CanIDispatchTargetHandleException() return fCanMethodHandleException; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifndef DACCESS_COMPILE // When a managed thread starts in non-default domain, its callstack looks like below: @@ -12608,7 +12584,6 @@ static LONG ExceptionNotificationFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // This method will return a BOOL indicating if the delegate should be invoked for the exception // of the specified corruption severity. BOOL ExceptionNotifications::CanDelegateBeInvokedForException(OBJECTREF *pDelegate, CorruptionSeverity severity) @@ -12647,16 +12622,13 @@ BOOL ExceptionNotifications::CanDelegateBeInvokedForException(OBJECTREF *pDelega return fCanMethodHandleException; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // This method will make the actual delegate invocation for the exception notification to be delivered. If an // exception escapes out of the notification, our filter in ExceptionNotifications::DeliverNotification will // address it. void ExceptionNotifications::InvokeNotificationDelegate(ExceptionNotificationHandlerType notificationType, OBJECTREF *pDelegate, OBJECTREF *pEventArgs, OBJECTREF *pAppDomain -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { CONTRACTL @@ -12667,16 +12639,13 @@ void ExceptionNotifications::InvokeNotificationDelegate(ExceptionNotificationHan PRECONDITION(pDelegate != NULL && IsProtectedByGCFrame(pDelegate) && (*pDelegate != NULL)); PRECONDITION(pEventArgs != NULL && IsProtectedByGCFrame(pEventArgs)); PRECONDITION(pAppDomain != NULL && IsProtectedByGCFrame(pAppDomain)); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS PRECONDITION(severity > NotSet); -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Unhandled Exception Notification is delivered via Unhandled Exception Processing // mechanism. PRECONDITION(notificationType != UnhandledExceptionHandler); } CONTRACTL_END; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Notifications are delivered based upon corruption severity of the exception if (!ExceptionNotifications::CanDelegateBeInvokedForException(pDelegate, severity)) { @@ -12684,7 +12653,6 @@ void ExceptionNotifications::InvokeNotificationDelegate(ExceptionNotificationHan severity)); return; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // We've already exercised the prestub on this delegate's COMDelegate::GetMethodDesc, // as part of wiring up a reliable event sink in the BCL. Deliver the notification. @@ -12733,9 +12701,7 @@ BOOL ExceptionNotifications::CanDeliverNotificationToCurrentAppDomain(ExceptionN // our filter. void ExceptionNotifications::DeliverNotification(ExceptionNotificationHandlerType notificationType, OBJECTREF *pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { STATIC_CONTRACT_GC_TRIGGERS; @@ -12746,25 +12712,19 @@ void ExceptionNotifications::DeliverNotification(ExceptionNotificationHandlerTyp { ExceptionNotificationHandlerType notificationType; OBJECTREF *pThrowable; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS CorruptionSeverity severity; -#endif // FEATURE_CORRUPTING_EXCEPTIONS } args; args.notificationType = notificationType; args.pThrowable = pThrowable; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS args.severity = severity; -#endif // FEATURE_CORRUPTING_EXCEPTIONS PAL_TRY(TryArgs *, pArgs, &args) { // Make the call to the actual method that will invoke the callbacks ExceptionNotifications::DeliverNotificationInternal(pArgs->notificationType, pArgs->pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , pArgs->severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); } PAL_EXCEPT_FILTER(ExceptionNotificationFilter) @@ -12780,9 +12740,7 @@ void ExceptionNotifications::DeliverNotification(ExceptionNotificationHandlerTyp // This method will deliver the exception notification to the current AppDomain. void ExceptionNotifications::DeliverNotificationInternal(ExceptionNotificationHandlerType notificationType, OBJECTREF *pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ) { CONTRACTL @@ -12796,9 +12754,7 @@ void ExceptionNotifications::DeliverNotificationInternal(ExceptionNotificationHa PRECONDITION(notificationType != UnhandledExceptionHandler); PRECONDITION((pThrowable != NULL) && (*pThrowable != NULL)); PRECONDITION(ExceptionNotifications::CanDeliverNotificationToCurrentAppDomain(notificationType)); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS PRECONDITION(severity > NotSet); // Exception corruption severity must be valid at this point. -#endif // FEATURE_CORRUPTING_EXCEPTIONS } CONTRACTL_END; @@ -12868,9 +12824,7 @@ void ExceptionNotifications::DeliverNotificationInternal(ExceptionNotificationHa { ExceptionNotifications::InvokeNotificationDelegate(notificationType, &gc.oNotificationDelegate, &gc.oEventArgs, &gc.oCurAppDomain -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); } else @@ -12885,9 +12839,7 @@ void ExceptionNotifications::DeliverNotificationInternal(ExceptionNotificationHa gc.oInnerDelegate = gc.arrDelegates->m_Array[i]; ExceptionNotifications::InvokeNotificationDelegate(notificationType, &gc.oInnerDelegate, &gc.oEventArgs, &gc.oCurAppDomain -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); } } @@ -12929,9 +12881,7 @@ void ExceptionNotifications::DeliverFirstChanceNotification() _ASSERTE(oThrowable != NULL); ExceptionNotifications::DeliverNotification(FirstChanceExceptionHandler, &oThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , pCurTES->GetCurrentExceptionTracker()->GetCorruptionSeverity() -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); GCPROTECT_END(); diff --git a/src/vm/excep.h b/src/vm/excep.h index 6057c551a5..5818de709a 100644 --- a/src/vm/excep.h +++ b/src/vm/excep.h @@ -268,9 +268,7 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrowNonLocalized(RuntimeExceptionKind reKind, //========================================================================== VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity = NotCorrupting -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); //========================================================================== @@ -816,7 +814,6 @@ LONG ReflectionInvocationExceptionFilter( EXCEPTION_POINTERS *pExceptionInfo, // the pExceptionInfo passed to a filter function. PVOID pParam); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // ----------------------------------------------------------------------- // Support for Corrupted State Exceptions // ----------------------------------------------------------------------- @@ -852,7 +849,6 @@ public: void static ResetLastActiveCorruptionSeverityPostCatchHandler(Thread *pThread); }; -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifndef DACCESS_COMPILE // Switches to the previous AppDomain on the thread. See implementation for detailed comments. @@ -907,16 +903,12 @@ private: void static DeliverNotificationInternal(ExceptionNotificationHandlerType notificationType, OBJECTREF *pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); void static InvokeNotificationDelegate(ExceptionNotificationHandlerType notificationType, OBJECTREF *pDelegate, OBJECTREF *pEventArgs, OBJECTREF *pAppDomain -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); public: @@ -924,14 +916,10 @@ public: void static DeliverNotification(ExceptionNotificationHandlerType notificationType, OBJECTREF *pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS BOOL static CanDelegateBeInvokedForException(OBJECTREF *pDelegate, CorruptionSeverity severity); -#endif // FEATURE_CORRUPTING_EXCEPTIONS #endif // FEATURE_EXCEPTION_NOTIFICATIONS public: diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index 63192a2146..e48c648486 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -949,7 +949,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord !(dwExceptionFlags & EXCEPTION_UNWINDING), &STState); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Only setup the Corruption Severity in the first pass if (!(dwExceptionFlags & EXCEPTION_UNWINDING)) { @@ -964,7 +963,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord CEHelper::ShouldTreatActiveExceptionAsNonCorrupting()); } } -#endif // FEATURE_CORRUPTING_EXCEPTIONS { // Switch to COOP mode since we are going to work @@ -2380,7 +2378,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( if (fIsILStub && !fIsFunclet) // only make this callback on the main method body of IL stubs pUserMDForILStub = GetUserMethodForILStub(pThread, sf.SP, pMD, &pILStubFrame); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS BOOL fCanMethodHandleException = TRUE; CorruptionSeverity currentSeverity = NotCorrupting; { @@ -2397,7 +2394,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( currentSeverity = pThread->GetExceptionState()->GetCurrentExceptionTracker()->GetCorruptionSeverity(); fCanMethodHandleException = CEHelper::CanMethodHandleException(currentSeverity, pMDWithCEAttribute); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Doing rude abort. Skip all non-constrained execution region code. // When rude abort is initiated, we cannot intercept any exceptions. @@ -2622,7 +2618,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( EH_CLAUSE_ENUMERATOR EnumState; unsigned EHCount; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // The method cannot handle the exception (e.g. cannot handle the CE), then simply bail out // without examining the EH clauses in it. if (!fCanMethodHandleException) @@ -2636,7 +2631,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( EHCount = 0; } else -#endif // FEATURE_CORRUPTING_EXCEPTIONS { EHCount = pJitMan->InitializeEHEnumeration(MethToken, &EnumState); } @@ -3890,7 +3884,6 @@ ExceptionTracker* ExceptionTracker::GetOrCreateTracker( } } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (fCreateNewTracker) { // Exception tracker should be in the 2nd pass right now @@ -3902,7 +3895,6 @@ ExceptionTracker* ExceptionTracker::GetOrCreateTracker( // See comment in CEHelper::SetupCorruptionSeverityForActiveExceptionInUnwindPass for details CEHelper::SetupCorruptionSeverityForActiveExceptionInUnwindPass(pThread, pTracker, FALSE, pExceptionRecord->ExceptionCode); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } _ASSERTE(pTracker->m_pLimitFrame >= pThread->GetFrame()); @@ -4667,7 +4659,6 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar ThreadExceptionState * pCurTES = pCurThread->GetExceptionState(); _ASSERTE(pCurTES != NULL); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS ExceptionTracker* pEHTracker = pCurTES->GetCurrentExceptionTracker(); if (pEHTracker == NULL) { @@ -4679,7 +4670,6 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar pCurTES->SetLastActiveExceptionCorruptionSeverity(severity); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } throw std::move(ex); diff --git a/src/vm/exceptionhandling.h b/src/vm/exceptionhandling.h index e324d280df..f10ddef25f 100644 --- a/src/vm/exceptionhandling.h +++ b/src/vm/exceptionhandling.h @@ -80,10 +80,8 @@ public: m_WatsonBucketTracker.Init(); #endif // !FEATURE_PAL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Initialize the default exception severity to NotCorrupting m_CorruptionSeverity = NotSet; -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_EXCEPTION_NOTIFICATIONS // By default, mark the tracker as not having delivered the first @@ -142,10 +140,8 @@ public: m_WatsonBucketTracker.Init(); #endif // !FEATURE_PAL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Initialize the default exception severity to NotCorrupting m_CorruptionSeverity = NotSet; -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_EXCEPTION_NOTIFICATIONS // By default, mark the tracker as not having delivered the first @@ -597,7 +593,6 @@ public: } #endif // !FEATURE_PAL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS private: CorruptionSeverity m_CorruptionSeverity; public: @@ -614,7 +609,6 @@ public: m_CorruptionSeverity = severityToSet; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_EXCEPTION_NOTIFICATIONS private: diff --git a/src/vm/exceptmacros.h b/src/vm/exceptmacros.h index 2af064c96d..f1c7e56da7 100644 --- a/src/vm/exceptmacros.h +++ b/src/vm/exceptmacros.h @@ -254,7 +254,6 @@ extern LONG InternalUnhandledExceptionFilter_Worker(PEXCEPTION_POINTERS pExcepti // Installs a handler to unwind exception frames, but not catch the exception //========================================================================== -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // ----------------------------------------------------------------------- // Support for Corrupted State Exceptions // ----------------------------------------------------------------------- @@ -274,12 +273,9 @@ enum CorruptionSeverity #define GET_CORRUPTION_SEVERITY(severity) ((severity & (~ReuseForReraise))) #define CAN_REUSE_CORRUPTION_SEVERITY(severity) ((severity & ReuseForReraise) == ReuseForReraise) -#endif // FEATURE_CORRUPTING_EXCEPTIONS VOID DECLSPEC_NORETURN RaiseTheException(OBJECTREF throwable, BOOL rethrow -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); VOID DECLSPEC_NORETURN RaiseTheExceptionInternalOnly(OBJECTREF throwable, BOOL rethrow, BOOL fForStackOverflow = FALSE); diff --git a/src/vm/exinfo.cpp b/src/vm/exinfo.cpp index 1ae011e85a..9e79111590 100644 --- a/src/vm/exinfo.cpp +++ b/src/vm/exinfo.cpp @@ -113,10 +113,8 @@ void ExInfo::Init() DestroyExceptionHandle(); m_hThrowable = NULL; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Initialize the default exception severity to NotCorrupting m_CorruptionSeverity = NotSet; -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_EXCEPTION_NOTIFICATIONS // By default, mark the tracker as not having delivered the first diff --git a/src/vm/exinfo.h b/src/vm/exinfo.h index 2a8030fb56..dcf1ce5dea 100644 --- a/src/vm/exinfo.h +++ b/src/vm/exinfo.h @@ -90,7 +90,6 @@ public: } #endif -#ifdef FEATURE_CORRUPTING_EXCEPTIONS private: CorruptionSeverity m_CorruptionSeverity; public: @@ -107,7 +106,6 @@ public: m_CorruptionSeverity = severityToSet; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_EXCEPTION_NOTIFICATIONS private: diff --git a/src/vm/exstate.cpp b/src/vm/exstate.cpp index 29c7a063f5..331fe06da2 100644 --- a/src/vm/exstate.cpp +++ b/src/vm/exstate.cpp @@ -44,11 +44,9 @@ ThreadExceptionState::ThreadExceptionState() m_UEWatsonBucketTracker.Init(); #endif // !FEATURE_PAL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Initialize the default exception severity to NotCorrupting m_LastActiveExceptionCorruptionSeverity = NotSet; m_fCanReflectionTargetHandleException = FALSE; -#endif // FEATURE_CORRUPTING_EXCEPTIONS } diff --git a/src/vm/exstate.h b/src/vm/exstate.h index 50e71ed79b..5b92fed8ee 100644 --- a/src/vm/exstate.h +++ b/src/vm/exstate.h @@ -171,7 +171,6 @@ public: } #endif -#ifdef FEATURE_CORRUPTING_EXCEPTIONS private: CorruptionSeverity m_LastActiveExceptionCorruptionSeverity; BOOL m_fCanReflectionTargetHandleException; @@ -219,7 +218,6 @@ public: m_fCanReflectionTargetHandleException = fCanReflectionTargetHandleException; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS private: ThreadExceptionFlag m_flag; diff --git a/src/vm/frames.h b/src/vm/frames.h index 2c9ddb4ab0..1e45485aa5 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -838,9 +838,7 @@ private: friend class TailCallFrame; friend class AppDomain; friend VOID RealCOMPlusThrow(OBJECTREF -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , CorruptionSeverity severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); friend FCDECL0(VOID, JIT_StressGC); #ifdef _DEBUG diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp index 7c93963aad..8d176964de 100644 --- a/src/vm/i386/excepx86.cpp +++ b/src/vm/i386/excepx86.cpp @@ -1084,7 +1084,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. GCPROTECT_BEGIN(throwable); throwable = pThread->GetThrowable(); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS { BEGIN_SO_INTOLERANT_CODE(GetThread()); // Setup the state in current exception tracker indicating the corruption severity @@ -1093,7 +1092,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. CEHelper::ShouldTreatActiveExceptionAsNonCorrupting()); END_SO_INTOLERANT_CODE; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Check if we are dealing with AV or not and if we are, // ensure that this is a real AV and not managed AV exception @@ -2453,7 +2451,6 @@ StackWalkAction COMPlusThrowCallback( // SWA value if (fIsILStub) pUserMDForILStub = GetUserMethodForILStub(pThread, currentSP, pFunc, &pILStubFrame); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS CorruptionSeverity currentSeverity = pThread->GetExceptionState()->GetCurrentExceptionTracker()->GetCorruptionSeverity(); { // We must defer to the MethodDesc of the user method instead of the IL stub @@ -2465,7 +2462,6 @@ StackWalkAction COMPlusThrowCallback( // SWA value // is a CE or not. If it is, it will check if the method can process it or not. fMethodCanHandleException = CEHelper::CanMethodHandleException(currentSeverity, pMDWithCEAttribute); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS // Let the profiler know that we are searching for a handler within this function instance if (fGiveDebuggerAndProfilerNotification) @@ -2500,7 +2496,6 @@ StackWalkAction COMPlusThrowCallback( // SWA value EH_CLAUSE_ENUMERATOR pEnumState; unsigned EHCount = 0; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // If exception cannot be handled, then just bail out. We shouldnt examine the EH clauses // in such a method. if (!fMethodCanHandleException) @@ -2514,7 +2509,6 @@ StackWalkAction COMPlusThrowCallback( // SWA value EHCount = 0; } else -#endif // FEATURE_CORRUPTING_EXCEPTIONS { EHCount = pJitManager->InitializeEHEnumeration(pCf->GetMethodToken(), &pEnumState); } @@ -2800,7 +2794,6 @@ StackWalkAction COMPlusUnwindCallback (CrawlFrame *pCf, ThrowCallbackType *pData TypeHandle thrownType = TypeHandle(); BOOL fCanMethodHandleException = TRUE; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // MethodDesc's security information (i.e. whether it is critical or transparent) is calculated lazily. // If this method's security information was not precalculated, then it would have been in the first pass // already using Security::IsMethodCritical which could take have taken us down a path which is GC_TRIGGERS. @@ -2850,7 +2843,6 @@ StackWalkAction COMPlusUnwindCallback (CrawlFrame *pCf, ThrowCallbackType *pData } fCanMethodHandleException = CEHelper::CanMethodHandleException(currentSeverity, pFuncWithCEAttribute, FALSE); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef DEBUGGING_SUPPORTED LOG((LF_EH, LL_INFO1000, "COMPlusUnwindCallback: Intercept %d, pData->pFunc 0x%X, pFunc 0x%X, pData->pStack 0x%X, pStack 0x%X\n", @@ -2879,7 +2871,6 @@ StackWalkAction COMPlusUnwindCallback (CrawlFrame *pCf, ThrowCallbackType *pData EH_CLAUSE_ENUMERATOR pEnumState; unsigned EHCount; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (!fCanMethodHandleException) { LOG((LF_EH, LL_INFO100, "COMPlusUnwindCallback - CEHelper decided not to look for exception handlers in the method(MD:%p).\n", pFunc)); @@ -2891,7 +2882,6 @@ StackWalkAction COMPlusUnwindCallback (CrawlFrame *pCf, ThrowCallbackType *pData EHCount = 0; } else -#endif // FEATURE_CORRUPTING_EXCEPTIONS { EHCount = pJitManager->InitializeEHEnumeration(pCf->GetMethodToken(), &pEnumState); } diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index 6d4fd897c4..c1b306fdc3 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -5427,7 +5427,6 @@ HCIMPL1(void, IL_Throw, Object* obj) } } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS if (!g_pConfig->LegacyCorruptedStateExceptionsPolicy()) { // Within the VM, we could have thrown and caught a managed exception. This is done by @@ -5442,7 +5441,6 @@ HCIMPL1(void, IL_Throw, Object* obj) ThreadExceptionState *pExState = GetThread()->GetExceptionState(); pExState->SetLastActiveExceptionCorruptionSeverity(NotSet); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS RaiseTheExceptionInternalOnly(oref, FALSE); diff --git a/src/vm/listlock.cpp b/src/vm/listlock.cpp index 450e85aef5..ce6f8782f2 100644 --- a/src/vm/listlock.cpp +++ b/src/vm/listlock.cpp @@ -27,10 +27,8 @@ ListLockEntry::ListLockEntry(ListLock *pList, void *pData, const char *descripti m_hrResultCode(S_FALSE), m_hInitException(NULL), m_pLoaderAllocator(NULL) -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , m_CorruptionSeverity(NotCorrupting) -#endif // FEATURE_CORRUPTING_EXCEPTIONS { WRAPPER_NO_CONTRACT; } diff --git a/src/vm/listlock.h b/src/vm/listlock.h index e16741a7d7..2f4f967648 100644 --- a/src/vm/listlock.h +++ b/src/vm/listlock.h @@ -49,10 +49,8 @@ public: HRESULT m_hrResultCode; LOADERHANDLE m_hInitException; PTR_LoaderAllocator m_pLoaderAllocator; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Field to maintain the corruption severity of the exception CorruptionSeverity m_CorruptionSeverity; -#endif // FEATURE_CORRUPTING_EXCEPTIONS ListLockEntry(ListLock *pList, void *pData, const char *description = NULL); diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index 9fd5634f79..b7bd10eb3c 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -3364,7 +3364,6 @@ BOOL MethodTable::RunClassInitEx(OBJECTREF *pThrowable) *pThrowable = GET_THROWABLE(); _ASSERTE(fRet == FALSE); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // If active thread state does not have a CorruptionSeverity set for the exception, // then set one up based upon the current exception code and/or the throwable. // @@ -3395,7 +3394,6 @@ BOOL MethodTable::RunClassInitEx(OBJECTREF *pThrowable) { LOG((LF_EH, LL_INFO100, "MethodTable::RunClassInitEx - Exception already has corruption severity set.\n")); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } EX_END_CATCH(SwallowAllExceptions) @@ -3538,9 +3536,7 @@ void MethodTable::DoRunClassInitThrowing() // </FEATURE_CORRUPTING_EXCEPTIONS> COMPlusThrow(gc.pThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , pEntry->m_CorruptionSeverity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); } @@ -3631,7 +3627,6 @@ void MethodTable::DoRunClassInitThrowing() pEntry->m_hrResultCode = E_FAIL; SetClassInitError(); - #ifdef FEATURE_CORRUPTING_EXCEPTIONS // Save the corruption severity of the exception so that if the type system // attempts to pick it up from its cache list and throw again, it should // treat the exception as corrupting, if applicable. @@ -3639,12 +3634,9 @@ void MethodTable::DoRunClassInitThrowing() // We should be having a valid corruption severity at this point _ASSERTE(pEntry->m_CorruptionSeverity != NotSet); - #endif // FEATURE_CORRUPTING_EXCEPTIONS COMPlusThrow(gc.pThrowable - #ifdef FEATURE_CORRUPTING_EXCEPTIONS , pEntry->m_CorruptionSeverity - #endif // FEATURE_CORRUPTING_EXCEPTIONS ); } diff --git a/src/vm/namespace.h b/src/vm/namespace.h index e679fb5fe4..eb69aa907e 100644 --- a/src/vm/namespace.h +++ b/src/vm/namespace.h @@ -74,9 +74,7 @@ #define g_WindowsFoundationDiagNS "Windows.Foundation.Diagnostics" -#if defined(FEATURE_CORRUPTING_EXCEPTIONS) || defined(FEATURE_EXCEPTION_NOTIFICATIONS) #define g_ExceptionServicesNS g_RuntimeNS ".ExceptionServices" -#endif // defined(FEATURE_CORRUPTING_EXCEPTION) || defined(FEATURE_EXCEPTION_NOTIFICATIONS) #if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) #define g_LoaderNS g_RuntimeNS ".Loader" diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp index 6311bdf65d..c94fa8a92a 100644 --- a/src/vm/reflectioninvocation.cpp +++ b/src/vm/reflectioninvocation.cpp @@ -1121,14 +1121,12 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE } #endif // _DEBUG && !FEATURE_PAL -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Get the corruption severity of the exception that came in through reflection invocation. CorruptionSeverity severity = GetThread()->GetExceptionState()->GetLastActiveExceptionCorruptionSeverity(); // Since we are dealing with an exception, set the flag indicating if the target of Reflection can handle exception or not. // This flag is used in CEHelper::CanIDispatchTargetHandleException. GetThread()->GetExceptionState()->SetCanReflectionTargetHandleException(CEHelper::CanMethodHandleException(severity, pMethod)); -#endif // FEATURE_CORRUPTING_EXCEPTIONS OBJECTREF except = InvokeUtil::CreateTargetExcept(&targetException); @@ -1184,9 +1182,7 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE // Since VM is throwing the exception, we set it to use the same corruption severity // that the original exception came in with from reflection invocation. COMPlusThrow(except -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); GCPROTECT_END(); @@ -1501,11 +1497,9 @@ FCIMPL4(Object*, RuntimeMethodHandle::InvokeMethod, ENDFORBIDGC(); } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // By default, set the flag in TES indicating the reflection target can handle CSE. // This flag is used in CEHelper::CanIDispatchTargetHandleException. pThread->GetExceptionState()->SetCanReflectionTargetHandleException(TRUE); -#endif // FEATURE_CORRUPTING_EXCEPTIONS if (pValueClasses != NULL) { diff --git a/src/vm/stdinterfaces_wrapper.cpp b/src/vm/stdinterfaces_wrapper.cpp index c33c330798..c5248ace11 100644 --- a/src/vm/stdinterfaces_wrapper.cpp +++ b/src/vm/stdinterfaces_wrapper.cpp @@ -1357,7 +1357,6 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper(IDispatch* pDisp, DISPID dispidMember, { HRESULT hrRetVal = S_OK; -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // SetupForComCallHR uses "SO_INTOLERANT_CODE_NOTHROW" to setup the SO-Intolerant transition // for COM Interop. However, "SO_INTOLERANT_CODE_NOTHROW" expects that no exception can escape // through this boundary but all it does is (in addition to checking that no exception has escaped it) @@ -1368,9 +1367,6 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper(IDispatch* pDisp, DISPID dispidMember, // SO_INTOLERANT_CODE_NOTHROW and yet allow for CEs to escape through. Since there will be a corresponding // END_SO_INTOLERANT_CODE, the call is splitted into two parts: the Begin and End (see below). BeginSetupForComCallHRWithEscapingCorruptingExceptions(); -#else // !FEATURE_CORRUPTING_EXCEPTIONS - SetupForComCallHR(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS CONTRACTL @@ -1391,9 +1387,7 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper(IDispatch* pDisp, DISPID dispidMember, pvarResult, pexcepinfo, puArgErr, &hrRetVal}; Dispatch_Invoke_CallBack(&args); -#ifdef FEATURE_CORRUPTING_EXCEPTIONS EndSetupForComCallHRWithEscapingCorruptingExceptions(); -#endif // FEATURE_CORRUPTING_EXCEPTIONS return hrRetVal; } diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 3c90c87c1e..1d037013cd 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -5400,7 +5400,6 @@ void Thread::SyncManagedExceptionState(bool fIsDebuggerThread) SafeUpdateLastThrownObject(); } -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Since the catch clause has successfully executed and we are exiting it, reset the corruption severity // in the ThreadExceptionState for the last active exception. This will ensure that when the next exception // gets thrown/raised, EH tracker wont pick up an invalid value. @@ -5408,7 +5407,6 @@ void Thread::SyncManagedExceptionState(bool fIsDebuggerThread) { CEHelper::ResetLastActiveCorruptionSeverityPostCatchHandler(this); } -#endif // FEATURE_CORRUPTING_EXCEPTIONS } @@ -9125,14 +9123,12 @@ void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, Co ORBLOBREF orBlob = NULL; // Get the corruption severity for the exception caught at AppDomain transition boundary. -#ifdef FEATURE_CORRUPTING_EXCEPTIONS CorruptionSeverity severity = GetThread()->GetExceptionState()->GetLastActiveExceptionCorruptionSeverity(); if (severity == NotSet) { // No severity set at this point implies the exception was not corrupting severity = NotCorrupting; } -#endif // FEATURE_CORRUPTING_EXCEPTIONS #ifdef FEATURE_TESTHOOKS ADID adid=GetAppDomain()->GetId(); @@ -9249,9 +9245,7 @@ void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, Co // ... and throw it. VALIDATEOBJECTREF(gc.pMarshaledThrowable); COMPlusThrow(gc.pMarshaledThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS ); GCPROTECT_END(); diff --git a/src/vm/util.hpp b/src/vm/util.hpp index 4a213b7e75..945e6dbbbd 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -899,7 +899,6 @@ ComCallHostNotificationHR() InternalSetupForComCall(HOST_E_CLRNOTAVAILABLE, E_OUTOFMEMORY, COR_E_STACKOVERFLOW, false) \ ComCallHostNotificationHR() -#ifdef FEATURE_CORRUPTING_EXCEPTIONS // Since Corrupting exceptions can escape COM interop boundaries, // these macros will be used to setup the initial SO-Intolerant transition. @@ -930,7 +929,6 @@ if (FAILED(__hr)) \ return __hr; \ } \ -#endif // FEATURE_CORRUPTING_EXCEPTIONS #define SetupForComCallDWORD() \ InternalSetupForComCall(-1, -1, -1, true) \ |