diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-07-31 14:46:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 14:46:29 -0700 |
commit | d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b (patch) | |
tree | 0ef5ccd166b532dc9be28ecde1262611c9b89f53 /src/vm | |
parent | 46b1ebabe1536ece7b808407af1f6d1dc5b1ba73 (diff) | |
download | coreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.tar.gz coreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.tar.bz2 coreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.zip |
Delete FEATURE_IPCMAN (#19212)
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/ceemain.cpp | 216 | ||||
-rw-r--r-- | src/vm/corhost.cpp | 330 | ||||
-rw-r--r-- | src/vm/vars.cpp | 5 | ||||
-rw-r--r-- | src/vm/vars.hpp | 7 |
4 files changed, 0 insertions, 558 deletions
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 2af2b27531..83f1b23002 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -145,16 +145,12 @@ #include "comdelegate.h" #include "appdomain.hpp" #include "perfcounters.h" -#ifdef FEATURE_IPCMAN -#include "ipcmanagerinterface.h" -#endif // FEATURE_IPCMAN #include "eventtrace.h" #include "corhost.h" #include "binder.h" #include "olevariant.h" #include "comcallablewrapper.h" #include "apithreadstress.h" -#include "ipcfunccall.h" #include "perflog.h" #include "../dlls/mscorrc/resource.h" #ifdef FEATURE_USE_LCID @@ -235,12 +231,6 @@ #include "gdbjit.h" #endif // FEATURE_GDBJIT -#ifdef FEATURE_IPCMAN -static HRESULT InitializeIPCManager(void); -static void PublishIPCManager(void); -static void TerminateIPCManager(void); -#endif // FEATURE_IPCMAN - #ifndef CROSSGEN_COMPILE static int GetThreadUICultureId(__out LocaleIDValue* pLocale); // TODO: This shouldn't use the LCID. We should rely on name instead @@ -705,14 +695,6 @@ void EEStartupHelper(COINITIEE fFlags) ETWFireEvent(EEStartupStart_V1); #endif // FEATURE_EVENT_TRACE -#ifdef FEATURE_IPCMAN - // Give PerfMon a chance to hook up to us - // Do this both *before* and *after* ipcman init so corperfmonext.dll - // has a chance to release stale private blocks that IPCMan could collide with. - // do this early to maximize window between perfmon refresh and ipc block creation. - IPCFuncCallSource::DoThreadSafeCall(); -#endif // FEATURE_IPCMAN - InitGSCookie(); Frame::Init(); @@ -820,23 +802,12 @@ void EEStartupHelper(COINITIEE fFlags) } #endif // FEATURE_PREJIT -#ifdef FEATURE_IPCMAN - // Initialize all our InterProcess Communications with COM+ - IfFailGoLog(InitializeIPCManager()); -#endif // FEATURE_IPCMAN - #ifdef ENABLE_PERF_COUNTERS hr = PerfCounters::Init(); _ASSERTE(SUCCEEDED(hr)); IfFailGo(hr); #endif -#ifdef FEATURE_IPCMAN - // Marks the data in the IPC blocks as initialized so that readers know - // that it is safe to read data from the blocks - PublishIPCManager(); -#endif //FEATURE_IPCMAN - #ifdef FEATURE_INTERPRETER Interpreter::Initialize(); #endif // FEATURE_INTERPRETER @@ -884,11 +855,6 @@ void EEStartupHelper(COINITIEE fFlags) g_pEEShutDownEvent = new CLREvent(); g_pEEShutDownEvent->CreateManualEvent(FALSE); -#ifdef FEATURE_IPCMAN - // Initialize CCLRSecurityAttributeManager - CCLRSecurityAttributeManager::ProcessInit(); -#endif // FEATURE_IPCMAN - VirtualCallStubManager::InitStatic(); GCInterface::m_MemoryPressureLock.Init(CrstGCMemoryPressure); @@ -963,14 +929,6 @@ void EEStartupHelper(COINITIEE fFlags) } #endif -#ifdef FEATURE_IPCMAN - // Give PerfMon a chance to hook up to us - // Do this both *before* and *after* ipcman init so corperfmonext.dll - // has a chance to release stale private blocks that IPCMan could collide with. - IPCFuncCallSource::DoThreadSafeCall(); - STRESS_LOG0(LF_STARTUP, LL_ALWAYS, "Returned successfully from second call to IPCFuncCallSource::DoThreadSafeCall"); -#endif // FEATURE_IPCMAN - InitPreStubManager(); #ifdef FEATURE_COMINTEROP @@ -1880,22 +1838,10 @@ part2: //@TODO: find the right place for this VirtualCallStubManager::UninitStatic(); -#ifdef FEATURE_IPCMAN - // Terminate the InterProcess Communications with COM+ - TerminateIPCManager(); -#endif // FEATURE_IPCMAN - #ifdef ENABLE_PERF_LOG PerfLog::PerfLogDone(); #endif //ENABLE_PERF_LOG -#ifdef FEATURE_IPCMAN - // Give PerfMon a chance to hook up to us - // Have perfmon resync list *after* we close IPC so that it will remove - // this process - IPCFuncCallSource::DoThreadSafeCall(); -#endif // FEATURE_IPCMAN - Frame::Term(); if (!g_fFastExitProcess) @@ -2629,12 +2575,6 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error. return TRUE; } - -#ifdef FEATURE_IPCMAN -extern CCLRSecurityAttributeManager s_CLRSecurityAttributeManager; -#endif // FEATURE_IPCMAN - - #ifdef DEBUGGING_SUPPORTED // // InitializeDebugger initialized the Runtime-side COM+ Debugging Services @@ -2752,164 +2692,8 @@ static void TerminateDebugger(void) } - -#ifdef FEATURE_IPCMAN -// --------------------------------------------------------------------------- -// Initialize InterProcess Communications for COM+ -// 1. Allocate an IPCManager Implementation and hook it up to our interface * -// 2. Call proper init functions to activate relevant portions of IPC block -// --------------------------------------------------------------------------- -static HRESULT InitializeIPCManager(void) -{ - CONTRACTL{ - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } CONTRACTL_END; - - HRESULT hr = S_OK; - HINSTANCE hInstIPCBlockOwner = 0; - - DWORD pid = 0; - // Allocate the Implementation. Everyone else will work through the interface - g_pIPCManagerInterface = new (nothrow) IPCWriterInterface(); - - if (g_pIPCManagerInterface == NULL) - { - hr = E_OUTOFMEMORY; - goto errExit; - } - - pid = GetCurrentProcessId(); - - - // Do general init - hr = g_pIPCManagerInterface->Init(); - - if (!SUCCEEDED(hr)) - { - goto errExit; - } - - // Generate private IPCBlock for our PID. Note that for the other side of the debugger, - // they'll hook up to the debuggee's pid (and not their own). So we still - // have to pass the PID in. - EX_TRY - { - // <TODO>This should go away in the future.</TODO> - hr = g_pIPCManagerInterface->CreateLegacyPrivateBlockTempV4OnPid(pid, FALSE, &hInstIPCBlockOwner); - } - EX_CATCH_HRESULT(hr); - - if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) - { - // We failed to create the IPC block because it has already been created. This means that - // two mscoree's have been loaded into the process. - PathString strFirstModule; - PathString strSecondModule; - EX_TRY - { - // Get the name and path of the first loaded MSCOREE.DLL. - if (!hInstIPCBlockOwner || !WszGetModuleFileName(hInstIPCBlockOwner, strFirstModule)) - strFirstModule.Set(W("<Unknown>")); - - // Get the name and path of the second loaded MSCOREE.DLL. - if (!WszGetModuleFileName(g_pMSCorEE, strSecondModule)) - strSecondModule.Set(W("<Unknown>")); - } - EX_CATCH_HRESULT(hr); - // Load the format strings for the title and the message body. - EEMessageBoxCatastrophic(IDS_EE_TWO_LOADED_MSCOREE_MSG, IDS_EE_TWO_LOADED_MSCOREE_TITLE, strFirstModule, strSecondModule); - goto errExit; - } - else - { - PathString temp; - if (!WszGetModuleFileName(GetModuleInst(), - temp - )) - { - hr = HRESULT_FROM_GetLastErrorNA(); - } - else - { - EX_TRY - { - if (temp.GetCount() + 1 > MAX_LONGPATH) - { - hr = E_FAIL; - } - else - { - wcscpy_s((PWSTR)g_pIPCManagerInterface->GetInstancePath(),temp.GetCount() + 1,temp); - } - } - EX_CATCH_HRESULT(hr); - } - } - - // Generate public IPCBlock for our PID. - EX_TRY - { - hr = g_pIPCManagerInterface->CreateSxSPublicBlockOnPid(pid); - } - EX_CATCH_HRESULT(hr); - - -errExit: - // If any failure, shut everything down. - if (!SUCCEEDED(hr)) - TerminateIPCManager(); - - return hr; -} -#endif // FEATURE_IPCMAN - #endif // DEBUGGING_SUPPORTED - -// --------------------------------------------------------------------------- -// Marks the IPC block as initialized so that other processes know that the -// block is safe to read -// --------------------------------------------------------------------------- -#ifdef FEATURE_IPCMAN -static void PublishIPCManager(void) -{ - CONTRACTL{ - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } CONTRACTL_END; - - if (g_pIPCManagerInterface != NULL) - g_pIPCManagerInterface->Publish(); -} -#endif // FEATURE_IPCMAN - - - -#ifdef FEATURE_IPCMAN -// --------------------------------------------------------------------------- -// Terminate all InterProcess operations -// --------------------------------------------------------------------------- -static void TerminateIPCManager(void) -{ - CONTRACTL{ - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } CONTRACTL_END; - - if (g_pIPCManagerInterface != NULL) - { - g_pIPCManagerInterface->Terminate(); - delete g_pIPCManagerInterface; - g_pIPCManagerInterface = NULL; - } - -} -#endif // FEATURE_IPCMAN - #ifndef LOCALE_SPARENT #define LOCALE_SPARENT 0x0000006d #endif diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index c93c2d8ff6..ef99dec970 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -22,9 +22,6 @@ #include "hosting.h" #include "eepolicy.h" #include "clrex.h" -#ifdef FEATURE_IPCMAN -#include "ipcmanagerinterface.h" -#endif // FEATURE_IPCMAN #include "comcallablewrapper.h" #include "invokeutil.h" #include "appdomain.inl" @@ -92,10 +89,6 @@ ULONG CorRuntimeHostBase::m_Version = 0; CCLRErrorReportingManager g_CLRErrorReportingManager; #endif // defined(FEATURE_WINDOWSPHONE) -#ifdef FEATURE_IPCMAN -static CCLRSecurityAttributeManager s_CLRSecurityAttributeManager; -#endif // FEATURE_IPCMAN - #endif // !DAC typedef DPTR(CONNID) PTR_CONNID; @@ -2617,329 +2610,6 @@ CCLRErrorReportingManager::~CCLRErrorReportingManager() #endif // defined(FEATURE_WINDOWSPHONE) -#ifdef FEATURE_IPCMAN - -CrstStatic CCLRSecurityAttributeManager::m_hostSAMutex; -PACL CCLRSecurityAttributeManager::m_pACL; - -SECURITY_ATTRIBUTES CCLRSecurityAttributeManager::m_hostSA; -SECURITY_DESCRIPTOR CCLRSecurityAttributeManager::m_hostSD; - -/* -* constructor -* -*/ -void CCLRSecurityAttributeManager::ProcessInit() -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - } - CONTRACTL_END; - - m_hostSAMutex.Init(CrstReDacl, CRST_UNSAFE_ANYMODE); - m_pACL = NULL; -} - -/* -* destructor -* -*/ -void CCLRSecurityAttributeManager::ProcessCleanUp() -{ - CONTRACTL - { - GC_NOTRIGGER; - NOTHROW; - } - CONTRACTL_END; - - m_hostSAMutex.Destroy(); - if (m_pACL) - CoTaskMemFree(m_pACL); -} - -// Set private block and events to the new ACL. -HRESULT CCLRSecurityAttributeManager::SetDACL(PACL pacl) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - DWORD dwError; - PACL pNewACL = NULL; - HANDLE hProc = NULL; - DWORD pid = 0; - - // @todo: How can we make sure that debugger attach will not attempt to happen during this time??? - // - CrstHolder ch(&m_hostSAMutex); - - // make sure our host pass our a valid ACL - if (!IsValidAcl(pacl)) - { - dwError = GetLastError(); - hr = HRESULT_FROM_WIN32(dwError); - goto ErrExit; - } - - // Cannnot set DACL while debugger is attached. Because the events are already all hooked up - // between LS and RS. - if (CORDebuggerAttached()) - return CORDBG_E_DEBUGGER_ALREADY_ATTACHED; - - // make a copy of the new ACL - pNewACL = (PACL) CoTaskMemAlloc(pacl->AclSize); - if (FAILED( CopyACL(pacl, pNewACL))) - goto ErrExit; - - _ASSERTE (SECURITY_DESCRIPTOR_MIN_LENGTH == sizeof(SECURITY_DESCRIPTOR)); - - if (!InitializeSecurityDescriptor(&m_hostSD, SECURITY_DESCRIPTOR_REVISION)) - { - hr = HRESULT_FROM_GetLastError(); - goto ErrExit; - } - - if (!SetSecurityDescriptorDacl(&m_hostSD, TRUE, pNewACL, FALSE)) - { - hr = HRESULT_FROM_GetLastError(); - goto ErrExit; - } - - // Now cache the pNewACL to m_pACL and delete m_pACL. - if (m_pACL) - CoTaskMemFree(m_pACL); - - m_pACL = pNewACL; - pNewACL = NULL; - - m_hostSA.nLength = sizeof(SECURITY_ATTRIBUTES); - m_hostSA.lpSecurityDescriptor = &m_hostSD; - m_hostSA.bInheritHandle = FALSE; - - // first of all, try to reDacl on the process token - pid = GetCurrentProcessId(); - hProc = OpenProcess(WRITE_DAC, FALSE, pid); - if (hProc == NULL) - { - hr = HRESULT_FROM_GetLastError(); - goto ErrExit; - } - if (SetKernelObjectSecurity(hProc, DACL_SECURITY_INFORMATION, &m_hostSD) == 0) - { - // failed! - hr = HRESULT_FROM_GetLastError(); - goto ErrExit; - } - - - // now reset all of the kernel object token's DACL. - // This will reDACL the global shared section - if (FAILED(g_pIPCManagerInterface->ReDaclLegacyPrivateBlock(&m_hostSD))) - goto ErrExit; - - // This will reDacl on debugger events. - if (g_pDebugInterface) - { - g_pDebugInterface->ReDaclEvents(&m_hostSD); - } - -ErrExit: - if (pNewACL) - CoTaskMemFree(pNewACL); - if (hProc != NULL) - CloseHandle(hProc); - - return hr; -} - -// cLen - specify the size of input buffer ppacl. If cLen is zero or ppacl is null, -// pcLenTotal will return the total size of required pacl buffer. -// pacl - caller allocated space. We will fill acl in this buffer. -// pcLenTotal - the total size of ACL. -// -HRESULT CCLRSecurityAttributeManager::GetDACL(PACL *ppacl) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - PACL pNewACL = NULL; - PACL pDefaultACL = NULL; - SECURITY_ATTRIBUTES *pSA = NULL; - - // output parameter cannot be NULL - if (ppacl == NULL) - return E_INVALIDARG; - - *ppacl = NULL; - - CrstHolder ch(&m_hostSAMutex); - - // we want to return the ACL of our default policy - if (m_pACL == NULL) - { - hr = g_pIPCManagerInterface->CreateWinNTDescriptor(GetCurrentProcessId(), &pSA, eDescriptor_Private); - if (FAILED(hr)) - { - goto ErrExit; - } - EX_TRY - { - BOOL bDaclPresent; - BOOL bDaclDefault; - - ::GetSecurityDescriptorDacl(pSA->lpSecurityDescriptor, &bDaclPresent, &pDefaultACL, &bDaclDefault); - } - EX_CATCH - { - hr = GET_EXCEPTION()->GetHR(); - } - EX_END_CATCH(SwallowAllExceptions); - if (FAILED(hr) || pDefaultACL == NULL || pDefaultACL->AclSize == 0) - { - goto ErrExit; - } - } - else - { - pDefaultACL = m_pACL; - } - - pNewACL = (PACL) CoTaskMemAlloc(pDefaultACL->AclSize); - if (pNewACL == NULL) - { - hr = E_OUTOFMEMORY; - goto ErrExit; - } - - // make a copy of ACL - hr = CCLRSecurityAttributeManager::CopyACL(pDefaultACL, pNewACL); - if (SUCCEEDED(hr)) - *ppacl = pNewACL; - -ErrExit: - if (FAILED(hr)) - { - if (pNewACL) - { - CoTaskMemFree(pNewACL); - } - } - if (pSA != NULL) - { - g_pIPCManagerInterface->DestroySecurityAttributes(pSA); - } - return hr; -} - - -// This API will duplicate a copy of pAclOrigingal and pass it out on ppAclNew -HRESULT CCLRSecurityAttributeManager::CopyACL(PACL pAclOriginal, PACL pNewACL) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - HRESULT hr = NO_ERROR; - DWORD dwError = GetLastError(); - int i; - ACE_HEADER *pDACLAce; - - _ASSERTE(pNewACL && pAclOriginal); - - // initialize the target ACL buffer - if (!InitializeAcl(pNewACL, pAclOriginal->AclSize, ACL_REVISION)) - { - dwError = GetLastError(); - hr = HRESULT_FROM_WIN32(dwError); - goto ErrExit; - } - - // loop through each existing ace and copy it over - for (i = 0; i < pAclOriginal->AceCount; i++) - { - if (!GetAce(pAclOriginal, i, (LPVOID *) &pDACLAce)) - { - dwError = GetLastError(); - hr = HRESULT_FROM_WIN32(dwError); - goto ErrExit; - } - - if (!AddAce(pNewACL, ACL_REVISION, i, pDACLAce, pDACLAce->AceSize)) - { - dwError = GetLastError(); - hr = HRESULT_FROM_WIN32(dwError); - goto ErrExit; - } - } - - // make sure everything went well with the new ACL - if (!IsValidAcl(pNewACL)) - { - dwError = GetLastError(); - hr = HRESULT_FROM_WIN32(dwError); - goto ErrExit; - } - -ErrExit: - return hr; -} - - -HRESULT CCLRSecurityAttributeManager::GetHostSecurityAttributes(SECURITY_ATTRIBUTES **ppSA) -{ - WRAPPER_NO_CONTRACT; - - if(!ppSA) - return E_POINTER; - - HRESULT hr = S_OK; - - *ppSA = NULL; - - // host has specified ACL - if (m_pACL != NULL) - *ppSA = &(m_hostSA); - - else - hr = g_pIPCManagerInterface->CreateWinNTDescriptor(GetCurrentProcessId(), ppSA, eDescriptor_Private); - - return hr; -} - -void CCLRSecurityAttributeManager::DestroyHostSecurityAttributes(SECURITY_ATTRIBUTES *pSA) -{ - WRAPPER_NO_CONTRACT; - - // no pSA to cleanup - if (pSA == NULL) - return; - - // it is our current host SA. - if (&(m_hostSA) == pSA) - return; - - g_pIPCManagerInterface->DestroySecurityAttributes(pSA); -} -#endif // FEATURE_IPCMAN - void GetProcessMemoryLoad(LPMEMORYSTATUSEX pMSEX) { CONTRACTL diff --git a/src/vm/vars.cpp b/src/vm/vars.cpp index 04437f9964..4884449efa 100644 --- a/src/vm/vars.cpp +++ b/src/vm/vars.cpp @@ -149,11 +149,6 @@ ETW::CEtwTracer * g_pEtwTracer = NULL; #endif // #ifndef DACCESS_COMPILE -#ifdef FEATURE_IPCMAN -// support for IPCManager -GPTR_IMPL(IPCWriterInterface, g_pIPCManagerInterface); -#endif // FEATURE_IPCMAN - // // Support for the COM+ Debugger. // diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp index b6da9c5a71..d01757d253 100644 --- a/src/vm/vars.hpp +++ b/src/vm/vars.hpp @@ -85,7 +85,6 @@ class MethodDesc; class SyncBlockCache; class SyncTableEntry; class ThreadStore; -class IPCWriterInterface; namespace ETW { class CEtwTracer; }; class DebugInterface; class DebugInfoManager; @@ -438,12 +437,6 @@ typedef DPTR(RCWCleanupList) PTR_RCWCleanupList; GPTR_DECL(RCWCleanupList,g_pRCWCleanupList); #endif // FEATURE_COMINTEROP -#ifdef FEATURE_IPCMAN -// support for IPCManager -typedef DPTR(IPCWriterInterface) PTR_IPCWriterInterface; -GPTR_DECL(IPCWriterInterface, g_pIPCManagerInterface); -#endif // FEATURE_IPCMAN - // support for Event Tracing for Windows (ETW) EXTERN ETW::CEtwTracer* g_pEtwTracer; |