diff options
-rw-r--r-- | src/inc/mscoruef.idl | 117 | ||||
-rw-r--r-- | src/vm/ceemain.cpp | 4 | ||||
-rw-r--r-- | src/vm/dwreport.cpp | 57 | ||||
-rw-r--r-- | src/vm/dwreport.h | 2 | ||||
-rw-r--r-- | src/vm/excep.cpp | 118 | ||||
-rw-r--r-- | src/vm/gcenv.h | 4 | ||||
-rw-r--r-- | src/vm/mscoruefwrapper.h | 19 | ||||
-rw-r--r-- | src/vm/threads.cpp | 12 |
8 files changed, 0 insertions, 333 deletions
diff --git a/src/inc/mscoruef.idl b/src/inc/mscoruef.idl deleted file mode 100644 index 4ed554f544..0000000000 --- a/src/inc/mscoruef.idl +++ /dev/null @@ -1,117 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -/************************************************************************************** - ** ** - ** Mscoruef.idl - interface definitions for internal UEF chain management. ** - ** ** - **************************************************************************************/ - -// -// Interface descriptions -// -import "unknwn.idl"; - -cpp_quote("#ifdef FEATURE_UEF_CHAINMANAGER") - -// IID IUEFManager : uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404) -cpp_quote("EXTERN_GUID(IID_IUEFManager, 0xf4d25df3, 0xe9b3, 0x439c, 0x8b, 0x2b, 0xc8, 0x14, 0xe3, 0x6f, 0x94, 0x4);") - -// IID IWatsonSxSManager :uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5) -cpp_quote("EXTERN_GUID(IID_IWatsonSxSManager, 0xa269593a, 0x51e2, 0x46bf, 0xb9, 0x14, 0x8d, 0xcc, 0x5c, 0x39, 0xb5, 0xa5);") - -cpp_quote("#ifdef __midl") - -#define EXCEPTION_MAXIMUM_PARAMETERS 15 - -typedef struct _EXCEPTION_RECORD { - DWORD ExceptionCode; - DWORD ExceptionFlags; - struct _EXCEPTION_RECORD *ExceptionRecord; - PVOID ExceptionAddress; - DWORD NumberParameters; - ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; -} EXCEPTION_RECORD, *PEXCEPTION_RECORD; - -typedef struct _EXCEPTION_POINTERS { - PEXCEPTION_RECORD ExceptionRecord; - PVOID ContextRecord; // not using PCONTEXT here to avoid pulling extra definitions into this file -} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS; - -typedef LONG (__stdcall *PTOP_LEVEL_EXCEPTION_FILTER)( - struct _EXCEPTION_POINTERS * pExceptionPointers); - -typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; - -cpp_quote("#endif // __midl") - -typedef BOOL (__stdcall * IsExceptionFromManagedCodeFnPtr)(EXCEPTION_RECORD * pExceptionRecord); - -//***************************************************************************** -// Interface for Watson SxS management to the VM. -//***************************************************************************** -[ - uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5), - helpstring("CLR Watson SxS Management Interface"), - pointer_default(unique), - local -] -interface IWatsonSxSManager : IUnknown -{ - // Used to register an exception claiming callback - BOOL RegisterExceptionClaimingCallback( - [in] IsExceptionFromManagedCodeFnPtr pCallback); - - // Used to unregister an exception claiming callback - BOOL UnregisterExceptionClaimingCallback( - [in] IsExceptionFromManagedCodeFnPtr pCallback); - - // Used to determine if the exception pointed by pExceptionRecord was thrown by a registered runtime - BOOL IsExceptionClaimed( - [in] EXCEPTION_RECORD * pExceptionRecord); - - // Used to check if Watson has been triggered - BOOL HasWatsonBeenTriggered(void); - - // Used to bestow the permission to report Watson to only one of its callers - BOOL IsCurrentRuntimeAllowedToReportWatson(void); - - // Used to wait for the Watson SxS completion event - BOOL WaitForWatsonSxSCompletionEvent(void); - - // Used to signal Watson SxS completion event - BOOL SignalWatsonSxSCompletionEvent(void); -}; - -//***************************************************************************** -// Interface for UEF chain management to the VM. -//***************************************************************************** -[ - uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404), - helpstring("CLR UEF Chain Management Interface"), - pointer_default(unique), - local -] -interface IUEFManager : IUnknown -{ - // Used to register the function to be invoked upon unhandled exception - // notification from the OS - BOOL AddUnhandledExceptionFilter( - [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc, - [in] BOOL firstHandler); - - // Used to unregister a previously registered UEF callback - BOOL RemoveUnhandledExceptionFilter( - [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc); - - // Used to explicitly invoke the registered UEF callbacks - LONG InvokeUEFCallbacks(LPEXCEPTION_POINTERS pExceptionInfo); - - // Used to return the WatsonSxSManager singleton instance - IWatsonSxSManager * GetWastonSxSManagerInstance(void); -}; - -cpp_quote("#endif // FEATURE_UEF_CHAINMANAGER") diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 0cf57bfa63..59ad618249 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -238,10 +238,6 @@ #include "../binder/inc/coreclrbindercommon.h" -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruefwrapper.h> -#endif // FEATURE_UEF_CHAINMANAGER #ifdef FEATURE_PERFMAP #include "perfmap.h" diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp index 6414ff5c0e..1ff3dea02c 100644 --- a/src/vm/dwreport.cpp +++ b/src/vm/dwreport.cpp @@ -29,10 +29,6 @@ #include "imagehlp.h" -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruefwrapper.h> -#endif // FEATURE_UEF_CHAINMANAGER EFaultRepRetVal DoReportFault(EXCEPTION_POINTERS * pExceptionInfo); @@ -42,9 +38,7 @@ static BOOL g_watsonErrorReportingEnabled = FALSE; // Variables to control launching Watson only once, but making all threads wait for that single launch to finish. LONG g_watsonAlreadyLaunched = 0; // Used to note that another thread has done Watson. -#if !defined(FEATURE_UEF_CHAINMANAGER) HandleHolder g_hWatsonCompletionEvent = NULL; // Used to signal that Watson has finished. -#endif // FEATURE_UEF_CHAINMANAGER const WCHAR kErrorReportingPoliciesKey[] = W("SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting"); const WCHAR kErrorReportingKey[] = W("SOFTWARE\\Microsoft\\PCHealth\\ErrorReporting"); @@ -177,14 +171,10 @@ BOOL InitializeWatson(COINITIEE fFlags) return TRUE; } -#if defined(FEATURE_UEF_CHAINMANAGER) - return TRUE; -#else // Create the event that all-but-the-first threads will wait on (the first thread // will set the event when Watson is done.) g_hWatsonCompletionEvent = WszCreateEvent(NULL, TRUE /*manual reset*/, FALSE /*initial state*/, NULL); return (g_hWatsonCompletionEvent != NULL); -#endif // FEATURE_UEF_CHAINMANAGER } // BOOL InitializeWatson() @@ -2219,7 +2209,6 @@ FaultReportResult DoFaultReportWorker( // Was Watson attempted, successful? return FaultReportResultQuit; } -#if !defined(FEATURE_UEF_CHAINMANAGER) // If we've already tried to report a Watson crash once, we don't really // want to pester the user about this exception. This can occur in certain // pathological programs. @@ -2235,7 +2224,6 @@ FaultReportResult DoFaultReportWorker( // Was Watson attempted, successful? return FaultReportResultQuit; } } -#endif // FEATURE_UEF_CHAINMANAGER // Assume an unmanaged fault until we determine otherwise. BOOL bIsManagedFault = FALSE; @@ -3109,51 +3097,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful? return fri.m_faultReportResult; } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && !tore.IsUserBreakpoint()) - { - IWatsonSxSManager * pWatsonSxSManager = g_pUEFManager->GetWastonSxSManagerInstance(); - - // Has Watson report been triggered? - if (pWatsonSxSManager->HasWatsonBeenTriggered()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson has been triggered.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - // The unhandled exception is thrown by the current runtime. - else if (IsExceptionFromManagedCode(pExceptionInfo->ExceptionRecord)) - { - // Is the current runtime allowed to report Watson? - if (!pWatsonSxSManager->IsCurrentRuntimeAllowedToReportWatson()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson is reported by another runtime.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - } - // The unhandled exception is thrown by another runtime in the process. - else if (pWatsonSxSManager->IsExceptionClaimed(pExceptionInfo->ExceptionRecord)) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson will be reported by another runtime.\n")); - return FaultReportResultQuit; - } - // The unhandled exception is thrown by native code. - else - { - // Is the current runtime allowed to report Watson? - if (!pWatsonSxSManager->IsCurrentRuntimeAllowedToReportWatson()) - { - LOG((LF_EH, LL_INFO100, "DoFaultReport: Watson is reported by another runtime.")); - LeaveRuntimeHolderNoThrow holder(reinterpret_cast< size_t >(WaitForSingleObject)); - pWatsonSxSManager->WaitForWatsonSxSCompletionEvent(); - return FaultReportResultQuit; - } - } - } -#endif // FEATURE_UEF_CHAINMANAGER // Check if the current thread has the permission to open a process handle of the current process. // If not, the current thread may have been impersonated, we have to launch Watson from a new thread as in SO case. diff --git a/src/vm/dwreport.h b/src/vm/dwreport.h index 44306689ea..77ed0fd35a 100644 --- a/src/vm/dwreport.h +++ b/src/vm/dwreport.h @@ -81,9 +81,7 @@ void ResetWatsonBucketsFavorWorker(void * pParam); extern LONG g_watsonAlreadyLaunched; -#if !defined(FEATURE_UEF_CHAINMANAGER) extern HandleHolder g_hWatsonCompletionEvent; -#endif // FEATURE_UEF_CHAINMANAGER //---------------------------------------------------------------------------- // Passes data between DoFaultReport and DoFaultReportCallback diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index f9455d2d3d..7fca6f02e7 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -48,12 +48,6 @@ #include <msodw.h> #endif // FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruefwrapper.h> -// The global UEFManager reference for use in the VM -IUEFManager * g_pUEFManager = NULL; -#endif // FEATURE_UEF_CHAINMANAGER // Support for extracting MethodDesc of a delegate. #include "comdelegate.h" @@ -4342,14 +4336,7 @@ LONG WatsonLastChance( // EXCEPTION_CONTINUE_SEARCH, _CONTINUE_ result = DoFaultReport(pExceptionInfo, tore); // Set the event to indicate that Watson processing is completed. Other threads can continue. -#if defined(FEATURE_UEF_CHAINMANAGER) - if (g_pUEFManager) - { - g_pUEFManager->GetWastonSxSManagerInstance()->SignalWatsonSxSCompletionEvent(); - } -#else UnsafeSetEvent(g_hWatsonCompletionEvent); -#endif // FEATURE_UEF_CHAINMANAGER } } @@ -4843,88 +4830,6 @@ BOOL InstallUnhandledExceptionFilter() { STATIC_CONTRACT_FORBID_FAULT; #ifndef FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager == NULL) { - - /*CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - } CONTRACTL_END;*/ - - static HMODULE hMSCorEE; - - if (!hMSCorEE) { - hMSCorEE = WszGetModuleHandle(MSCOREE_SHIM_W); - if (!hMSCorEE) { - - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get MSCorEE instance!"); - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to get MSCorEE instance!\n"); - - // Failure to get instance of mscoree.dll is fatal since that would imply - // that we cannot setup our UEF - return FALSE; - } - } - - // Signature of GetCLRUEFManager exported by MSCorEE.dll - typedef HRESULT (*pGetCLRUEFManager)(REFIID riid, - IUnknown **ppUnk); - - static pGetCLRUEFManager pFuncGetCLRUEFManager; - - if (!pFuncGetCLRUEFManager) { - - // Try to get function address via ordinal - pFuncGetCLRUEFManager = (pGetCLRUEFManager)GetProcAddress(hMSCorEE, MAKEINTRESOURCEA(24)); - if (!pFuncGetCLRUEFManager) { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get UEFManager!"); - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to find UEFManager!\n"); - return FALSE; - } - } - - HRESULT hr = (*pFuncGetCLRUEFManager)((REFIID)IID_IUEFManager, (IUnknown **)&g_pUEFManager); - if (FAILED(hr)) - { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to get IUEFManager*!"); - - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to get IUEFManager*\n"); - - // Ensure the reference to chain manager is NULL - g_pUEFManager= NULL; - - return FALSE; - } - - // Register our UEF callback with the UEF chain manager - if (!g_pUEFManager->AddUnhandledExceptionFilter(COMUnhandledExceptionFilter, TRUE)) - { - _ASSERTE(!"InstallUnhandledExceptionFilter failed to register the UEF callback!"); - - // Failed to register the UEF callback - STRESS_LOG0(LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter failed to register the UEF callback!\n"); - - g_pUEFManager->Release(); - - // Ensure the reference to chain manager is NULL - g_pUEFManager= NULL; - - return FALSE; - } - - // Register our exception claiming callback with the UEF chain manager on preWin7 - if (!RunningOnWin7() && !g_pUEFManager->GetWastonSxSManagerInstance()->RegisterExceptionClaimingCallback(IsExceptionFromManagedCodeCallback)) - { - _ASSERTE(!"RegisterExceptionClaimingCallback failed to register the exception claiming callback!"); - - // Failed to register the exception claiming callback - STRESS_LOG0(LF_EH, LL_INFO10, "RegisterExceptionClaimingCallback failed to register the exception claiming callback!"); - - return FALSE; - } - } -#else // !FEATURE_UEF_CHAINMANAGER // We will be here only for CoreCLR on WLC since we dont // register UEF for SL. if (g_pOriginalUnhandledExceptionFilter == FILTER_NOT_INSTALLED) { @@ -4938,7 +4843,6 @@ BOOL InstallUnhandledExceptionFilter() { LOG((LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter registered UEF with OS for CoreCLR!\n")); } _ASSERTE(g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED); -#endif // FEATURE_UEF_CHAINMANAGER #endif // !FEATURE_PAL // All done - successfully! @@ -4952,19 +4856,6 @@ void UninstallUnhandledExceptionFilter() { STATIC_CONTRACT_FORBID_FAULT; #ifndef FEATURE_PAL -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager) - { - if (!RunningOnWin7()) - { - g_pUEFManager->GetWastonSxSManagerInstance()->UnregisterExceptionClaimingCallback(IsExceptionFromManagedCodeCallback); - } - - g_pUEFManager->RemoveUnhandledExceptionFilter(COMUnhandledExceptionFilter); - g_pUEFManager->Release(); - g_pUEFManager = NULL; - } -#else // !FEATURE_UEF_CHAINMANAGER // We will be here only for CoreCLR on WLC or on Mac SL. if (g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED) { @@ -4976,7 +4867,6 @@ void UninstallUnhandledExceptionFilter() { g_pOriginalUnhandledExceptionFilter = FILTER_NOT_INSTALLED; LOG((LF_EH, LL_INFO10, "UninstallUnhandledExceptionFilter unregistered UEF from OS for CoreCLR!\n")); } -#endif // FEATURE_UEF_CHAINMANAGER #endif // !FEATURE_PAL } @@ -5548,14 +5438,6 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData) pThread->SetThreadStateNC(Thread::TSNC_ProcessedUnhandledException); } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && (ret == EXCEPTION_CONTINUE_SEARCH)) - { - // Since the "UEF" of this runtime instance didnt handle the exception, - // invoke the other registered UEF callbacks as well - ret = g_pUEFManager->InvokeUEFCallbacks(pExceptionInfo); - } -#endif // FEATURE_UEF_CHAINMANAGER END_SO_INTOLERANT_CODE; diff --git a/src/vm/gcenv.h b/src/vm/gcenv.h index 2e234b1432..865eb288e2 100644 --- a/src/vm/gcenv.h +++ b/src/vm/gcenv.h @@ -36,10 +36,6 @@ #endif // FEATURE_COMINTEROP -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruefwrapper.h> -#endif // FEATURE_UEF_CHAINMANAGER #define GCMemoryStatus MEMORYSTATUSEX diff --git a/src/vm/mscoruefwrapper.h b/src/vm/mscoruefwrapper.h deleted file mode 100644 index 75b540c97f..0000000000 --- a/src/vm/mscoruefwrapper.h +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// -//***************************************************************************** -// MSCorUEFWrapper.h - Wrapper for including the UEF chain manager definition -// and the global that references it for VM usage. -//***************************************************************************** - -#ifdef FEATURE_UEF_CHAINMANAGER - -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruef.h> -// Global reference to IUEFManager that will be used in the VM -extern IUEFManager * g_pUEFManager; - -#endif // FEATURE_UEF_CHAINMANAGER diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 007b1016fc..83dafd992f 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -54,10 +54,6 @@ #include "olecontexthelpers.h" #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT -#ifdef FEATURE_UEF_CHAINMANAGER -// This is required to register our UEF callback with the UEF chain manager -#include <mscoruefwrapper.h> -#endif // FEATURE_UEF_CHAINMANAGER SPTR_IMPL(ThreadStore, ThreadStore, s_pThreadStore); @@ -9309,14 +9305,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO } } -#ifdef FEATURE_UEF_CHAINMANAGER - if (g_pUEFManager && (ret == EXCEPTION_CONTINUE_SEARCH)) - { - // Since the "UEF" of this runtime instance didnt handle the exception, - // invoke the other registered UEF callbacks as well - ret = g_pUEFManager->InvokeUEFCallbacks(pExceptionInfo); - } -#endif // FEATURE_UEF_CHAINMANAGER END_SO_INTOLERANT_CODE; return ret; |