Revert "Remove useless security checks"
authorJan Kotas <jkotas@microsoft.com>
Sat, 6 Feb 2016 16:45:25 +0000 (08:45 -0800)
committerJan Kotas <jkotas@microsoft.com>
Sat, 6 Feb 2016 16:45:25 +0000 (08:45 -0800)
src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs
src/mscorlib/src/System/RtType.cs
src/mscorlib/src/System/RuntimeHandles.cs
src/vm/ecalllist.h
src/vm/reflectioninvocation.cpp

index 4e33cf2..99dc6f1 100644 (file)
@@ -438,7 +438,6 @@ namespace System.Reflection.Emit
         [System.Security.SecurityCritical]  // auto-generated
         private void PerformSecurityCheck(Module m, ref StackCrawlMark stackMark, bool skipVisibility)
         {
-#if !FEATURE_CORECLR
             if (m == null) 
                 throw new ArgumentNullException("m");
             Contract.EndContractBlock();
@@ -478,13 +477,11 @@ namespace System.Reflection.Emit
                 new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
 #pragma warning restore 618
 #endif //FEATURE_CORECLR
-#endif //!FEATURE_CORECLR
         }
 
         [System.Security.SecurityCritical]  // auto-generated
         private void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility)
         {
-#if !FEATURE_CORECLR
             if (owner == null)
                 throw new ArgumentNullException("owner");
 
@@ -522,7 +519,6 @@ namespace System.Reflection.Emit
                 new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
 #pragma warning restore 618
 #endif //FEATURE_CORECLR
-#endif //!FEATURE_CORECLR
         }
 
         //
index 8478dcd..8c82af9 100644 (file)
@@ -5413,9 +5413,6 @@ namespace System
                 bCanBeCached = false;
             }
 #endif
-#if FEATURE_CORECLR
-            bSecurityCheckOff = true;       // CoreCLR does not use security at all.   
-#endif
 
             Object instance = RuntimeTypeHandle.CreateInstance(this, publicOnly, bSecurityCheckOff, ref bCanBeCached, ref runtime_ctor, ref bNeedSecurityCheck);
 
@@ -5470,11 +5467,9 @@ namespace System
 
                     if (ace.m_ctor != null)
                     {
-#if !FEATURE_CORECLR
                         // Perform security checks if needed
                         if (ace.m_bNeedSecurityCheck)
                             RuntimeMethodHandle.PerformSecurityCheck(instance, ace.m_hCtorMethodHandle, this, (uint)INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE);
-#endif
 
                         // Call ctor (value types wont have any)
                         try
index 565169e..21f17ce 100644 (file)
@@ -1196,20 +1196,16 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         static extern internal uint GetSpecialSecurityFlags(IRuntimeMethodInfo method);
 
-#if !FEATURE_CORECLR
         [System.Security.SecurityCritical]  // auto-generated
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         static extern internal void PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, uint invocationFlags);
-#endif //!FEATURE_CORECLR
 
         [System.Security.SecurityCritical]
         static internal void PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags)
         {
-#if !FEATURE_CORECLR
             RuntimeMethodHandle.PerformSecurityCheck(obj, method.Value, parent, invocationFlags);
             GC.KeepAlive(method);
             return;
-#endif //!FEATURE_CORECLR
         }
         #endregion
 
index ee645c2..2eef162 100644 (file)
@@ -575,9 +575,7 @@ FCFuncStart(gRuntimeMethodHandle)
     QCFuncElement("GetCallerType", RuntimeMethodHandle::GetCallerType)
     FCFuncElement("GetLoaderAllocator", RuntimeMethodHandle::GetLoaderAllocator)
     FCFuncElement("GetSpecialSecurityFlags", ReflectionInvocation::GetSpecialSecurityFlags)
-#ifndef FEATURE_CORECLR
     FCFuncElement("PerformSecurityCheck", ReflectionInvocation::PerformSecurityCheck)
-#endif // FEATURE_CORECLR
 FCFuncEnd()
 
 FCFuncStart(gCOMDefaultBinderFuncs)
index edbb678..f94e2f5 100644 (file)
@@ -2,8 +2,10 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 //
+
 //
 
+
 #include "common.h"
 #include "reflectioninvocation.h"
 #include "invokeutil.h"
@@ -898,8 +900,6 @@ FCIMPL1(DWORD, ReflectionInvocation::GetSpecialSecurityFlags, ReflectMethodObjec
 }
 FCIMPLEND
 
-#ifndef FEATURE_CORECLR
-
 // Can not inline this function.
 #ifdef _MSC_VER
 __declspec(noinline)
@@ -1000,8 +1000,6 @@ FCIMPL4(void, ReflectionInvocation::PerformSecurityCheck, Object *target, Method
 }
 FCIMPLEND
 
-#endif // FEATURE_CORECLR
-
 /****************************************************************************/
 /* boxed Nullable<T> are represented as a boxed T, so there is no unboxed
    Nullable<T> inside to point at by reference.  Because of this a byref