summaryrefslogtreecommitdiff
path: root/src/vm/corhost.cpp
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-07-31 14:46:29 -0700
committerGitHub <noreply@github.com>2018-07-31 14:46:29 -0700
commitd4f533b39db726cc61b0c8a5baab0f8c01c1fe7b (patch)
tree0ef5ccd166b532dc9be28ecde1262611c9b89f53 /src/vm/corhost.cpp
parent46b1ebabe1536ece7b808407af1f6d1dc5b1ba73 (diff)
downloadcoreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.tar.gz
coreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.tar.bz2
coreclr-d4f533b39db726cc61b0c8a5baab0f8c01c1fe7b.zip
Delete FEATURE_IPCMAN (#19212)
Diffstat (limited to 'src/vm/corhost.cpp')
-rw-r--r--src/vm/corhost.cpp330
1 files changed, 0 insertions, 330 deletions
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