diff options
author | Vance Morrison <vancemorrison@comcast.net> | 2016-02-18 09:34:15 -0800 |
---|---|---|
committer | Vance Morrison <vancemorrison@comcast.net> | 2016-02-18 09:56:07 -0800 |
commit | db4d650c93d83f613d89e6944bb8679a0993b5ea (patch) | |
tree | 40ecf7bd76e388c3a985241338a27a62d2afc735 /src/mscorlib | |
parent | 692e7cbeebe3017c8ff87453c50cf41748c19d6b (diff) | |
download | coreclr-db4d650c93d83f613d89e6944bb8679a0993b5ea.tar.gz coreclr-db4d650c93d83f613d89e6944bb8679a0993b5ea.tar.bz2 coreclr-db4d650c93d83f613d89e6944bb8679a0993b5ea.zip |
Revert "Revert "Remove useless security checks""
This reverts commit a5e803cf70d861022f3b6cddb9045edb8a222e78.
Remove more calls to PerformSecurityCheck
Diffstat (limited to 'src/mscorlib')
-rw-r--r-- | src/mscorlib/src/System/Reflection/ConstructorInfo.cs | 10 | ||||
-rw-r--r-- | src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs | 4 | ||||
-rw-r--r-- | src/mscorlib/src/System/Reflection/MethodInfo.cs | 4 | ||||
-rw-r--r-- | src/mscorlib/src/System/RtType.cs | 5 | ||||
-rw-r--r-- | src/mscorlib/src/System/RuntimeHandles.cs | 2 |
5 files changed, 17 insertions, 8 deletions
diff --git a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs b/src/mscorlib/src/System/Reflection/ConstructorInfo.cs index 4236b15adb..5db3a4c159 100644 --- a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs +++ b/src/mscorlib/src/System/Reflection/ConstructorInfo.cs @@ -626,15 +626,15 @@ namespace System.Reflection } +#if !FEATURE_CORECLR if ((invocationFlags &(INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0) { -#if !FEATURE_CORECLR if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) -#endif // !FEATURE_CORECLR RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags); } +#endif // !FEATURE_CORECLR Signature sig = Signature; @@ -719,19 +719,17 @@ namespace System.Reflection } #endif +#if !FEATURE_CORECLR if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY | INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR)) != 0) { -#if !FEATURE_CORECLR if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) -#endif // !FEATURE_CORECLR RuntimeMethodHandle.PerformSecurityCheck(null, this, m_declaringType, (uint)(m_invocationFlags | INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE)); -#if !FEATURE_CORECLR if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR) != 0) new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); -#endif // !FEATURE_CORECLR } +#endif // !FEATURE_CORECLR // get the signature Signature sig = Signature; diff --git a/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs b/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs index 99dc6f19b1..4e33cf2627 100644 --- a/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs +++ b/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs @@ -438,6 +438,7 @@ 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(); @@ -477,11 +478,13 @@ 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"); @@ -519,6 +522,7 @@ namespace System.Reflection.Emit new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand(); #pragma warning restore 618 #endif //FEATURE_CORECLR +#endif //!FEATURE_CORECLR } // diff --git a/src/mscorlib/src/System/Reflection/MethodInfo.cs b/src/mscorlib/src/System/Reflection/MethodInfo.cs index 2ef2c241a0..b5c022aa17 100644 --- a/src/mscorlib/src/System/Reflection/MethodInfo.cs +++ b/src/mscorlib/src/System/Reflection/MethodInfo.cs @@ -721,16 +721,16 @@ namespace System.Reflection } #endif +#if !FEATURE_CORECLR if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0) { -#if !FEATURE_CORECLR if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) -#endif // !FEATURE_CORECLR RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags); } +#endif // !FEATURE_CORECLR #endregion return UnsafeInvokeInternal(obj, parameters, arguments); diff --git a/src/mscorlib/src/System/RtType.cs b/src/mscorlib/src/System/RtType.cs index 8c82af9d3f..8478dcdcc4 100644 --- a/src/mscorlib/src/System/RtType.cs +++ b/src/mscorlib/src/System/RtType.cs @@ -5413,6 +5413,9 @@ 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); @@ -5467,9 +5470,11 @@ 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 diff --git a/src/mscorlib/src/System/RuntimeHandles.cs b/src/mscorlib/src/System/RuntimeHandles.cs index 21f17ce97b..12c65960ec 100644 --- a/src/mscorlib/src/System/RuntimeHandles.cs +++ b/src/mscorlib/src/System/RuntimeHandles.cs @@ -1196,6 +1196,7 @@ 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); @@ -1207,6 +1208,7 @@ namespace System GC.KeepAlive(method); return; } +#endif //!FEATURE_CORECLR #endregion [System.Security.SecuritySafeCritical] // auto-generated |