diff options
author | Austin Wise <AustinWise@gmail.com> | 2018-10-08 20:46:27 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-10-08 20:46:27 -0700 |
commit | 3f40e5280e376a01cc06f921b01f68319aa10ecc (patch) | |
tree | 15a5fdf225304ebc087c88048ecf4b69e2323e75 /src/utilcode | |
parent | 913428d5915a9729c9405f57a75e7f912f9d29a5 (diff) | |
download | coreclr-3f40e5280e376a01cc06f921b01f68319aa10ecc.tar.gz coreclr-3f40e5280e376a01cc06f921b01f68319aa10ecc.tar.bz2 coreclr-3f40e5280e376a01cc06f921b01f68319aa10ecc.zip |
Remove mentions of Rotor from codebase (#20298)
* Moving parsing from TypeNameParser ctor to a separate method.
It seems a bit odd to have the constructor parsing and then use
a dummy method (MakeRotorHappy) to make it look more normal.
* Remove CorMarkThreadInThreadPool.
It is neither referenced nor exported.
* Remove reference to rotor from securitywrapper.h
* Remove reference to rotor from Strike/vm.cpp.
This file is only built for Windows.
* Remove reference to rotor from debugreturn.h
This is the only file the defines these macros, so there is no need to
undef them first.
* Remove unused code refering to rotor from PAL.
* Remove references to Rotor from PAL.
* Remove references to deleted tests from DisabledTests.txt
I can't find any evidence that this file is actually used.
* Remove unneeded casts.
* Remove dead and misleading code from profilinghelper.cpp.
FEATURE_PROFAPI_EVENT_LOGGING is always defined when PROFILING_SUPPORTED
is defined. And the entire contents of profilinghelper.cpp is surrounded
with "ifdef PROFILING_SUPPORTED". So all sections in
"ifndef FEATURE_PROFAPI_EVENT_LOGGING" are dead.
Furthermore, in coreclr this does not use the eventlog, so the macro name
is misleading.
* Remove dead code in excep.cpp.
This entire function is surrounded with "ifndef FEATURE_PAL".
* Remove refererences to rotor from safemath.h
This does not appear to cause any compile problems, so nobody was using
safemath.h without _ASSERTE defined.
Also S_SIZE_T_WP64BUG is not used anywhere.
* Remove dead code from palclr.h.
I don't know why these check to see if the macro is undefined immediately
after defining them.
Also the comment appears to reference some unions that are no longer in
this file.
* Expose ISymUnmanagedWriter2 from SymWriter as required by COM.
The comment talks about the C# compiler using this, however I cannot see
a way for the C# compiler to get an instance of this. It is only used
internally by AssemblyBuilder and not exposed otherwise.
* Restore check for _ASSERTE in safemath.h.
On Windows sometimes that this file is included without
_ASSERTE being defined. As the existing comment suggests, it appears
that SOS explicitly does not want _ASSERTE to do anything.
Diffstat (limited to 'src/utilcode')
-rw-r--r-- | src/utilcode/securitywrapper.cpp | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/utilcode/securitywrapper.cpp b/src/utilcode/securitywrapper.cpp index 10672b7004..6dc5d767ca 100644 --- a/src/utilcode/securitywrapper.cpp +++ b/src/utilcode/securitywrapper.cpp @@ -748,93 +748,3 @@ void Win32SecurityDescriptor::InitFromHandle(HANDLE h) ThrowHR(hr); } } - -//----------------------------------------------------------------------------- -// We open several named kernel objects that are well-known names decorated with -// pid of some target process (usually a debuggee). -// Since anybody can create any kernel object with any name, we we want to make -// sure the objects we're opening were actually created by who we think they -// were. Each kernel object has an "owner" property which serves as the -// fingerprints of who created the handle. -// -// Check if the handle owner belongs to either the process specified by the -// pid or the current process (in case the target process is impersonating us). -// This lets us know if the handle is spoofed. -// -// Parameters: -// handle - handle for kernel object to test -// pid - target process that it may belong to. -// -// Returns: -// false- if we can verify that Owner(handle) is in the set of { Owner(Process(pid)), or Owner(this Process) } -// -// -// true - Elsewise, including if we can't verify that it's false. -//----------------------------------------------------------------------------- -bool IsHandleSpoofed(HANDLE handle, DWORD pid) -{ - CONTRACTL - { - NOTHROW; - } - CONTRACTL_END; - - _ASSERTE(handle != NULL); - _ASSERTE(pid != 0); - bool fIsSpoofed = true; - - EX_TRY - { - // Get the owner of the kernel object referenced by the handle. - Win32SecurityDescriptor sdHandle; - sdHandle.InitFromHandle(handle); - Sid sidOwner(sdHandle.GetOwner()); - - SidBuffer sbPidOther; - SidBuffer sbPidThis; - DWORD pidThis; - - // Is the object owner the "other" pid? - sbPidOther.InitFromProcess(pid); - if (Sid::Equals(sbPidOther.GetSid(), sidOwner)) - { - // We now know that the kernel object was created by the user of the "other" pid. - // This should be the common case by far. It's not spoofed. All is well. - fIsSpoofed = false; - goto Label_Done; - } - - // Test against our current pid if it's different than the "other" pid. - // This can happen if the other process impersonates us. The most common case would - // be if we're an admin and the other process (say some service) is impersonating Admin - // when it spins up the CLR. - pidThis = GetCurrentProcessId(); - if (pidThis != pid) - { - sbPidThis.InitFromProcess(pidThis); - if (Sid::Equals(sbPidThis.GetSid(), sidOwner)) - { - // The object was created by somebody pretending to be us. If they had sufficient permissions - // to pretend to be us, then we still trust them. - fIsSpoofed = false; - goto Label_Done; - } - } - - // This should only happen if we're being attacked. - _ASSERTE(fIsSpoofed); - STRESS_LOG2(LF_CORDB, LL_INFO1000, "Security Check failed with mismatch. h=%x,pid=%x", handle, pid); - -Label_Done: - ; - } - EX_CATCH - { - // This should only happen if something goes really bad and we can't find the information. - STRESS_LOG2(LF_CORDB, LL_INFO1000, "Security Check failed with exception. h=%x,pid=%x", handle, pid); - _ASSERTE(fIsSpoofed); // should still have its default value - } - EX_END_CATCH(SwallowAllExceptions); - - return fIsSpoofed; -} |