From 7772294d85c9fee26fd92e2092bee9ef099394c0 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Fri, 9 Dec 2016 13:42:16 -0800 Subject: [PATCH] Strip some security related attributes (dotnet/coreclr#8571) Strips SecurityCritical, SecuritySafeCritical, SecurityPermission, EnvironmentPermission, and PermissionSet attributes. Also removes empty defines these left behind. Patterns used: ^.*\[(System\.Security\.)?SecurityCritical\](\s*//.*|\s*)$[\r\n]* ^.*#if FEATURE_CORECLR[\s\r\n]*(#else)?[\s\r\n]*#endif.*[\r\n]* ^.*\[(System\.Security\.Permissions\.)?SecurityPermission(Attribute)?\([^)]*\)\](\s*//.*|\s*)$[\r\n]* Commit migrated from https://github.com/dotnet/coreclr/commit/345e201f027eb35a7a01e1714afe36b831b6f1e3 --- .../src/mscorlib/Common/PinnableBufferCache.cs | 17 -- .../Windows/mincore/Interop.SafeCreateFile.cs | 1 - .../Windows/mincore/Interop.UnsafeCreateFile.cs | 1 - .../Win32/SafeHandles/SafeFileHandle.Windows.cs | 2 - .../System/Runtime/InteropServices/StringBuffer.cs | 1 - .../src/Internal/Runtime/Augments/RuntimeThread.cs | 26 --- .../mscorlib/src/Microsoft/Win32/OAVariantLib.cs | 2 - .../src/mscorlib/src/Microsoft/Win32/Registry.cs | 4 - .../mscorlib/src/Microsoft/Win32/RegistryKey.cs | 44 ---- .../Win32/SafeHandles/SafeFileMappingHandle.cs | 4 - .../Microsoft/Win32/SafeHandles/SafeFindHandle.cs | 3 - .../Win32/SafeHandles/SafeLibraryHandle.cs | 2 - .../Win32/SafeHandles/SafeLocalAllocHandle.cs | 2 - .../Win32/SafeHandles/SafeRegistryHandle.cs | 4 - .../Win32/SafeHandles/SafeViewOfFileHandle.cs | 4 - .../Microsoft/Win32/SafeHandles/SafeWaitHandle.cs | 2 - .../Win32/SafeHandles/Win32SafeHandles.cs | 8 - .../src/Microsoft/Win32/UnsafeNativeMethods.cs | 8 - .../mscorlib/src/Microsoft/Win32/Win32Native.cs | 5 - src/coreclr/src/mscorlib/src/System/Activator.cs | 12 -- .../src/mscorlib/src/System/AggregateException.cs | 2 - .../mscorlib/src/System/AppContext/AppContext.cs | 13 -- src/coreclr/src/mscorlib/src/System/AppDomain.cs | 135 ------------ .../src/mscorlib/src/System/AppDomainManager.cs | 4 - .../src/mscorlib/src/System/AppDomainSetup.cs | 20 -- src/coreclr/src/mscorlib/src/System/ArgIterator.cs | 11 - .../src/mscorlib/src/System/ArgumentException.cs | 1 - .../mscorlib/src/System/ArgumentNullException.cs | 1 - .../src/System/ArgumentOutOfRangeException.cs | 1 - src/coreclr/src/mscorlib/src/System/Array.cs | 52 ----- src/coreclr/src/mscorlib/src/System/Attribute.cs | 3 - src/coreclr/src/mscorlib/src/System/BCLDebug.cs | 9 - .../mscorlib/src/System/BadImageFormatException.cs | 3 - .../src/mscorlib/src/System/BitConverter.cs | 14 -- src/coreclr/src/mscorlib/src/System/Buffer.cs | 19 -- src/coreclr/src/mscorlib/src/System/Byte.cs | 4 - src/coreclr/src/mscorlib/src/System/CLRConfig.cs | 2 - src/coreclr/src/mscorlib/src/System/CfgParser.cs | 2 - src/coreclr/src/mscorlib/src/System/Char.cs | 1 - .../mscorlib/src/System/Collections/ArrayList.cs | 3 - .../mscorlib/src/System/Collections/Comparer.cs | 1 - .../System/Collections/Generic/ArraySortHelper.cs | 2 - .../src/System/Collections/Generic/Comparer.cs | 5 - .../src/System/Collections/Generic/Dictionary.cs | 1 - .../System/Collections/Generic/EqualityComparer.cs | 7 - .../mscorlib/src/System/Collections/Hashtable.cs | 2 - src/coreclr/src/mscorlib/src/System/Convert.cs | 13 -- src/coreclr/src/mscorlib/src/System/Currency.cs | 2 - src/coreclr/src/mscorlib/src/System/DBNull.cs | 1 - src/coreclr/src/mscorlib/src/System/DateTime.cs | 4 - .../src/mscorlib/src/System/DateTimeOffset.cs | 1 - src/coreclr/src/mscorlib/src/System/Decimal.cs | 52 ----- .../src/mscorlib/src/System/DefaultBinder.cs | 7 - src/coreclr/src/mscorlib/src/System/Delegate.cs | 32 --- .../src/System/DelegateSerializationHolder.cs | 5 - .../src/mscorlib/src/System/Diagnostics/Assert.cs | 2 - .../src/System/Diagnostics/AssertFilter.cs | 1 - .../src/System/Diagnostics/Contracts/Contracts.cs | 2 - .../System/Diagnostics/Contracts/ContractsBCL.cs | 14 -- .../mscorlib/src/System/Diagnostics/Debugger.cs | 9 - .../System/Diagnostics/Eventing/ActivityTracker.cs | 5 - .../System/Diagnostics/Eventing/EventProvider.cs | 13 -- .../src/System/Diagnostics/Eventing/EventSource.cs | 42 ---- .../Diagnostics/Eventing/EventSource_CoreCLR.cs | 4 - .../Eventing/TraceLogging/DataCollector.cs | 1 - .../TraceLogging/TraceLoggingDataCollector.cs | 1 - .../TraceLogging/TraceLoggingEventSource.cs | 12 -- .../mscorlib/src/System/Diagnostics/LogSwitch.cs | 3 - .../mscorlib/src/System/Diagnostics/Stackframe.cs | 15 -- .../mscorlib/src/System/Diagnostics/Stacktrace.cs | 38 ---- .../System/Diagnostics/SymbolStore/ISymWriter.cs | 30 --- .../src/mscorlib/src/System/Diagnostics/log.cs | 2 - src/coreclr/src/mscorlib/src/System/Double.cs | 8 - src/coreclr/src/mscorlib/src/System/Empty.cs | 1 - src/coreclr/src/mscorlib/src/System/Enum.cs | 24 --- src/coreclr/src/mscorlib/src/System/Environment.cs | 59 ------ src/coreclr/src/mscorlib/src/System/Exception.cs | 42 ---- src/coreclr/src/mscorlib/src/System/GC.cs | 48 ----- .../mscorlib/src/System/Globalization/Calendar.cs | 1 - .../src/System/Globalization/CalendarData.cs | 3 - .../src/System/Globalization/CharUnicodeInfo.cs | 11 - .../src/System/Globalization/CompareInfo.cs | 20 -- .../src/System/Globalization/CultureData.cs | 52 ----- .../src/System/Globalization/CultureInfo.cs | 30 --- .../Globalization/CultureNotFoundException.cs | 1 - .../src/System/Globalization/DateTimeFormat.cs | 2 - .../src/System/Globalization/DateTimeFormatInfo.cs | 9 - .../Globalization/DateTimeFormatInfoScanner.cs | 3 - .../src/System/Globalization/DateTimeParse.cs | 8 - .../src/System/Globalization/EncodingDataItem.cs | 5 - .../src/System/Globalization/EncodingTable.cs | 12 -- .../System/Globalization/GlobalizationAssembly.cs | 1 - .../src/System/Globalization/HijriCalendar.cs | 2 - .../src/System/Globalization/IdnMapping.cs | 4 - .../src/System/Globalization/JapaneseCalendar.cs | 1 - .../src/System/Globalization/NumberFormatInfo.cs | 1 - .../src/System/Globalization/RegionInfo.cs | 16 -- .../mscorlib/src/System/Globalization/TextInfo.cs | 15 -- .../src/System/Globalization/TimeSpanFormat.cs | 1 - src/coreclr/src/mscorlib/src/System/Guid.cs | 14 -- .../mscorlib/src/System/IAppDomainPauseManager.cs | 11 - .../src/mscorlib/src/System/IO/BinaryReader.cs | 5 - .../src/mscorlib/src/System/IO/BinaryWriter.cs | 4 - .../src/mscorlib/src/System/IO/Directory.cs | 26 --- .../src/mscorlib/src/System/IO/DirectoryInfo.cs | 16 -- .../src/mscorlib/src/System/IO/DriveInfo.cs | 11 - src/coreclr/src/mscorlib/src/System/IO/File.cs | 41 ---- src/coreclr/src/mscorlib/src/System/IO/FileInfo.cs | 14 -- .../mscorlib/src/System/IO/FileLoadException.cs | 5 - .../src/System/IO/FileNotFoundException.cs | 2 - .../mscorlib/src/System/IO/FileSecurityState.cs | 5 - .../mscorlib/src/System/IO/FileSystemEnumerable.cs | 25 --- .../src/mscorlib/src/System/IO/FileSystemInfo.cs | 13 -- .../src/System/IO/PinnedBufferMemoryStream.cs | 3 - src/coreclr/src/mscorlib/src/System/IO/Stream.cs | 6 - .../src/mscorlib/src/System/IO/StreamReader.cs | 2 - .../src/mscorlib/src/System/IO/StreamWriter.cs | 4 - .../src/System/IO/UnmanagedMemoryAccessor.cs | 37 ---- .../src/System/IO/UnmanagedMemoryStream.cs | 23 -- .../src/System/IO/UnmanagedMemoryStreamWrapper.cs | 1 - src/coreclr/src/mscorlib/src/System/IO/__Error.cs | 5 - src/coreclr/src/mscorlib/src/System/Int16.cs | 3 - src/coreclr/src/mscorlib/src/System/Int32.cs | 4 - src/coreclr/src/mscorlib/src/System/Int64.cs | 4 - src/coreclr/src/mscorlib/src/System/IntPtr.cs | 21 -- src/coreclr/src/mscorlib/src/System/Internal.cs | 8 - .../src/mscorlib/src/System/LowLevelConsole.cs | 3 - src/coreclr/src/mscorlib/src/System/Math.cs | 23 -- src/coreclr/src/mscorlib/src/System/MathF.cs | 21 -- .../mscorlib/src/System/MissingFieldException.cs | 1 - .../mscorlib/src/System/MissingMemberException.cs | 3 - .../mscorlib/src/System/MissingMethodException.cs | 1 - .../src/mscorlib/src/System/MulticastDelegate.cs | 31 --- .../src/System/NotFiniteNumberException.cs | 1 - src/coreclr/src/mscorlib/src/System/Number.cs | 39 ---- src/coreclr/src/mscorlib/src/System/Object.cs | 3 - .../mscorlib/src/System/ObjectDisposedException.cs | 1 - .../src/mscorlib/src/System/OleAutBinder.cs | 1 - .../src/mscorlib/src/System/OperatingSystem.cs | 1 - .../src/mscorlib/src/System/ParseNumbers.cs | 8 - .../src/mscorlib/src/System/Reflection/Assembly.cs | 133 ------------ .../mscorlib/src/System/Reflection/AssemblyName.cs | 20 -- .../mscorlib/src/System/Reflection/Associates.cs | 2 - .../src/System/Reflection/ConstructorInfo.cs | 14 -- .../src/System/Reflection/CustomAttribute.cs | 64 ------ .../src/System/Reflection/Emit/AQNBuilder.cs | 30 --- .../src/System/Reflection/Emit/AssemblyBuilder.cs | 73 ------- .../System/Reflection/Emit/AssemblyBuilderData.cs | 2 - .../System/Reflection/Emit/ConstructorBuilder.cs | 8 - .../Reflection/Emit/CustomAttributeBuilder.cs | 3 - .../System/Reflection/Emit/DynamicILGenerator.cs | 21 -- .../src/System/Reflection/Emit/DynamicMethod.cs | 49 ----- .../src/System/Reflection/Emit/EnumBuilder.cs | 4 - .../src/System/Reflection/Emit/EventBuilder.cs | 11 - .../src/System/Reflection/Emit/FieldBuilder.cs | 15 -- .../Reflection/Emit/GenericTypeParameterBuilder.cs | 3 - .../src/System/Reflection/Emit/ILGenerator.cs | 19 -- .../src/System/Reflection/Emit/ISymWrapperCore.cs | 125 ----------- .../src/System/Reflection/Emit/MethodBuilder.cs | 25 --- .../src/System/Reflection/Emit/ModuleBuilder.cs | 118 ----------- .../System/Reflection/Emit/ModuleBuilderData.cs | 3 - .../src/System/Reflection/Emit/ParameterBuilder.cs | 5 - .../src/System/Reflection/Emit/PropertyBuilder.cs | 11 - .../src/System/Reflection/Emit/SignatureHelper.cs | 18 -- .../src/System/Reflection/Emit/SymbolMethod.cs | 1 - .../src/System/Reflection/Emit/TypeBuilder.cs | 102 --------- .../mscorlib/src/System/Reflection/EventInfo.cs | 8 - .../mscorlib/src/System/Reflection/FieldInfo.cs | 24 --- .../src/System/Reflection/LoaderAllocator.cs | 2 - .../mscorlib/src/System/Reflection/MdConstant.cs | 1 - .../src/mscorlib/src/System/Reflection/MdImport.cs | 55 ----- .../mscorlib/src/System/Reflection/MemberInfo.cs | 3 - .../Reflection/MemberInfoSerializationHolder.cs | 2 - .../Reflection/Metadata/AssemblyExtensions.cs | 2 - .../mscorlib/src/System/Reflection/MethodBase.cs | 6 - .../mscorlib/src/System/Reflection/MethodInfo.cs | 28 --- .../src/mscorlib/src/System/Reflection/Missing.cs | 1 - .../src/mscorlib/src/System/Reflection/Module.cs | 38 ---- .../src/System/Reflection/ParameterInfo.cs | 8 - .../src/mscorlib/src/System/Reflection/Pointer.cs | 6 - .../mscorlib/src/System/Reflection/PropertyInfo.cs | 10 - .../Reflection/ReflectionTypeLoadException.cs | 1 - .../src/System/Reflection/StrongNameKeyPair.cs | 19 -- .../src/System/Reflection/TypeDelegator.cs | 3 - .../System/Resources/FileBasedResourceGroveler.cs | 2 - .../Resources/ManifestBasedResourceGroveler.cs | 10 - .../System/Resources/ResourceFallbackManager.cs | 1 - .../src/System/Resources/ResourceManager.cs | 20 -- .../src/System/Resources/ResourceReader.cs | 24 --- .../mscorlib/src/System/Resources/ResourceSet.cs | 5 - .../src/System/Resources/RuntimeResourceSet.cs | 2 - .../src/System/Resources/__FastResourceComparer.cs | 3 - src/coreclr/src/mscorlib/src/System/RtType.cs | 81 ------- .../Runtime/CompilerServices/AsyncMethodBuilder.cs | 15 -- .../Runtime/CompilerServices/INotifyCompletion.cs | 1 - .../Runtime/CompilerServices/RuntimeHelpers.cs | 27 --- .../CompilerServices/RuntimeWrappedException.cs | 1 - .../System/Runtime/CompilerServices/TaskAwaiter.cs | 9 - .../CompilerServices/TypeForwardedToAttribute.cs | 1 - .../Runtime/CompilerServices/YieldAwaitable.cs | 3 - .../System/Runtime/CompilerServices/jithelpers.cs | 12 -- .../src/mscorlib/src/System/Runtime/GcSettings.cs | 5 - .../Runtime/InteropServices/ArrayWithOffset.cs | 2 - .../System/Runtime/InteropServices/Attributes.cs | 9 - .../System/Runtime/InteropServices/BStrWrapper.cs | 8 - .../System/Runtime/InteropServices/COMException.cs | 1 - .../Runtime/InteropServices/ComEventsHelper.cs | 3 - .../Runtime/InteropServices/ComEventsInfo.cs | 5 - .../Runtime/InteropServices/ComEventsSink.cs | 9 - .../Runtime/InteropServices/CriticalHandle.cs | 7 - .../Runtime/InteropServices/DispatchWrapper.cs | 4 - .../System/Runtime/InteropServices/ErrorWrapper.cs | 4 - .../InteropServices/ExtensibleClassFactory.cs | 1 - .../src/System/Runtime/InteropServices/GcHandle.cs | 19 -- .../InteropServices/ICustomQueryInterface.cs | 1 - .../System/Runtime/InteropServices/IException.cs | 7 - .../InteropServices/IRegistrationServices.cs | 6 - .../src/System/Runtime/InteropServices/Marshal.cs | 201 ------------------ .../Runtime/InteropServices/NativeMethods.cs | 4 - .../InteropServices/RegistrationServices.cs | 21 -- .../Runtime/InteropServices/RuntimeEnvironment.cs | 11 - .../System/Runtime/InteropServices/SafeBuffer.cs | 1 - .../System/Runtime/InteropServices/SafeHandle.cs | 9 - .../src/System/Runtime/InteropServices/Variant.cs | 1 - .../BindableVectorToCollectionAdapter.cs | 4 - .../WindowsRuntime/BindableVectorToListAdapter.cs | 11 - .../WindowsRuntime/CLRIPropertyValueImpl.cs | 8 - .../WindowsRuntime/CLRIReferenceImpl.cs | 2 - .../WindowsRuntime/CustomPropertyImpl.cs | 1 - .../WindowsRuntime/DictionaryToMapAdapter.cs | 7 - .../WindowsRuntime/EnumeratorToIteratorAdapter.cs | 2 - .../InteropServices/WindowsRuntime/IClosable.cs | 3 - .../WindowsRuntime/ICustomPropertyProvider.cs | 7 - .../IMapViewToIReadOnlyDictionaryAdapter.cs | 5 - .../IReadOnlyDictionaryToIMapViewAdapter.cs | 4 - .../IReadOnlyListToIVectorViewAdapter.cs | 4 - .../IVectorViewToIReadOnlyListAdapter.cs | 2 - .../WindowsRuntime/IteratorToEnumeratorAdapter.cs | 4 - .../WindowsRuntime/ListToBindableVectorAdapter.cs | 10 - .../WindowsRuntime/ListToVectorAdapter.cs | 12 -- .../WindowsRuntime/ManagedActivationFactory.cs | 1 - .../WindowsRuntime/MapToCollectionAdapter.cs | 7 - .../WindowsRuntime/MapToDictionaryAdapter.cs | 8 - .../MapViewToReadOnlyCollectionAdapter.cs | 1 - .../WindowsRuntime/NativeMethods.cs | 7 - .../InteropServices/WindowsRuntime/RuntimeClass.cs | 9 - .../WindowsRuntime/VectorToCollectionAdapter.cs | 7 - .../WindowsRuntime/VectorToListAdapter.cs | 5 - .../VectorViewToReadOnlyCollectionAdapter.cs | 1 - .../WindowsRuntime/WindowsRuntimeBufferHelper.cs | 2 - .../WindowsRuntime/WindowsRuntimeMarshal.cs | 21 -- .../WindowsRuntime/WindowsRuntimeMetadata.cs | 3 - .../System/Runtime/Loader/AssemblyLoadContext.cs | 6 - .../mscorlib/src/System/Runtime/MemoryFailPoint.cs | 9 - .../src/System/Runtime/ProfileOptimization.cs | 4 - .../Runtime/Reliability/CriticalFinalizerObject.cs | 4 - .../Runtime/Serialization/FormatterServices.cs | 18 -- .../Runtime/Serialization/IObjectReference.cs | 1 - .../System/Runtime/Serialization/ISerializable.cs | 1 - .../Serialization/ISerializationSurrogate.cs | 2 - .../Runtime/Serialization/ISurrogateSelector.cs | 3 - .../Serialization/SafeSerializationManager.cs | 6 - .../Serialization/SerializationFieldInfo.cs | 2 - .../Runtime/Serialization/SerializationInfo.cs | 5 - .../Runtime/Versioning/CompatibilitySwitch.cs | 5 - .../src/mscorlib/src/System/RuntimeHandles.cs | 233 --------------------- src/coreclr/src/mscorlib/src/System/SByte.cs | 3 - .../src/System/Security/CodeAccessPermission.cs | 11 - .../System/Security/CodeAccessSecurityEngine.cs | 21 -- .../src/System/Security/FrameSecurityDescriptor.cs | 23 -- .../src/System/Security/HostProtectionException.cs | 1 - .../src/System/Security/HostSecurityManager.cs | 2 - .../src/System/Security/PermissionListSet.cs | 20 -- .../mscorlib/src/System/Security/PermissionSet.cs | 10 - .../src/System/Security/PermissionSetTriple.cs | 13 -- .../src/System/Security/PermissionToken.cs | 3 - .../Security/Permissions/EnvironmentPermission.cs | 5 - .../Security/Permissions/FileIOPermission.cs | 21 -- .../Security/Permissions/PermissionAttributes.cs | 1 - .../Security/Permissions/RegistryPermission.cs | 5 - .../src/System/Security/Policy/ApplicationTrust.cs | 4 - .../src/System/Security/Policy/EvidenceBase.cs | 16 -- .../Security/Policy/IDelayEvaluatedEvidence.cs | 1 - .../src/System/Security/Policy/StrongName.cs | 1 - .../mscorlib/src/System/Security/Policy/Zone.cs | 1 - .../src/System/Security/SafeSecurityHandles.cs | 16 -- .../src/System/Security/SecurityContext.cs | 22 -- .../src/System/Security/SecurityException.cs | 5 - .../src/System/Security/SecurityManager.cs | 3 - .../src/System/Security/SecurityRuntime.cs | 14 -- .../mscorlib/src/System/Security/SecurityState.cs | 5 - .../mscorlib/src/System/Security/Util/Config.cs | 6 - .../System/Security/Util/StringExpressionSet.cs | 26 --- .../mscorlib/src/System/Security/Util/URLString.cs | 2 - .../mscorlib/src/System/Security/Util/XMLUtil.cs | 2 - .../src/mscorlib/src/System/SharedStatics.cs | 1 - src/coreclr/src/mscorlib/src/System/Single.cs | 10 - .../src/mscorlib/src/System/String.Comparison.cs | 18 -- .../src/mscorlib/src/System/String.Manipulation.cs | 24 --- .../src/mscorlib/src/System/String.Searching.cs | 6 - src/coreclr/src/mscorlib/src/System/String.cs | 37 ---- .../src/mscorlib/src/System/StringComparer.cs | 1 - src/coreclr/src/mscorlib/src/System/StubHelpers.cs | 77 ------- .../src/mscorlib/src/System/Text/ASCIIEncoding.cs | 8 - .../src/System/Text/BaseCodePageEncoding.cs | 19 -- .../mscorlib/src/System/Text/CodePageEncoding.cs | 4 - .../src/System/Text/DBCSCodePageEncoding.cs | 13 -- .../src/mscorlib/src/System/Text/Decoder.cs | 3 - .../src/System/Text/DecoderBestFitFallback.cs | 2 - .../mscorlib/src/System/Text/DecoderFallback.cs | 6 - .../src/mscorlib/src/System/Text/DecoderNLS.cs | 7 - .../src/System/Text/DecoderReplacementFallback.cs | 2 - .../src/mscorlib/src/System/Text/EUCJPEncoding.cs | 3 - .../src/mscorlib/src/System/Text/Encoder.cs | 3 - .../src/System/Text/EncoderBestFitFallback.cs | 1 - .../mscorlib/src/System/Text/EncoderFallback.cs | 5 - .../src/mscorlib/src/System/Text/EncoderNLS.cs | 7 - .../src/System/Text/EncoderReplacementFallback.cs | 1 - .../src/mscorlib/src/System/Text/Encoding.cs | 60 ------ .../mscorlib/src/System/Text/EncodingForwarder.cs | 11 - .../src/mscorlib/src/System/Text/EncodingNLS.cs | 4 - .../mscorlib/src/System/Text/GB18030Encoding.cs | 13 -- .../src/mscorlib/src/System/Text/ISCIIEncoding.cs | 5 - .../mscorlib/src/System/Text/ISO2022Encoding.cs | 13 -- .../src/mscorlib/src/System/Text/Latin1Encoding.cs | 5 - .../src/System/Text/MLangCodePageEncoding.cs | 6 - .../src/System/Text/Normalization.Windows.cs | 7 - .../src/System/Text/SBCSCodePageEncoding.cs | 12 -- .../src/mscorlib/src/System/Text/StringBuilder.cs | 26 --- .../mscorlib/src/System/Text/SurrogateEncoder.cs | 2 - .../src/mscorlib/src/System/Text/UTF32Encoding.cs | 8 - .../src/mscorlib/src/System/Text/UTF7Encoding.cs | 12 -- .../src/mscorlib/src/System/Text/UTF8Encoding.cs | 15 -- .../mscorlib/src/System/Text/UnicodeEncoding.cs | 9 - .../mscorlib/src/System/Threading/AsyncLocal.cs | 6 - .../src/System/Threading/CancellationToken.cs | 1 - .../System/Threading/CancellationTokenSource.cs | 3 - .../src/System/Threading/EventWaitHandle.cs | 12 -- .../src/System/Threading/ExecutionContext.cs | 15 -- .../mscorlib/src/System/Threading/Interlocked.cs | 17 -- .../src/mscorlib/src/System/Threading/Monitor.cs | 12 -- .../src/mscorlib/src/System/Threading/Mutex.cs | 21 -- .../mscorlib/src/System/Threading/Overlapped.cs | 28 --- .../src/System/Threading/ReaderWriterLock.cs | 29 --- .../src/mscorlib/src/System/Threading/Semaphore.cs | 10 - .../mscorlib/src/System/Threading/SemaphoreSlim.cs | 3 - .../src/System/Threading/SynchronizationContext.cs | 15 -- .../System/Threading/Tasks/AsyncCausalityTracer.cs | 2 - .../Threading/Tasks/BeginEndAwaitableAdapter.cs | 1 - .../Tasks/ConcurrentExclusiveSchedulerPair.cs | 5 - .../src/System/Threading/Tasks/TPLETWProvider.cs | 12 -- .../mscorlib/src/System/Threading/Tasks/Task.cs | 17 -- .../src/System/Threading/Tasks/TaskContinuation.cs | 19 -- .../System/Threading/Tasks/TaskExceptionHolder.cs | 1 - .../src/System/Threading/Tasks/TaskScheduler.cs | 18 -- .../Threading/Tasks/ThreadPoolTaskScheduler.cs | 4 - .../src/mscorlib/src/System/Threading/Thread.cs | 105 ---------- .../src/System/Threading/ThreadAbortException.cs | 1 - .../mscorlib/src/System/Threading/ThreadPool.cs | 115 ---------- .../src/mscorlib/src/System/Threading/Timer.cs | 25 --- .../src/mscorlib/src/System/Threading/Volatile.cs | 6 - .../mscorlib/src/System/Threading/WaitHandle.cs | 21 -- src/coreclr/src/mscorlib/src/System/TimeSpan.cs | 2 - .../src/mscorlib/src/System/TimeZoneInfo.cs | 27 --- src/coreclr/src/mscorlib/src/System/Type.cs | 13 -- .../src/System/TypeInitializationException.cs | 1 - .../src/mscorlib/src/System/TypeLoadException.cs | 5 - .../src/mscorlib/src/System/TypeNameParser.cs | 19 -- .../src/mscorlib/src/System/TypedReference.cs | 6 - src/coreclr/src/mscorlib/src/System/UInt16.cs | 4 - src/coreclr/src/mscorlib/src/System/UInt32.cs | 4 - src/coreclr/src/mscorlib/src/System/UInt64.cs | 4 - src/coreclr/src/mscorlib/src/System/UIntPtr.cs | 19 -- .../src/System/UnhandledExceptionEventHandler.cs | 3 - .../src/System/UnitySerializationHolder.cs | 2 - src/coreclr/src/mscorlib/src/System/ValueType.cs | 4 - src/coreclr/src/mscorlib/src/System/Variant.cs | 13 -- .../src/mscorlib/src/System/WeakReference.cs | 9 - .../src/mscorlib/src/System/WeakReferenceOfT.cs | 6 - .../src/mscorlib/src/System/_LocalDataStore.cs | 1 - .../src/mscorlib/src/System/_LocalDataStoreMgr.cs | 7 - src/coreclr/src/mscorlib/src/System/__ComObject.cs | 6 - src/coreclr/src/mscorlib/src/System/mda.cs | 11 - 383 files changed, 5139 deletions(-) diff --git a/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs b/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs index 880bcc7..ead3380 100644 --- a/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs +++ b/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs @@ -42,12 +42,6 @@ namespace System /// Create a PinnableBufferCache that works on any object (it is intended for OverlappedData) /// This is only used in mscorlib. /// -#if (ENABLE || MINBUFFERS) -#pragma warning disable 618 - [EnvironmentPermission(SecurityAction.Assert, Unrestricted = true)] -#pragma warning restore 618 - [System.Security.SecuritySafeCritical] -#endif internal PinnableBufferCache(string cacheName, Func factory) { m_NotGen2 = new List(DefaultNumberOfBuffers); @@ -100,7 +94,6 @@ namespace System /// /// Get a object from the buffer manager. If no buffers exist, allocate a new one. /// - [System.Security.SecuritySafeCritical] internal object Allocate() { #if ENABLE @@ -146,7 +139,6 @@ namespace System /// /// Return a buffer back to the buffer manager. /// - [System.Security.SecuritySafeCritical] internal void Free(object buffer) { #if ENABLE @@ -185,7 +177,6 @@ namespace System /// Called when we don't have any buffers in our free list to give out. /// /// - [System.Security.SecuritySafeCritical] private void Restock(out object returnBuffer) { lock (this) @@ -238,7 +229,6 @@ namespace System /// /// See if we can promote the buffers to the free list. Returns true if sucessful. /// - [System.Security.SecuritySafeCritical] private bool AgePendingBuffers() { if (m_gen1CountAtLastRestock < GC.CollectionCount(GC.MaxGeneration - 1)) @@ -314,7 +304,6 @@ namespace System /// otherwise, we root the cache to the Gen2GcCallback object, and leak the cache even when /// the application no longer needs it. /// - [System.Security.SecuritySafeCritical] private static bool Gen2GcCallbackFunc(object targetObj) { return ((PinnableBufferCache)(targetObj)).TrimFreeListIfNeeded(); @@ -325,7 +314,6 @@ namespace System /// NOTE: DO NOT CALL THIS DIRECTLY FROM THE GEN2GCCALLBACK. INSTEAD CALL IT VIA A STATIC FUNCTION (SEE ABOVE). /// If you register a non-static function as a callback, then this object will be leaked. /// - [System.Security.SecuritySafeCritical] private bool TrimFreeListIfNeeded() { int curMSec = Environment.TickCount; @@ -478,7 +466,6 @@ namespace System /// internal sealed class Gen2GcCallback : CriticalFinalizerObject { - [System.Security.SecuritySafeCritical] public Gen2GcCallback() : base() { @@ -503,14 +490,12 @@ namespace System private Func m_callback; private GCHandle m_weakTargetObj; - [System.Security.SecuritySafeCritical] private void Setup(Func callback, object targetObj) { m_callback = callback; m_weakTargetObj = GCHandle.Alloc(targetObj, GCHandleType.Weak); } - [System.Security.SecuritySafeCritical] ~Gen2GcCallback() { // Check to see if the target object is still alive. @@ -578,7 +563,6 @@ namespace System return 0; } - [System.Security.SecuritySafeCritical] static internal unsafe long AddressOfObject(byte[] array) { return 0; @@ -650,7 +634,6 @@ namespace System return 0; } - [System.Security.SecuritySafeCritical] static internal unsafe long AddressOfByteArray(byte[] array) { if (array == null) diff --git a/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs b/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs index d1849ac..edfc66d 100644 --- a/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs +++ b/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs @@ -18,7 +18,6 @@ internal partial class Interop /// "lpt1:", etc. Use this to avoid security problems, like allowing a web client asking a server /// for "http://server/com1.aspx" and then causing a worker process to hang. /// - [System.Security.SecurityCritical] // auto-generated internal static SafeFileHandle SafeCreateFile( String lpFileName, int dwDesiredAccess, diff --git a/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs b/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs index 375acc6..e7e4f05 100644 --- a/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs +++ b/src/coreclr/src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs @@ -10,7 +10,6 @@ internal partial class Interop { internal partial class mincore { - [System.Security.SecurityCritical] // auto-generated internal static SafeFileHandle UnsafeCreateFile( string lpFileName, int dwDesiredAccess, diff --git a/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs index 6dc6072..7d4dd44 100644 --- a/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs +++ b/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs @@ -10,7 +10,6 @@ using Microsoft.Win32; namespace Microsoft.Win32.SafeHandles { - [System.Security.SecurityCritical] // auto-generated_required public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid { private bool? _isAsync; @@ -42,7 +41,6 @@ namespace Microsoft.Win32.SafeHandles internal ThreadPoolBoundHandle ThreadPoolBinding { get; set; } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Interop.mincore.CloseHandle(handle); diff --git a/src/coreclr/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs b/src/coreclr/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs index 8dce4f0..29cef08 100644 --- a/src/coreclr/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs +++ b/src/coreclr/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs @@ -117,7 +117,6 @@ namespace System.Runtime.InteropServices /// /// True if the buffer contains the given character. /// - [System.Security.SecurityCritical] public unsafe bool Contains(char value) { char* start = CharPointer; diff --git a/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs index 419ad92..a8ed8db 100644 --- a/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs +++ b/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs @@ -33,7 +33,6 @@ namespace Internal.Runtime.Augments =========================================================================*/ public extern bool IsAlive { - [SecuritySafeCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] get; } @@ -46,18 +45,14 @@ namespace Internal.Runtime.Augments =========================================================================*/ public bool IsBackground { - [SecuritySafeCritical] // auto-generated get { return IsBackgroundNative(); } - [SecuritySafeCritical] // auto-generated [HostProtection(SelfAffectingThreading = true)] set { SetBackgroundNative(value); } } - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern bool IsBackgroundNative(); - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern void SetBackgroundNative(bool isBackground); @@ -66,7 +61,6 @@ namespace Internal.Runtime.Augments =========================================================================*/ public extern bool IsThreadPoolThread { - [SecuritySafeCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] get; } @@ -81,18 +75,14 @@ namespace Internal.Runtime.Augments =========================================================================*/ public ThreadPriority Priority { - [SecuritySafeCritical] // auto-generated get { return (ThreadPriority)GetPriorityNative(); } - [SecuritySafeCritical] // auto-generated [HostProtection(SelfAffectingThreading = true)] set { SetPriorityNative((int)value); } } - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern int GetPriorityNative(); - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern void SetPriorityNative(int priority); @@ -102,15 +92,12 @@ namespace Internal.Runtime.Augments =========================================================================*/ public ThreadState ThreadState { - [SecuritySafeCritical] // auto-generated get { return (ThreadState)GetThreadStateNative(); } } - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern int GetThreadStateNative(); - [SecuritySafeCritical] // auto-generated public ApartmentState GetApartmentState() { #if FEATURE_COMINTEROP_APARTMENT_SUPPORT @@ -125,7 +112,6 @@ namespace Internal.Runtime.Augments ** An unstarted thread can be marked to indicate that it will host a ** single-threaded or multi-threaded apartment. =========================================================================*/ - [SecuritySafeCritical] // auto-generated [HostProtection(Synchronization = true, SelfAffectingThreading = true)] public bool TrySetApartmentState(ApartmentState state) { @@ -138,7 +124,6 @@ namespace Internal.Runtime.Augments } #if FEATURE_COMINTEROP_APARTMENT_SUPPORT - [SecurityCritical] // auto-generated internal bool SetApartmentStateHelper(ApartmentState state, bool fireMDAOnMismatch) { ApartmentState retState = (ApartmentState)SetApartmentStateNative((int)state, fireMDAOnMismatch); @@ -156,22 +141,18 @@ namespace Internal.Runtime.Augments return true; } - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] internal extern int GetApartmentStateNative(); - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] internal extern int SetApartmentStateNative(int state, bool fireMDAOnMismatch); #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT #if FEATURE_COMINTEROP - [SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] public extern void DisableComObjectEagerCleanup(); #else // !FEATURE_COMINTEROP - [SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void DisableComObjectEagerCleanup() { @@ -185,18 +166,14 @@ namespace Internal.Runtime.Augments ** when it next begins to block. =========================================================================*/ #if FEATURE_CORECLR - [SecurityCritical] // auto-generated #else - [SecuritySafeCritical] // auto-generated #endif #pragma warning disable 618 // obsolete types: SecurityPermissionAttribute, SecurityAction - [SecurityPermission(SecurityAction.Demand, ControlThread = true)] #pragma warning restore 618 // obsolete types: SecurityPermissionAttribute, SecurityAction public void Interrupt() => InterruptInternal(); // Internal helper (since we can't place security demands on // ecalls/fcalls). - [SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private extern void InterruptInternal(); @@ -209,15 +186,12 @@ namespace Internal.Runtime.Augments ** ThreadInterruptedException if the thread is interrupted while waiting. ** ThreadStateException if the thread has not been started yet. =========================================================================*/ - [SecuritySafeCritical] [HostProtection(Synchronization = true, ExternalThreading = true)] public void Join() => JoinInternal(Timeout.Infinite); - [SecuritySafeCritical] [HostProtection(Synchronization = true, ExternalThreading = true)] public bool Join(int millisecondsTimeout) => JoinInternal(millisecondsTimeout); - [SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] private extern bool JoinInternal(int millisecondsTimeout); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs index 254b2f6..6c2c6e9 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs @@ -73,7 +73,6 @@ namespace Microsoft.Win32 { * Variant and the types that CLR supports explicitly in the * CLR Variant class. */ - [System.Security.SecurityCritical] // auto-generated internal static Variant ChangeType(Variant source, Type targetClass, short options, CultureInfo culture) { if (targetClass == null) @@ -125,7 +124,6 @@ namespace Microsoft.Win32 { #region Private FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ChangeTypeEx(ref Variant result, ref Variant source, int lcid, IntPtr typeHandle, int cvType, short flags); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Registry.cs index 5743a5a..3ee5f46 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Registry.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Registry.cs @@ -17,7 +17,6 @@ namespace Microsoft.Win32 { //This class contains only static members and does not need to be serializable. [ComVisible(true)] public static class Registry { - [System.Security.SecuritySafeCritical] // auto-generated static Registry() { } @@ -70,7 +69,6 @@ namespace Microsoft.Win32 { // If the keyName is not valid, we will throw ArgumentException. // The return value shouldn't be null. // - [System.Security.SecurityCritical] // auto-generated private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName) { if( keyName == null) { throw new ArgumentNullException(nameof(keyName)); @@ -117,7 +115,6 @@ namespace Microsoft.Win32 { return basekey; } - [System.Security.SecuritySafeCritical] // auto-generated public static object GetValue(string keyName, string valueName, object defaultValue ) { string subKeyName; RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName); @@ -138,7 +135,6 @@ namespace Microsoft.Win32 { SetValue(keyName, valueName, value, RegistryValueKind.Unknown); } - [System.Security.SecuritySafeCritical] // auto-generated public static void SetValue(string keyName, string valueName, object value, RegistryValueKind valueKind ) { string subKeyName; RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs index 53d93ef..d38798a 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs @@ -137,7 +137,6 @@ namespace Microsoft.Win32 private const int MaxKeyLength = 255; private const int MaxValueLength = 16383; - [System.Security.SecurityCritical] // auto-generated private volatile SafeRegistryHandle hkey = null; private volatile int state = 0; private volatile String keyName; @@ -171,7 +170,6 @@ namespace Microsoft.Win32 * This key is bound to hkey, if writable is false then no write operations * will be allowed. */ - [System.Security.SecurityCritical] // auto-generated private RegistryKey(SafeRegistryHandle hkey, bool writable, RegistryView view) : this(hkey, writable, false, false, false, view) { } @@ -186,7 +184,6 @@ namespace Microsoft.Win32 * The remoteKey flag when set to true indicates that we are dealing with registry entries * on a remote machine and requires the program making these calls to have full trust. */ - [System.Security.SecurityCritical] // auto-generated private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view) { this.hkey = hkey; this.keyName = ""; @@ -210,7 +207,6 @@ namespace Microsoft.Win32 Dispose(true); } - [System.Security.SecuritySafeCritical] // auto-generated private void Dispose(bool disposing) { if (hkey != null) { @@ -243,7 +239,6 @@ namespace Microsoft.Win32 } } - [System.Security.SecuritySafeCritical] // auto-generated public void Flush() { if (hkey != null) { if (IsDirty()) { @@ -293,7 +288,6 @@ namespace Microsoft.Win32 return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, options); } - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] private unsafe RegistryKey CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { @@ -362,7 +356,6 @@ namespace Microsoft.Win32 DeleteSubKey(subkey, true); } - [System.Security.SecuritySafeCritical] // auto-generated public void DeleteSubKey(String subkey, bool throwOnMissingSubKey) { ValidateKeyName(subkey); EnsureWriteable(); @@ -416,7 +409,6 @@ namespace Microsoft.Win32 DeleteSubKeyTree(subkey, true /*throwOnMissingSubKey*/); } - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public void DeleteSubKeyTree(String subkey, Boolean throwOnMissingSubKey) { ValidateKeyName(subkey); @@ -464,7 +456,6 @@ namespace Microsoft.Win32 // An internal version which does no security checks or argument checking. Skipping the // security checks should give us a slight perf gain on large trees. - [System.Security.SecurityCritical] // auto-generated private void DeleteSubKeyTreeInternal(string subkey) { RegistryKey key = InternalOpenSubKey(subkey, true); if (key != null) { @@ -504,7 +495,6 @@ namespace Microsoft.Win32 DeleteValue(name, true); } - [System.Security.SecuritySafeCritical] // auto-generated public void DeleteValue(String name, bool throwOnMissingValue) { EnsureWriteable(); CheckPermission(RegistryInternalCheck.CheckValueWritePermission, name, false, RegistryKeyPermissionCheck.Default); @@ -542,12 +532,10 @@ namespace Microsoft.Win32 * * @return the RegistryKey requested. */ - [System.Security.SecurityCritical] // auto-generated internal static RegistryKey GetBaseKey(IntPtr hKey) { return GetBaseKey(hKey, RegistryView.Default); } - [System.Security.SecurityCritical] // auto-generated internal static RegistryKey GetBaseKey(IntPtr hKey, RegistryView view) { int index = ((int)hKey) & 0x0FFFFFFF; @@ -565,7 +553,6 @@ namespace Microsoft.Win32 } - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public static RegistryKey OpenBaseKey(RegistryHive hKey, RegistryView view) { ValidateKeyView(view); @@ -595,7 +582,6 @@ namespace Microsoft.Win32 return OpenRemoteBaseKey(hKey, machineName, RegistryView.Default); } - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName, RegistryView view) { if (machineName==null) @@ -638,9 +624,7 @@ namespace Microsoft.Win32 * @return the Subkey requested, or null if the operation failed. */ #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated #else - [System.Security.SecuritySafeCritical] #endif public RegistryKey OpenSubKey(string name, bool writable ) { ValidateKeyName(name); @@ -674,7 +658,6 @@ namespace Microsoft.Win32 // This required no security checks. This is to get around the Deleting SubKeys which only require // write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks - [System.Security.SecurityCritical] // auto-generated internal RegistryKey InternalOpenSubKey(String name, bool writable) { ValidateKeyName(name); EnsureNotDisposed(); @@ -702,7 +685,6 @@ namespace Microsoft.Win32 * @return the Subkey requested, or null if the operation failed. */ #if FEATURE_CORECLR - [System.Security.SecurityCritical] #endif public RegistryKey OpenSubKey(String name) { return OpenSubKey(name, false); @@ -714,7 +696,6 @@ namespace Microsoft.Win32 * @return a count of subkeys. */ public int SubKeyCount { - [System.Security.SecuritySafeCritical] // auto-generated get { CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default); return InternalSubKeyCount(); @@ -723,14 +704,12 @@ namespace Microsoft.Win32 [ComVisible(false)] public RegistryView View { - [System.Security.SecuritySafeCritical] get { EnsureNotDisposed(); return regView; } } - [System.Security.SecurityCritical] // auto-generated internal int InternalSubKeyCount() { EnsureNotDisposed(); @@ -760,16 +739,13 @@ namespace Microsoft.Win32 * @return all subkey names. */ #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated #else - [System.Security.SecuritySafeCritical] #endif public String[] GetSubKeyNames() { CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default); return InternalGetSubKeyNames(); } - [System.Security.SecurityCritical] // auto-generated internal unsafe String[] InternalGetSubKeyNames() { EnsureNotDisposed(); int subkeys = InternalSubKeyCount(); @@ -808,14 +784,12 @@ namespace Microsoft.Win32 * @return a count of values. */ public int ValueCount { - [System.Security.SecuritySafeCritical] // auto-generated get { CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default); return InternalValueCount(); } } - [System.Security.SecurityCritical] // auto-generated internal int InternalValueCount() { EnsureNotDisposed(); int values = 0; @@ -842,7 +816,6 @@ namespace Microsoft.Win32 * * @return all value names. */ - [System.Security.SecuritySafeCritical] // auto-generated public unsafe String[] GetValueNames() { CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default); EnsureNotDisposed(); @@ -893,7 +866,6 @@ namespace Microsoft.Win32 * * @return the data associated with the value. */ - [System.Security.SecuritySafeCritical] // auto-generated public Object GetValue(String name) { CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default); return InternalGetValue(name, null, false, true); @@ -915,9 +887,7 @@ namespace Microsoft.Win32 * @return the data associated with the value. */ #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated #else - [System.Security.SecuritySafeCritical] #endif public Object GetValue(String name, Object defaultValue) { CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default); @@ -925,9 +895,7 @@ namespace Microsoft.Win32 } #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated #else - [System.Security.SecuritySafeCritical] #endif [ComVisible(false)] public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) { @@ -939,7 +907,6 @@ namespace Microsoft.Win32 return InternalGetValue(name, defaultValue, doNotExpand, true); } - [System.Security.SecurityCritical] // auto-generated internal Object InternalGetValue(String name, Object defaultValue, bool doNotExpand, bool checkSecurity) { if (checkSecurity) { // Name can be null! It's the most common use of RegQueryValueEx @@ -1158,7 +1125,6 @@ namespace Microsoft.Win32 } - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public RegistryValueKind GetValueKind(string name) { CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default); @@ -1202,7 +1168,6 @@ namespace Microsoft.Win32 } public String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { EnsureNotDisposed(); return keyName; @@ -1223,7 +1188,6 @@ namespace Microsoft.Win32 SetValue(name, value, RegistryValueKind.Unknown); } - [System.Security.SecuritySafeCritical] //auto-generated [ComVisible(false)] public unsafe void SetValue(String name, Object value, RegistryValueKind valueKind) { if (value==null) @@ -1395,7 +1359,6 @@ namespace Microsoft.Win32 * * @return a string representing the key. */ - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { EnsureNotDisposed(); return keyName; @@ -1408,7 +1371,6 @@ namespace Microsoft.Win32 * error, and depending on the error, insert a string into the message * gotten from the ResourceManager. */ - [System.Security.SecuritySafeCritical] // auto-generated internal void Win32Error(int errorCode, String str) { switch (errorCode) { case Win32Native.ERROR_ACCESS_DENIED: @@ -1444,7 +1406,6 @@ namespace Microsoft.Win32 } } - [SecuritySafeCritical] internal static void Win32ErrorStatic(int errorCode, String str) { switch (errorCode) { case Win32Native.ERROR_ACCESS_DENIED: @@ -1577,7 +1538,6 @@ namespace Microsoft.Win32 path = keyName + "\\."; } - [System.Security.SecurityCritical] // auto-generated private void CheckPermission(RegistryInternalCheck check, string item, bool subKeyWritable, RegistryKeyPermissionCheck subKeyCheck) { bool demand = false; @@ -1814,14 +1774,12 @@ namespace Microsoft.Win32 } } - [System.Security.SecurityCritical] // auto-generated static private void CheckUnmanagedCodePermission() { #pragma warning disable 618 new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); #pragma warning restore 618 } - [System.Security.SecurityCritical] // auto-generated private bool ContainsRegistryValue(string name) { int type = 0; int datasize = 0; @@ -1829,14 +1787,12 @@ namespace Microsoft.Win32 return retval == 0; } - [System.Security.SecurityCritical] // auto-generated private void EnsureNotDisposed(){ if (hkey == null) { ThrowHelper.ThrowObjectDisposedException(keyName, ExceptionResource.ObjectDisposed_RegKeyClosed); } } - [System.Security.SecurityCritical] // auto-generated private void EnsureWriteable() { EnsureNotDisposed(); if (!IsWritable()) { diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs index 5e1b510..cb915fe 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs @@ -20,20 +20,16 @@ using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid { - [System.Security.SecurityCritical] // auto-generated_required internal SafeFileMappingHandle() : base(true) {} // 0 is an Invalid Handle - [System.Security.SecurityCritical] // auto-generated_required internal SafeFileMappingHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { SetHandle(handle); } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs index b24535f..219fb77 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs @@ -20,13 +20,10 @@ using System.Runtime.ConstrainedExecution; using Microsoft.Win32; namespace Microsoft.Win32.SafeHandles { - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid { - [System.Security.SecurityCritical] // auto-generated_required internal SafeFindHandle() : base(true) {} - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.FindClose(handle); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs index d2ea42b..c4d53e2 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs @@ -15,12 +15,10 @@ namespace Microsoft.Win32 { using System.Security.Permissions; using System.Text; - [System.Security.SecurityCritical] // auto-generated [HostProtectionAttribute(MayLeakOnAbort = true)] sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeLibraryHandle() : base(true) {} - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return UnsafeNativeMethods.FreeLibrary(handle); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs index 3eea2b9..8c324b8 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs @@ -7,7 +7,6 @@ namespace Microsoft.Win32.SafeHandles { using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLocalAllocHandle : SafeBuffer { private SafeLocalAllocHandle () : base(true) {} @@ -20,7 +19,6 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeLocalAllocHandle(IntPtr.Zero); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LocalFree(handle) == IntPtr.Zero; diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs index d0e3f04..4f96b81 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs @@ -17,17 +17,13 @@ namespace Microsoft.Win32.SafeHandles { using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; - [System.Security.SecurityCritical] public sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid { - [System.Security.SecurityCritical] internal SafeRegistryHandle() : base(true) {} - [System.Security.SecurityCritical] public SafeRegistryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(preexistingHandle); } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return (RegCloseKey(handle) == Win32Native.ERROR_SUCCESS); } diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs index 01ec4d2..38a9323 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs @@ -22,19 +22,15 @@ using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid { - [System.Security.SecurityCritical] // auto-generated_required internal SafeViewOfFileHandle() : base(true) {} // 0 is an Invalid Handle - [System.Security.SecurityCritical] // auto-generated_required internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { SetHandle(handle); } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { if (Win32Native.UnmapViewOfFile(handle)) diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs index fa24c96..0e57136 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs @@ -24,7 +24,6 @@ using System.Threading; namespace Microsoft.Win32.SafeHandles { - [System.Security.SecurityCritical] // auto-generated_required public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid { // Called by P/Invoke marshaler @@ -38,7 +37,6 @@ namespace Microsoft.Win32.SafeHandles { SetHandle(existingHandle); } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs index 538bb31..08ae095 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs @@ -22,7 +22,6 @@ namespace Microsoft.Win32.SafeHandles using System.Runtime.ConstrainedExecution; // Class of safe handle which uses 0 or -1 as an invalid handle. - [System.Security.SecurityCritical] // auto-generated_required public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -37,13 +36,11 @@ namespace Microsoft.Win32.SafeHandles } public override bool IsInvalid { - [System.Security.SecurityCritical] get { return handle.IsNull() || handle == new IntPtr(-1); } } } // Class of safe handle which uses only -1 as an invalid handle. - [System.Security.SecurityCritical] // auto-generated_required public abstract class SafeHandleMinusOneIsInvalid : SafeHandle { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -58,13 +55,11 @@ namespace Microsoft.Win32.SafeHandles } public override bool IsInvalid { - [System.Security.SecurityCritical] get { return handle == new IntPtr(-1); } } } // Class of critical handle which uses 0 or -1 as an invalid handle. - [System.Security.SecurityCritical] // auto-generated_required public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -73,13 +68,11 @@ namespace Microsoft.Win32.SafeHandles } public override bool IsInvalid { - [System.Security.SecurityCritical] get { return handle.IsNull() || handle == new IntPtr(-1); } } } // Class of critical handle which uses only -1 as an invalid handle. - [System.Security.SecurityCritical] // auto-generated_required public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -88,7 +81,6 @@ namespace Microsoft.Win32.SafeHandles } public override bool IsInvalid { - [System.Security.SecurityCritical] get { return handle == new IntPtr(-1); } } } diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs index 9da9811..19d638d 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs @@ -16,7 +16,6 @@ namespace Microsoft.Win32 { using System.Text; using System.Diagnostics.Tracing; - [System.Security.SecurityCritical] // auto-generated [SuppressUnmanagedCodeSecurityAttribute()] internal static class UnsafeNativeMethods { @@ -64,7 +63,6 @@ namespace Microsoft.Win32 { internal static extern bool FreeLibrary(IntPtr hModule); - [SecurityCritical] [SuppressUnmanagedCodeSecurityAttribute()] internal static unsafe class ManifestEtw { @@ -96,7 +94,6 @@ namespace Microsoft.Win32 { // // Callback // - [SecurityCritical] internal unsafe delegate void EtwEnableCallback( [In] ref Guid sourceId, [In] int isEnabled, @@ -110,7 +107,6 @@ namespace Microsoft.Win32 { // // Registration APIs // - [SecurityCritical] [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] internal static extern unsafe uint EventRegister( [In] ref Guid providerId, @@ -120,7 +116,6 @@ namespace Microsoft.Win32 { ); // - [SecurityCritical] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] internal static extern uint EventUnregister([In] long registrationHandle); @@ -129,7 +124,6 @@ namespace Microsoft.Win32 { // Writing (Publishing/Logging) APIs // // - [SecurityCritical] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] internal static extern unsafe int EventWrite( @@ -139,7 +133,6 @@ namespace Microsoft.Win32 { [In] EventProvider.EventData* userData ); - [SecurityCritical] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] internal static extern unsafe int EventWriteString( @@ -270,7 +263,6 @@ namespace Microsoft.Win32 { } #if FEATURE_COMINTEROP - [SecurityCritical] [DllImport("combase.dll", PreserveSig = true)] internal static extern int RoGetActivationFactory( [MarshalAs(UnmanagedType.HString)] string activatableClassId, diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs index 9704f17..e876681 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs @@ -110,7 +110,6 @@ namespace Microsoft.Win32 { // Remove the default demands for all P/Invoke methods with this // global declaration on the class. - [System.Security.SecurityCritical] [SuppressUnmanagedCodeSecurityAttribute()] internal static class Win32Native { @@ -451,7 +450,6 @@ namespace Microsoft.Win32 { internal int fileSizeHigh; internal int fileSizeLow; - [System.Security.SecurityCritical] internal void PopulateFrom(WIN32_FIND_DATA findData) { // Copy the information to data fileAttributes = findData.dwFileAttributes; @@ -513,7 +511,6 @@ namespace Microsoft.Win32 { /// strings created with this version of the constructor will be unsafe to use after the buffer /// has been freed. /// - [System.Security.SecurityCritical] // auto-generated internal UNICODE_INTPTR_STRING (int stringBytes, SafeLocalAllocHandle buffer) { BCLDebug.Assert(buffer == null || (stringBytes >= 0 && (ulong)stringBytes <= buffer.ByteLength), "buffer == null || (stringBytes >= 0 && stringBytes <= buffer.ByteLength)"); @@ -799,7 +796,6 @@ namespace Microsoft.Win32 { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern IntPtr GetModuleHandle(String moduleName); - [System.Security.SecurityCritical] // auto-generated internal static bool DoesWin32MethodExist(String moduleName, String methodName) { // GetModuleHandle does not increment the module's ref count, so we don't need to call FreeLibrary. @@ -935,7 +931,6 @@ namespace Microsoft.Win32 { [DllImport(KERNEL32, SetLastError=true, EntryPoint="SetFilePointer")] private unsafe static extern int SetFilePointerWin32(SafeFileHandle handle, int lo, int * hi, int origin); - [System.Security.SecurityCritical] // auto-generated internal unsafe static long SetFilePointer(SafeFileHandle handle, long offset, System.IO.SeekOrigin origin, out int hr) { hr = 0; int lo = (int) offset; diff --git a/src/coreclr/src/mscorlib/src/System/Activator.cs b/src/coreclr/src/mscorlib/src/System/Activator.cs index 1675066..6fad8f3 100644 --- a/src/coreclr/src/mscorlib/src/System/Activator.cs +++ b/src/coreclr/src/mscorlib/src/System/Activator.cs @@ -56,7 +56,6 @@ namespace System { return CreateInstance(type, bindingAttr, binder, args, culture, null); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable static public Object CreateInstance(Type type, BindingFlags bindingAttr, @@ -121,7 +120,6 @@ namespace System { * types to be created remotely without having to load the type locally. */ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable static public ObjectHandle CreateInstance(String assemblyName, String typeName) @@ -139,7 +137,6 @@ namespace System { ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable static public ObjectHandle CreateInstance(String assemblyName, String typeName, @@ -213,7 +210,6 @@ namespace System { activationAttributes); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] static public ObjectHandle CreateInstance(String assemblyName, @@ -239,7 +235,6 @@ namespace System { ref stackMark); } - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static ObjectHandle CreateInstance(string assemblyName, string typeName, @@ -263,7 +258,6 @@ namespace System { ref stackMark); } - [System.Security.SecurityCritical] // auto-generated static internal ObjectHandle CreateInstance(String assemblyString, String typeName, bool ignoreCase, @@ -401,7 +395,6 @@ namespace System { // to pass the security checks when activating the type. // - [System.Security.SecurityCritical] // auto-generated_required public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName) { if (domain == null) throw new ArgumentNullException(nameof(domain)); @@ -409,7 +402,6 @@ namespace System { return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName); } - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, @@ -428,7 +420,6 @@ namespace System { return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes); } - [SecurityCritical] public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, @@ -461,7 +452,6 @@ namespace System { // to pass the security checks when activating the type. // - [System.Security.SecurityCritical] // auto-generated_required public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName) { if (domain == null) throw new ArgumentNullException(nameof(domain)); @@ -469,7 +459,6 @@ namespace System { return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName); } - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Methods which use Evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, @@ -488,7 +477,6 @@ namespace System { return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes); } - [SecurityCritical] public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, diff --git a/src/coreclr/src/mscorlib/src/System/AggregateException.cs b/src/coreclr/src/mscorlib/src/System/AggregateException.cs index 4dedf19..c0f2122 100644 --- a/src/coreclr/src/mscorlib/src/System/AggregateException.cs +++ b/src/coreclr/src/mscorlib/src/System/AggregateException.cs @@ -258,7 +258,6 @@ namespace System /// contains contextual information about the source or destination. /// The argument is null. /// The exception could not be deserialized correctly. - [SecurityCritical] protected AggregateException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -285,7 +284,6 @@ namespace System /// The that /// contains contextual information about the source or destination. /// The argument is null. - [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/AppContext/AppContext.cs b/src/coreclr/src/mscorlib/src/System/AppContext/AppContext.cs index de6405a..41e4450 100644 --- a/src/coreclr/src/mscorlib/src/System/AppContext/AppContext.cs +++ b/src/coreclr/src/mscorlib/src/System/AppContext/AppContext.cs @@ -21,9 +21,6 @@ namespace System public static string BaseDirectory { -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif get { // The value of APP_CONTEXT_BASE_DIRECTORY key has to be a string and it is not allowed to be any other type. @@ -41,15 +38,11 @@ namespace System } } -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public static object GetData(string name) { return AppDomain.CurrentDomain.GetData(name); } - [System.Security.SecuritySafeCritical] public static void SetData(string name, object data) { AppDomain.CurrentDomain.SetData(name, data); @@ -57,13 +50,11 @@ namespace System public static event UnhandledExceptionEventHandler UnhandledException { - [System.Security.SecurityCritical] add { AppDomain.CurrentDomain.UnhandledException += value; } - [System.Security.SecurityCritical] remove { AppDomain.CurrentDomain.UnhandledException -= value; @@ -72,12 +63,10 @@ namespace System public static event System.EventHandler FirstChanceException { - [System.Security.SecurityCritical] add { AppDomain.CurrentDomain.FirstChanceException += value; } - [System.Security.SecurityCritical] remove { AppDomain.CurrentDomain.FirstChanceException -= value; @@ -86,12 +75,10 @@ namespace System public static event System.EventHandler ProcessExit { - [System.Security.SecurityCritical] add { AppDomain.CurrentDomain.ProcessExit += value; } - [System.Security.SecurityCritical] remove { AppDomain.CurrentDomain.ProcessExit -= value; diff --git a/src/coreclr/src/mscorlib/src/System/AppDomain.cs b/src/coreclr/src/mscorlib/src/System/AppDomain.cs index 8ed1e5f..0ad755f 100644 --- a/src/coreclr/src/mscorlib/src/System/AppDomain.cs +++ b/src/coreclr/src/mscorlib/src/System/AppDomain.cs @@ -89,7 +89,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [Serializable] [ComVisible(true)] public delegate Assembly ResolveEventHandler(Object sender, ResolveEventArgs args); @@ -156,7 +155,6 @@ namespace System Info = itemInfo.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated internal AppDomainInitializer Unwrap() { if (Info==null) @@ -190,7 +188,6 @@ namespace System // of these fields cannot be changed without changing the layout in // the EE- AppDomainBaseObject in this case) - [System.Security.SecurityCritical] // auto-generated private AppDomainManager _domainManager; private Dictionary _LocalStore; private AppDomainSetup _FusionStore; @@ -201,12 +198,10 @@ namespace System [method: System.Security.SecurityCritical] public event AssemblyLoadEventHandler AssemblyLoad; - [System.Security.SecurityCritical] private ResolveEventHandler _TypeResolve; public event ResolveEventHandler TypeResolve { - [System.Security.SecurityCritical] add { lock (this) @@ -215,7 +210,6 @@ namespace System } } - [System.Security.SecurityCritical] remove { lock (this) @@ -225,12 +219,10 @@ namespace System } } - [System.Security.SecurityCritical] private ResolveEventHandler _ResourceResolve; public event ResolveEventHandler ResourceResolve { - [System.Security.SecurityCritical] add { lock (this) @@ -239,7 +231,6 @@ namespace System } } - [System.Security.SecurityCritical] remove { lock (this) @@ -249,12 +240,10 @@ namespace System } } - [System.Security.SecurityCritical] private ResolveEventHandler _AssemblyResolve; public event ResolveEventHandler AssemblyResolve { - [System.Security.SecurityCritical] add { lock (this) @@ -263,7 +252,6 @@ namespace System } } - [System.Security.SecurityCritical] remove { lock (this) @@ -281,10 +269,8 @@ namespace System private ApplicationTrust _applicationTrust; private EventHandler _processExit; - [System.Security.SecurityCritical] private EventHandler _domainUnload; - [System.Security.SecurityCritical] // auto-generated private UnhandledExceptionEventHandler _unhandledException; // The compat flags are set at domain creation time to indicate that the given breaking @@ -328,7 +314,6 @@ namespace System private static APPX_FLAGS Flags { - [SecuritySafeCritical] get { if (s_flags == 0) @@ -341,7 +326,6 @@ namespace System internal static bool ProfileAPICheck { - [SecuritySafeCritical] get { return (Flags & APPX_FLAGS.APPX_FLAGS_API_CHECK) != 0; @@ -350,7 +334,6 @@ namespace System internal static bool IsAppXNGen { - [SecuritySafeCritical] get { return (Flags & APPX_FLAGS.APPX_FLAGS_APPX_NGEN) != 0; @@ -359,38 +342,32 @@ namespace System #endif // FEATURE_APPX [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool DisableFusionUpdatesFromADManager(AppDomainHandle domain); #if FEATURE_APPX [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.I4)] private static extern APPX_FLAGS nGetAppXFlags(); #endif [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] private static extern void GetAppDomainManagerType(AppDomainHandle domain, StringHandleOnStack retAssembly, StringHandleOnStack retType); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] private static extern void SetAppDomainManagerType(AppDomainHandle domain, string assembly, string type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void nSetHostSecurityManagerFlags (HostSecurityManagerOptions flags); - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void SetSecurityHomogeneousFlag(AppDomainHandle domain, @@ -415,7 +392,6 @@ namespace System /// If this AppDomain is configured to have an AppDomain manager then create the instance of it. /// This method is also called from the VM to create the domain manager in the default domain. /// - [SecuritySafeCritical] private void CreateAppDomainManager() { Contract.Assert(_domainManager == null, "_domainManager == null"); @@ -532,7 +508,6 @@ namespace System // either by a host in native, a host in managed using an AppDomainSetup, or by the // TargetFrameworkAttribute on the executable (VS emits its target framework moniker using this // attribute starting in version 4). - [SecuritySafeCritical] internal String GetTargetFrameworkName() { String targetFrameworkName = _FusionStore.TargetFrameworkName; @@ -561,7 +536,6 @@ namespace System /// /// Returns the setting of the corresponding compatibility config switch (see CreateAppDomainManager for the impact). /// - [SecuritySafeCritical] internal bool DisableFusionUpdatesFromADManager() { return DisableFusionUpdatesFromADManager(GetNativeHandle()); @@ -570,7 +544,6 @@ namespace System /// /// Returns whether the current AppDomain follows the AppX rules. /// - [SecuritySafeCritical] [Pure] internal static bool IsAppXModel() { @@ -584,7 +557,6 @@ namespace System /// /// Returns the setting of the AppXDevMode config switch. /// - [SecuritySafeCritical] [Pure] internal static bool IsAppXDesignMode() { @@ -598,7 +570,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports Assembly.LoadFrom. /// - [SecuritySafeCritical] [Pure] internal static void CheckLoadFromSupported() { @@ -611,7 +582,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports Assembly.LoadFile. /// - [SecuritySafeCritical] [Pure] internal static void CheckLoadFileSupported() { @@ -624,7 +594,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports Assembly.ReflectionOnlyLoad. /// - [SecuritySafeCritical] [Pure] internal static void CheckReflectionOnlyLoadSupported() { @@ -637,7 +606,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports Assembly.LoadWithPartialName. /// - [SecuritySafeCritical] [Pure] internal static void CheckLoadWithPartialNameSupported(StackCrawlMark stackMark) { @@ -657,7 +625,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports DefinePInvokeMethod. /// - [SecuritySafeCritical] [Pure] internal static void CheckDefinePInvokeSupported() { @@ -671,7 +638,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports Assembly.Load(byte[] ...). /// - [SecuritySafeCritical] [Pure] internal static void CheckLoadByteArraySupported() { @@ -684,7 +650,6 @@ namespace System /// /// Checks (and throws on failure) if the domain supports AppDomain.CreateDomain. /// - [SecuritySafeCritical] [Pure] internal static void CheckCreateDomainSupported() { @@ -705,7 +670,6 @@ namespace System /// /// Get the name of the assembly and type that act as the AppDomainManager for this domain /// - [SecuritySafeCritical] internal void GetAppDomainManagerType(out string assembly, out string type) { // We can't just use our parameters because we need to ensure that the strings used for hte QCall @@ -724,7 +688,6 @@ namespace System /// /// Set the assembly and type which act as the AppDomainManager for this domain /// - [SecuritySafeCritical] private void SetAppDomainManagerType(string assembly, string type) { Contract.Assert(assembly != null, "assembly != null"); @@ -735,7 +698,6 @@ namespace System /// /// Called for every AppDomain (including the default domain) to initialize the security of the AppDomain) /// - [SecurityCritical] private void InitializeDomainSecurity(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, bool generateDefaultEvidence, @@ -772,7 +734,6 @@ namespace System publishAppDomain); } - [System.Security.SecurityCritical] // auto-generated private void SetupDomainSecurityForHomogeneousDomain(ApplicationTrust appTrust, bool runtimeSuppliedHomogenousGrantSet) { @@ -796,7 +757,6 @@ namespace System } public AppDomainManager DomainManager { - [System.Security.SecurityCritical] // auto-generated_required get { return _domainManager; } @@ -818,7 +778,6 @@ namespace System _packageGraphFilePaths = packageGraphFilePaths; } - [System.Security.SecurityCritical] public void ResolveNamespace( object sender, System.Runtime.InteropServices.WindowsRuntime.NamespaceResolveEventArgs args) @@ -837,7 +796,6 @@ namespace System } // Called only by native function code:ValidateWorker - [System.Security.SecuritySafeCritical] private void EnableResolveAssembliesForIntrospection(string verifiedFileDirectory) { CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(ResolveAssemblyForIntrospection); @@ -858,7 +816,6 @@ namespace System * to have a strong name and a hash will be computed when the assembly * is saved. **********************************************/ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -871,7 +828,6 @@ namespace System null, null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -889,7 +845,6 @@ namespace System } [MethodImplAttribute(MethodImplOptions.NoInlining)] // Due to the stack crawl mark - [SecuritySafeCritical] public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, IEnumerable assemblyAttributes, @@ -906,7 +861,6 @@ namespace System securityContextSource); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -923,7 +877,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -941,7 +894,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -963,7 +915,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of DefineDynamicAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -979,7 +930,6 @@ namespace System null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -1002,7 +952,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -1026,7 +975,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. Please see http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -1051,7 +999,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -1079,7 +1026,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public AssemblyBuilder DefineDynamicAssembly( @@ -1108,7 +1054,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -1132,7 +1077,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable private AssemblyBuilder InternalDefineDynamicAssembly( AssemblyName name, @@ -1158,7 +1102,6 @@ namespace System securityContextSource); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern String nApplyPolicy(AssemblyName an); @@ -1196,7 +1139,6 @@ namespace System typeName); } - [System.Security.SecurityCritical] // auto-generated internal ObjectHandle InternalCreateInstanceWithNoSecurity (string assemblyName, string typeName) { PermissionSet.s_fullTrust.Assert(); return CreateInstance(assemblyName, typeName); @@ -1215,7 +1157,6 @@ namespace System typeName); } - [System.Security.SecurityCritical] // auto-generated internal ObjectHandle InternalCreateInstanceFromWithNoSecurity (string assemblyName, string typeName) { PermissionSet.s_fullTrust.Assert(); return CreateInstanceFrom(assemblyName, typeName); @@ -1346,7 +1287,6 @@ namespace System activationAttributes); } - [System.Security.SecurityCritical] // auto-generated internal ObjectHandle InternalCreateInstanceWithNoSecurity (string assemblyName, string typeName, bool ignoreCase, @@ -1415,7 +1355,6 @@ namespace System activationAttributes); } - [System.Security.SecurityCritical] // auto-generated internal ObjectHandle InternalCreateInstanceFromWithNoSecurity (string assemblyName, string typeName, bool ignoreCase, @@ -1432,7 +1371,6 @@ namespace System #pragma warning restore 618 } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Assembly Load(AssemblyName assemblyRef) { @@ -1440,7 +1378,6 @@ namespace System return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Assembly Load(String assemblyString) { @@ -1448,7 +1385,6 @@ namespace System return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Assembly Load(byte[] rawAssembly) { @@ -1462,7 +1398,6 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore) @@ -1476,10 +1411,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, ControlEvidence = true)] -#pragma warning restore 618 [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] public Assembly Load(byte[] rawAssembly, @@ -1495,7 +1426,6 @@ namespace System SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public Assembly Load(AssemblyName assemblyRef, @@ -1505,7 +1435,6 @@ namespace System return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, assemblySecurity, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public Assembly Load(String assemblyString, @@ -1581,7 +1510,6 @@ namespace System return nExecuteAssembly(assembly, args); } - [System.Security.SecurityCritical] // auto-generated public int ExecuteAssemblyByName(String assemblyName) { return ExecuteAssemblyByName(assemblyName, (string[])null); @@ -1652,19 +1580,16 @@ namespace System public String FriendlyName { - [System.Security.SecuritySafeCritical] // auto-generated get { return nGetFriendlyName(); } } public String BaseDirectory { - [System.Security.SecurityCritical] get { return FusionStore.ApplicationBase; } } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { StringBuilder sb = StringBuilderCache.Acquire(); @@ -1700,31 +1625,25 @@ namespace System return nGetAssemblies(true /* forIntrospection */); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Assembly[] nGetAssemblies(bool forIntrospection); // this is true when we've removed the handles etc so really can't do anything - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern bool IsUnloadingForcedFinalize(); // this is true when we've just started going through the finalizers and are forcing objects to finalize // so must be aware that certain infrastructure may have gone away - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern bool IsFinalizingForUnload(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void PublishAnonymouslyHostedDynamicMethodsAssembly(RuntimeAssembly assemblyHandle); - [System.Security.SecurityCritical] // auto-generated_required public void SetData (string name, object data) { SetDataHelper(name, data, null); } - [System.Security.SecurityCritical] // auto-generated_required public void SetData (string name, object data, IPermission permission) { if (!name.Equals("LOCATION_URI")) @@ -1736,7 +1655,6 @@ namespace System SetDataHelper(name, data, permission); } - [System.Security.SecurityCritical] // auto-generated private void SetDataHelper (string name, object data, IPermission permission) { if (name == null) @@ -1759,7 +1677,6 @@ namespace System } [Pure] - [System.Security.SecurityCritical] // auto-generated public Object GetData(string name) { if(name == null) @@ -1842,7 +1759,6 @@ namespace System public String DynamicDirectory { - [System.Security.SecuritySafeCritical] // auto-generated get { String dyndir = GetDynamicDir(); if (dyndir != null) @@ -1852,7 +1768,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] extern private String GetDynamicDir(); @@ -1860,7 +1775,6 @@ namespace System throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Constructor)); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern int _nExecuteAssembly(RuntimeAssembly assembly, String[] args); internal int nExecuteAssembly(RuntimeAssembly assembly, String[] args) @@ -1872,24 +1786,18 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void nCreateContext(); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void nSetupBindingPaths(String trustedPlatformAssemblies, String platformResourceRoots, String appPath, String appNiPaths, String appLocalWinMD); - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal void SetupBindingPaths(String trustedPlatformAssemblies, String platformResourceRoots, String appPath, String appNiPaths, String appLocalWinMD) { nSetupBindingPaths(trustedPlatformAssemblies, platformResourceRoots, appPath, appNiPaths, appLocalWinMD); } #endif // FEATURE_VERSIONING - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern String nGetFriendlyName(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool nIsDefaultAppDomainForEvidence(); @@ -1901,7 +1809,6 @@ namespace System public event EventHandler ProcessExit { - [System.Security.SecuritySafeCritical] // auto-generated_required add { if (value != null) @@ -1921,7 +1828,6 @@ namespace System public event EventHandler DomainUnload { - [System.Security.SecuritySafeCritical] // auto-generated_required add { if (value != null) @@ -1931,7 +1837,6 @@ namespace System _domainUnload += value; } } - [System.Security.SecuritySafeCritical] remove { lock(this) @@ -1942,7 +1847,6 @@ namespace System public event UnhandledExceptionEventHandler UnhandledException { - [System.Security.SecurityCritical] // auto-generated_required add { if (value != null) @@ -1952,7 +1856,6 @@ namespace System _unhandledException += value; } } - [System.Security.SecurityCritical] // auto-generated_required remove { lock(this) @@ -1967,7 +1870,6 @@ namespace System // To register/unregister the callback, the code must be SecurityCritical. public event EventHandler FirstChanceException { - [System.Security.SecurityCritical] // auto-generated_required add { if (value != null) @@ -1977,7 +1879,6 @@ namespace System _firstChanceException += value; } } - [System.Security.SecurityCritical] // auto-generated_required remove { lock(this) @@ -1996,7 +1897,6 @@ namespace System } // This method is called by the VM. - [System.Security.SecurityCritical] private RuntimeAssembly OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName) { ResolveEventHandler eventHandler = _ResourceResolve; @@ -2016,7 +1916,6 @@ namespace System } // This method is called by the VM - [System.Security.SecurityCritical] private RuntimeAssembly OnTypeResolveEvent(RuntimeAssembly assembly, String typeName) { ResolveEventHandler eventHandler = _TypeResolve; @@ -2036,7 +1935,6 @@ namespace System } // This method is called by the VM. - [System.Security.SecurityCritical] private RuntimeAssembly OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) { ResolveEventHandler eventHandler = _AssemblyResolve; @@ -2105,17 +2003,14 @@ namespace System // Used to determine if server object context is valid in // x-domain remoting scenarios. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static extern bool IsDomainIdValid(Int32 id); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void nSetNativeDllSearchDirectories(string paths); - [System.Security.SecurityCritical] // auto-generated private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { Contract.Requires(info != null); @@ -2162,7 +2057,6 @@ namespace System // are any remoting sinks registered, they can add non-mscorlib // objects to the message (causing an assembly load exception when // we try to deserialize it on the other side) - [System.Security.SecurityCritical] // auto-generated private static object PrepareDataForSetup(String friendlyName, AppDomainSetup setup, Evidence providedSecurityInfo, @@ -2223,7 +2117,6 @@ namespace System }; } // PrepareDataForSetup - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] private static Object Setup(Object arg) { @@ -2393,7 +2286,6 @@ namespace System return StringBuilderCache.GetStringAndRelease(sb); } - [SecuritySafeCritical] internal static string NormalizePath(string path, bool fullCheck) { return Path.GetFullPath(path); @@ -2401,7 +2293,6 @@ namespace System // This routine is called from unmanaged code to // set the default fusion context. - [System.Security.SecurityCritical] // auto-generated private void SetupDomain(bool allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues) { // It is possible that we could have multiple threads initializing @@ -2421,7 +2312,6 @@ namespace System } #if FEATURE_LOADER_OPTIMIZATION - [System.Security.SecurityCritical] // auto-generated private void SetupLoaderOptimization(LoaderOptimization policy) { if(policy != LoaderOptimization.NotSpecified) { @@ -2434,11 +2324,9 @@ namespace System } #endif - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetSecurityDescriptor(); - [SecurityCritical] private void SetupDomainSecurity(Evidence appDomainEvidence, IntPtr creatorsSecurityDescriptor, bool publishAppDomain) @@ -2451,7 +2339,6 @@ namespace System } - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void SetupDomainSecurity(AppDomainHandle appDomain, @@ -2459,7 +2346,6 @@ namespace System IntPtr creatorsSecurityDescriptor, [MarshalAs(UnmanagedType.Bool)] bool publishAppDomain); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void nSetupFriendlyName(string friendlyName); @@ -2469,7 +2355,6 @@ namespace System #endif // FEATURE_COMINTEROP #if FEATURE_LOADER_OPTIMIZATION - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void UpdateLoaderOptimization(LoaderOptimization optimization); #endif @@ -2481,15 +2366,12 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern String IsStringInterned(String str); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern String GetOrInternString(String str); - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void GetGrantSet(AppDomainHandle domain, ObjectHandleOnStack retGrantSet); @@ -2497,7 +2379,6 @@ namespace System public PermissionSet PermissionSet { // SecurityCritical because permissions can contain sensitive information such as paths - [SecurityCritical] get { PermissionSet grantSet = null; @@ -2516,7 +2397,6 @@ namespace System public bool IsFullyTrusted { - [SecuritySafeCritical] get { PermissionSet grantSet = null; @@ -2535,11 +2415,9 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void nChangeSecurityPolicy(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.MayCorruptAppDomain, Cer.MayFail)] internal static extern void nUnload(Int32 domainInternal); @@ -2698,7 +2576,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern Int32 GetId(); @@ -2713,42 +2590,34 @@ namespace System } #if FEATURE_APPDOMAIN_RESOURCE_MONITORING - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void nEnableMonitoring(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool nMonitoringIsEnabled(); // return -1 if ARM is not supported. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Int64 nGetTotalProcessorTime(); // return -1 if ARM is not supported. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Int64 nGetTotalAllocatedMemorySize(); // return -1 if ARM is not supported. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Int64 nGetLastSurvivedMemorySize(); // return -1 if ARM is not supported. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Int64 nGetLastSurvivedProcessMemorySize(); public static bool MonitoringIsEnabled { - [System.Security.SecurityCritical] get { return nMonitoringIsEnabled(); } - [System.Security.SecurityCritical] set { if (value == false) { @@ -2765,7 +2634,6 @@ namespace System // Throws NotSupportedException if ARM is not enabled. public TimeSpan MonitoringTotalProcessorTime { - [System.Security.SecurityCritical] get { Int64 i64ProcessorTime = nGetTotalProcessorTime(); if (i64ProcessorTime == -1) @@ -2781,7 +2649,6 @@ namespace System // Throws NotSupportedException if ARM is not enabled. public Int64 MonitoringTotalAllocatedMemorySize { - [System.Security.SecurityCritical] get { Int64 i64AllocatedMemory = nGetTotalAllocatedMemorySize(); if (i64AllocatedMemory == -1) @@ -2799,7 +2666,6 @@ namespace System // Throws NotSupportedException if ARM is not enabled. public Int64 MonitoringSurvivedMemorySize { - [System.Security.SecurityCritical] get { Int64 i64LastSurvivedMemory = nGetLastSurvivedMemorySize(); if (i64LastSurvivedMemory == -1) @@ -2819,7 +2685,6 @@ namespace System // Throws NotSupportedException if ARM is not enabled. public static Int64 MonitoringSurvivedProcessMemorySize { - [System.Security.SecurityCritical] get { Int64 i64LastSurvivedProcessMemory = nGetLastSurvivedProcessMemorySize(); if (i64LastSurvivedProcessMemory == -1) diff --git a/src/coreclr/src/mscorlib/src/System/AppDomainManager.cs b/src/coreclr/src/mscorlib/src/System/AppDomainManager.cs index 696688e..71bc088 100644 --- a/src/coreclr/src/mscorlib/src/System/AppDomainManager.cs +++ b/src/coreclr/src/mscorlib/src/System/AppDomainManager.cs @@ -15,13 +15,11 @@ namespace System using System.Security; using System.Runtime.InteropServices; - [System.Security.SecurityCritical] // auto-generated_required [System.Runtime.InteropServices.ComVisible(true)] public class AppDomainManager : MarshalByRefObject { public AppDomainManager () {} - [System.Security.SecurityCritical] public virtual void InitializeNewDomain (AppDomainSetup appDomainInfo) { // By default, InitializeNewDomain does nothing. AppDomain.CreateAppDomainManager relies on this fact. @@ -32,7 +30,6 @@ namespace System private Assembly m_entryAssembly = null; public virtual Assembly EntryAssembly { - [System.Security.SecurityCritical] // auto-generated get { // The default AppDomainManager sets the EntryAssembly depending on whether the // AppDomain is a manifest application domain or not. In the first case, we parse @@ -51,7 +48,6 @@ namespace System } internal static AppDomainManager CurrentAppDomainManager { - [System.Security.SecurityCritical] // auto-generated get { return AppDomain.CurrentDomain.DomainManager; } diff --git a/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs b/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs index b7fe732..2fa0159 100644 --- a/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs +++ b/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs @@ -124,7 +124,6 @@ namespace System private bool _UseRandomizedStringHashing; #endif - [SecuritySafeCritical] internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData) { string[] mine = Value; @@ -183,7 +182,6 @@ namespace System _LoaderOptimization = LoaderOptimization.NotSpecified; } - [System.Security.SecurityCritical] // auto-generated internal void SetupDefaults(string imageLocation, bool imageLocationAlreadyNormalized = false) { char[] sep = {'\\', '/'}; int i = imageLocation.LastIndexOfAny(sep); @@ -231,19 +229,11 @@ namespace System public String ApplicationBase { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [Pure] get { return VerifyDir(GetUnsecureApplicationBase(), false); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif set { Value[(int) LoaderInformation.ApplicationBaseValue] = NormalizePath(value, false); } @@ -466,7 +456,6 @@ namespace System public String ConfigurationFile { - [System.Security.SecuritySafeCritical] // auto-generated get { return VerifyDir(Value[(int) LoaderInformation.ConfigurationFileValue], true); } @@ -561,12 +550,10 @@ namespace System public String DynamicBase { - [System.Security.SecuritySafeCritical] // auto-generated get { return VerifyDir(Value[(int) LoaderInformation.DynamicBaseValue], true); } - [System.Security.SecuritySafeCritical] // auto-generated set { if (value == null) Value[(int) LoaderInformation.DynamicBaseValue] = null; @@ -654,7 +641,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated private String VerifyDir(String dir, bool normalize) { if (dir != null) { @@ -669,7 +655,6 @@ namespace System return dir; } - [System.Security.SecurityCritical] // auto-generated private void VerifyDirList(String dirs) { if (dirs != null) { @@ -683,7 +668,6 @@ namespace System internal String DeveloperPath { - [System.Security.SecurityCritical] // auto-generated get { String dirs = Value[(int) LoaderInformation.DevPathValue]; VerifyDirList(dirs); @@ -821,7 +805,6 @@ namespace System public String PrivateBinPath { - [System.Security.SecuritySafeCritical] // auto-generated get { String dirs = Value[(int) LoaderInformation.PrivateBinPathValue]; VerifyDirList(dirs); @@ -860,7 +843,6 @@ namespace System public String ShadowCopyDirectories { - [System.Security.SecuritySafeCritical] // auto-generated get { String dirs = Value[(int) LoaderInformation.ShadowCopyDirectoriesValue]; VerifyDirList(dirs); @@ -903,7 +885,6 @@ namespace System public String CachePath { - [System.Security.SecuritySafeCritical] // auto-generated get { return VerifyDir(Value[(int) LoaderInformation.CachePathValue], false); } @@ -922,7 +903,6 @@ namespace System public String LicenseFile { - [System.Security.SecuritySafeCritical] // auto-generated get { return VerifyDir(Value[(int) LoaderInformation.LicenseFileValue], true); } diff --git a/src/coreclr/src/mscorlib/src/System/ArgIterator.cs b/src/coreclr/src/mscorlib/src/System/ArgIterator.cs index 0ce27ed..c5bc379 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgIterator.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgIterator.cs @@ -16,19 +16,16 @@ namespace System { [StructLayout(LayoutKind.Sequential)] public struct ArgIterator { - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern ArgIterator(IntPtr arglist); // create an arg iterator that points at the first argument that // is not statically declared (that is the first ... arg) // 'arglist' is the value returned by the ARGLIST instruction - [System.Security.SecuritySafeCritical] // auto-generated public ArgIterator(RuntimeArgumentHandle arglist) : this(arglist.Value) { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern ArgIterator(IntPtr arglist, void *ptr); @@ -36,7 +33,6 @@ namespace System { // 'arglist' is the value returned by the ARGLIST instruction // This is much like the C va_start macro - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr) : this(arglist.Value, ptr) @@ -45,7 +41,6 @@ namespace System { // Fetch an argument as a typed referece, advance the iterator. // Throws an exception if past end of argument list - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg() { @@ -58,14 +53,12 @@ namespace System { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void FCallGetNextArg(void * result); // Alternate version of GetNextArg() intended primarily for IJW code // generated by VC's "va_arg()" construct. - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg(RuntimeTypeHandle rth) { @@ -96,7 +89,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void InternalGetNextArg(void * result, RuntimeType rt); @@ -107,16 +99,13 @@ namespace System { } // How many arguments are left in the list - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int GetRemainingCount(); // Gets the type of the current arg, does NOT advance the iterator - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern unsafe void* _GetNextArgType(); - [System.Security.SecuritySafeCritical] // auto-generated public unsafe RuntimeTypeHandle GetNextArgType() { return new RuntimeTypeHandle(Type.GetTypeFromHandleUnsafe((IntPtr)_GetNextArgType())); diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs b/src/coreclr/src/mscorlib/src/System/ArgumentException.cs index 0afa56f..f37b769 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgumentException.cs @@ -82,7 +82,6 @@ namespace System { get { return m_paramName; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs b/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs index 4bcb537..661ebd2 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs @@ -48,7 +48,6 @@ namespace System { SetErrorCode(__HResults.E_POINTER); } - [System.Security.SecurityCritical] // auto-generated_required protected ArgumentNullException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs b/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs index 0b1ed4d..78a90db 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs @@ -89,7 +89,6 @@ namespace System { get { return m_actualValue; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Array.cs b/src/coreclr/src/mscorlib/src/System/Array.cs index 106cea9..a18468c 100644 --- a/src/coreclr/src/mscorlib/src/System/Array.cs +++ b/src/coreclr/src/mscorlib/src/System/Array.cs @@ -64,7 +64,6 @@ namespace System { } // Create instance will create an array - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Array CreateInstance(Type elementType, int length) { if ((object)elementType == null) @@ -82,7 +81,6 @@ namespace System { return InternalCreate((void*)t.TypeHandle.Value,1,&length,null); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Array CreateInstance(Type elementType, int length1, int length2) { if ((object)elementType == null) @@ -105,7 +103,6 @@ namespace System { return InternalCreate((void*)t.TypeHandle.Value,2,pLengths,null); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Array CreateInstance(Type elementType, int length1, int length2, int length3) { if ((object)elementType == null) @@ -132,7 +129,6 @@ namespace System { return InternalCreate((void*)t.TypeHandle.Value,3,pLengths,null); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Array CreateInstance(Type elementType, params int[] lengths) { if ((object)elementType == null) @@ -186,7 +182,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Array CreateInstance(Type elementType, int[] lengths,int[] lowerBounds) { if (elementType == null) @@ -220,29 +215,24 @@ namespace System { return InternalCreate((void*)t.TypeHandle.Value,lengths.Length,pLengths,pLowerBounds); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe static extern Array InternalCreate(void* elementType,int rank,int *pLengths,int *pLowerBounds); - [SecurityCritical] internal static Array UnsafeCreateInstance(Type elementType, int length) { return CreateInstance(elementType, length); } - [SecurityCritical] internal static Array UnsafeCreateInstance(Type elementType, int length1, int length2) { return CreateInstance(elementType, length1, length2); } - [SecurityCritical] internal static Array UnsafeCreateInstance(Type elementType, params int[] lengths) { return CreateInstance(elementType, lengths); } - [SecurityCritical] internal static Array UnsafeCreateInstance(Type elementType, int[] lengths, int[] lowerBounds) { return CreateInstance(elementType, lengths, lowerBounds); @@ -251,7 +241,6 @@ namespace System { // Copies length elements from sourceArray, starting at index 0, to // destinationArray, starting at index 0. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Copy(Array sourceArray, Array destinationArray, int length) { @@ -273,7 +262,6 @@ namespace System { // Copies length elements from sourceArray, starting at sourceIndex, to // destinationArray, starting at destinationIndex. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length) { @@ -284,7 +272,6 @@ namespace System { // instance & might fail when called from within a CER, or if the // reliable flag is true, it will either always succeed or always // throw an exception with no side effects. - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length, bool reliable); @@ -294,7 +281,6 @@ namespace System { // compatible array types based on the array element type - this // method does not support casting, boxing, or primitive widening. // It will up-cast, assuming the array types are correct. - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static void ConstrainedCopy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length) { @@ -327,13 +313,11 @@ namespace System { // Sets length elements in array to 0 (or null for Object arrays), starting // at index. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern void Clear(Array array, int index, int length); // The various Get values... - [System.Security.SecuritySafeCritical] // auto-generated public unsafe Object GetValue(params int[] indices) { if (indices == null) @@ -348,7 +332,6 @@ namespace System { return TypedReference.InternalToObject(&elemref); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe Object GetValue(int index) { if (Rank != 1) @@ -360,7 +343,6 @@ namespace System { return TypedReference.InternalToObject(&elemref); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe Object GetValue(int index1, int index2) { if (Rank != 2) @@ -376,7 +358,6 @@ namespace System { return TypedReference.InternalToObject(&elemref); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe Object GetValue(int index1, int index2, int index3) { if (Rank != 3) @@ -452,7 +433,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe void SetValue(Object value,int index) { if (Rank != 1) @@ -464,7 +444,6 @@ namespace System { InternalSetValue(&elemref,value); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe void SetValue(Object value,int index1, int index2) { if (Rank != 2) @@ -480,7 +459,6 @@ namespace System { InternalSetValue(&elemref,value); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe void SetValue(Object value,int index1, int index2, int index3) { if (Rank != 3) @@ -497,7 +475,6 @@ namespace System { InternalSetValue(&elemref,value); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe void SetValue(Object value,params int[] indices) { if (indices == null) @@ -570,20 +547,17 @@ namespace System { this.SetValue(value, intIndices); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as pointer private unsafe extern void InternalGetReference(void * elemRef, int rank, int * pIndices); // Ideally, we would like to use TypedReference.SetValue instead. Unfortunately, TypedReference.SetValue // always throws not-supported exception - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern static void InternalSetValue(void * target, Object value); public extern int Length { [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] get; @@ -608,14 +582,12 @@ namespace System { [ComVisible(false)] public extern long LongLength { [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] get; } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int GetLength(int dimension); @@ -628,25 +600,21 @@ namespace System { public extern int Rank { [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } - [System.Security.SecuritySafeCritical] // auto-generated [Pure] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public extern int GetUpperBound(int dimension); - [System.Security.SecuritySafeCritical] // auto-generated [Pure] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int GetLowerBound(int dimension); - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern int GetDataPtrOffsetInternal(); @@ -883,7 +851,6 @@ namespace System { // is larger than the given search value. // [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static int BinarySearch(Array array, int index, int length, Object value, IComparer comparer) { if (array==null) @@ -954,7 +921,6 @@ namespace System { return ~lo; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern bool TrySZBinarySearch(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); @@ -1318,7 +1284,6 @@ namespace System { // elements of the array are compared to the given value using the // Object.Equals method. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static int IndexOf(Array array, Object value, int startIndex, int count) { if (array==null) @@ -1413,7 +1378,6 @@ namespace System { return EqualityComparer.Default.IndexOf(array, value, startIndex, count); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern bool TrySZIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); @@ -1454,7 +1418,6 @@ namespace System { // the array are compared to the given value using the Object.Equals // method. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static int LastIndexOf(Array array, Object value, int startIndex, int count) { if (array==null) @@ -1566,7 +1529,6 @@ namespace System { return EqualityComparer.Default.LastIndexOf(array, value, startIndex, count); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern bool TrySZLastIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); @@ -1591,7 +1553,6 @@ namespace System { // index index + (index + count - i - 1). // Reliability note: This may fail because it may have to box objects. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Reverse(Array array, int index, int length) { if (array==null) @@ -1635,7 +1596,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] private static extern bool TrySZReverse(Array array, int index, int count); @@ -1769,7 +1729,6 @@ namespace System { // the IComparable interface, which in that case must be implemented // by all elements of the given section of the keys array. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Sort(Array keys, Array items, int index, int length, IComparer comparer) { if (keys==null) @@ -1811,7 +1770,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] private static extern bool TrySZSort(Array keys, Array items, int left, int right); @@ -1858,7 +1816,6 @@ namespace System { Sort(keys, items, 0, keys.Length, comparer); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Sort(T[] array, int index, int length, System.Collections.Generic.IComparer comparer) { if (array==null) @@ -1882,7 +1839,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Sort(TKey[] keys, TValue[] items, int index, int length, System.Collections.Generic.IComparer comparer) { if (keys==null) @@ -2486,7 +2442,6 @@ namespace System { // if this is an array of value classes and that value class has a default constructor // then this calls this default constructor on every element in the value class array. // otherwise this is a no-op. Generally this method is called automatically by the compiler - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void Initialize(); } @@ -2529,7 +2484,6 @@ namespace System { // ----------------------------------------------------------- // ------- Implement IEnumerable interface methods -------- // ----------------------------------------------------------- - [SecuritySafeCritical] internal IEnumerator GetEnumerator() { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2541,7 +2495,6 @@ namespace System { // ----------------------------------------------------------- // ------- Implement ICollection interface methods -------- // ----------------------------------------------------------- - [SecuritySafeCritical] void CopyTo(T[] array, int index) { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2550,7 +2503,6 @@ namespace System { Array.Copy(_this, 0, array, index, _this.Length); } - [SecuritySafeCritical] internal int get_Count() { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2561,7 +2513,6 @@ namespace System { // ----------------------------------------------------------- // ---------- Implement IList interface methods ----------- // ----------------------------------------------------------- - [SecuritySafeCritical] internal T get_Item(int index) { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2573,7 +2524,6 @@ namespace System { return _this[index]; } - [SecuritySafeCritical] internal void set_Item(int index, T value) { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2590,7 +2540,6 @@ namespace System { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } - [SecuritySafeCritical] bool Contains(T value) { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! @@ -2609,7 +2558,6 @@ namespace System { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection); } - [SecuritySafeCritical] int IndexOf(T value) { //! Warning: "this" is an array, not an SZArrayHelper. See comments above //! or you may introduce a security hole! diff --git a/src/coreclr/src/mscorlib/src/System/Attribute.cs b/src/coreclr/src/mscorlib/src/System/Attribute.cs index b932280..713369f 100644 --- a/src/coreclr/src/mscorlib/src/System/Attribute.cs +++ b/src/coreclr/src/mscorlib/src/System/Attribute.cs @@ -436,7 +436,6 @@ namespace System { Environment.GetResourceString("Format_AttributeUsage", type)); } - [System.Security.SecuritySafeCritical] private static Attribute[] CreateAttributeArrayHelper(Type elementType, int elementCount) { return (Attribute[])Array.UnsafeCreateInstance(elementType, elementCount); @@ -830,7 +829,6 @@ namespace System { #endregion #region Object Overrides - [SecuritySafeCritical] public override bool Equals(Object obj) { if (obj == null) @@ -913,7 +911,6 @@ namespace System { return true; } - [SecuritySafeCritical] public override int GetHashCode() { Type type = GetType(); diff --git a/src/coreclr/src/mscorlib/src/System/BCLDebug.cs b/src/coreclr/src/mscorlib/src/System/BCLDebug.cs index 91f845f..0ca6e61 100644 --- a/src/coreclr/src/mscorlib/src/System/BCLDebug.cs +++ b/src/coreclr/src/mscorlib/src/System/BCLDebug.cs @@ -119,7 +119,6 @@ namespace System { [Pure] [Conditional("_LOGGING")] - [SecuritySafeCritical] static public void Log(String message) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return; @@ -132,7 +131,6 @@ namespace System { [Pure] [Conditional("_LOGGING")] - [SecuritySafeCritical] static public void Log(String switchName, String message) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return; @@ -160,7 +158,6 @@ namespace System { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static int GetRegistryLoggingValues(out bool loggingEnabled, out bool logToConsole, out int logLevel, out bool perfWarnings, out bool correctnessWarnings, out bool safeHandleStackTraces); - [SecuritySafeCritical] private static void CheckRegistry() { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return; @@ -207,7 +204,6 @@ namespace System { } } - [SecuritySafeCritical] internal static bool CheckEnabled(String switchName) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return false; @@ -220,7 +216,6 @@ namespace System { return ((int)logSwitch.MinimumLevel<=(int)LogLevel.Trace); } - [SecuritySafeCritical] private static bool CheckEnabled(String switchName, LogLevel level, out LogSwitch logSwitch) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) { @@ -236,7 +231,6 @@ namespace System { [Pure] [Conditional("_LOGGING")] - [SecuritySafeCritical] public static void Log(String switchName, LogLevel level, params Object[]messages) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return; @@ -341,7 +335,6 @@ namespace System { // For perf-related asserts. On a debug build, set the registry key // BCLPerfWarnings to non-zero. [Conditional("_DEBUG")] - [SecuritySafeCritical] internal static void Perf(bool expr, String msg) { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) @@ -361,7 +354,6 @@ namespace System { // BCLCorrectnessWarnings to non-zero. [Conditional("_DEBUG")] #if _DEBUG - [SecuritySafeCritical] #endif internal static void Correctness(bool expr, String msg) { @@ -386,7 +378,6 @@ namespace System { } #if !BIT64 // 32 - [SecuritySafeCritical] #endif internal static bool CorrectnessEnabled() { diff --git a/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs b/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs index b71fcc3..3f3f4a5 100644 --- a/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs +++ b/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs @@ -132,14 +132,11 @@ namespace System { } public String FusionLog { - [System.Security.SecuritySafeCritical] // auto-generated #pragma warning disable CS0618 // Type or member is obsolete - [SecurityPermissionAttribute( SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy)] #pragma warning restore CS0618 // Type or member is obsolete get { return _fusionLog; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { // Serialize data for our base classes. base will verify info != null. base.GetObjectData(info, context); diff --git a/src/coreclr/src/mscorlib/src/System/BitConverter.cs b/src/coreclr/src/mscorlib/src/System/BitConverter.cs index 5adbd8f..6fbec2a 100644 --- a/src/coreclr/src/mscorlib/src/System/BitConverter.cs +++ b/src/coreclr/src/mscorlib/src/System/BitConverter.cs @@ -56,7 +56,6 @@ namespace System { // Converts a short into an array of bytes with length // two. - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static byte[] GetBytes(short value) { Contract.Ensures(Contract.Result() != null); @@ -70,7 +69,6 @@ namespace System { // Converts an int into an array of bytes with length // four. - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static byte[] GetBytes(int value) { Contract.Ensures(Contract.Result() != null); @@ -84,7 +82,6 @@ namespace System { // Converts a long into an array of bytes with length // eight. - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static byte[] GetBytes(long value) { Contract.Ensures(Contract.Result() != null); @@ -128,7 +125,6 @@ namespace System { // Converts a float into an array of bytes with length // four. - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static byte[] GetBytes(float value) { Contract.Ensures(Contract.Result() != null); @@ -139,7 +135,6 @@ namespace System { // Converts a double into an array of bytes with length // eight. - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static byte[] GetBytes(double value) { Contract.Ensures(Contract.Result() != null); @@ -168,7 +163,6 @@ namespace System { } // Converts an array of bytes into a short. - [System.Security.SecuritySafeCritical] // auto-generated public static unsafe short ToInt16(byte[] value, int startIndex) { if( value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); @@ -200,7 +194,6 @@ namespace System { } // Converts an array of bytes into an int. - [System.Security.SecuritySafeCritical] // auto-generated public static unsafe int ToInt32 (byte[] value, int startIndex) { if( value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); @@ -231,7 +224,6 @@ namespace System { } // Converts an array of bytes into a long. - [System.Security.SecuritySafeCritical] // auto-generated public static unsafe long ToInt64 (byte[] value, int startIndex) { if (value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); @@ -315,7 +307,6 @@ namespace System { } // Converts an array of bytes into a float. - [System.Security.SecuritySafeCritical] // auto-generated unsafe public static float ToSingle (byte[] value, int startIndex) { if (value == null) @@ -331,7 +322,6 @@ namespace System { } // Converts an array of bytes into a double. - [System.Security.SecuritySafeCritical] // auto-generated unsafe public static double ToDouble (byte[] value, int startIndex) { if (value == null) @@ -438,22 +428,18 @@ namespace System { return (value[startIndex]==0)?false:true; } - [SecuritySafeCritical] public static unsafe long DoubleToInt64Bits(double value) { return *((long *)&value); } - [SecuritySafeCritical] public static unsafe double Int64BitsToDouble(long value) { return *((double*)&value); } - [SecuritySafeCritical] public static unsafe int SingleToInt32Bits(float value) { return *((int*)&value); } - [SecuritySafeCritical] public static unsafe float Int32BitsToSingle(int value) { return *((float*)&value); } diff --git a/src/coreclr/src/mscorlib/src/System/Buffer.cs b/src/coreclr/src/mscorlib/src/System/Buffer.cs index 72cbe01..4821ba6 100644 --- a/src/coreclr/src/mscorlib/src/System/Buffer.cs +++ b/src/coreclr/src/mscorlib/src/System/Buffer.cs @@ -28,7 +28,6 @@ namespace System { // respecting types. This calls memmove internally. The count and // offset parameters here are in bytes. If you want to use traditional // array element indices and counts, use Array.Copy. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count); @@ -37,7 +36,6 @@ namespace System { // parameter validation has already been done. The count and offset // parameters here are in bytes. If you want to use traditional // array element indices and counts, use Array.Copy. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InternalBlockCopy(Array src, int srcOffsetBytes, Array dst, int dstOffsetBytes, int byteCount); @@ -47,7 +45,6 @@ namespace System { // It is however cross platform as the CRT hasn't ported their fast version to 64-bit // platforms. // - [System.Security.SecurityCritical] // auto-generated internal unsafe static int IndexOfByte(byte* src, byte value, int index, int count) { Contract.Assert(src != null, "src should not be null"); @@ -122,7 +119,6 @@ namespace System { // Returns a bool to indicate if the array is of primitive data types // or not. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool IsPrimitiveTypeArray(Array array); @@ -132,11 +128,9 @@ namespace System { // This essentially does the following: // return ((byte*)array) + index. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern byte _GetByte(Array array, int index); - [System.Security.SecuritySafeCritical] // auto-generated public static byte GetByte(Array array, int index) { // Is the array present? @@ -160,11 +154,9 @@ namespace System { // This essentially does the following: // *(((byte*)array) + index) = value. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _SetByte(Array array, int index, byte value); - [System.Security.SecuritySafeCritical] // auto-generated public static void SetByte(Array array, int index, byte value) { // Is the array present? @@ -190,11 +182,9 @@ namespace System { // This essentially does the following: // return array.length * sizeof(array.UnderlyingElementType). // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int _ByteLength(Array array); - [System.Security.SecuritySafeCritical] // auto-generated public static int ByteLength(Array array) { // Is the array present? @@ -208,14 +198,12 @@ namespace System { return _ByteLength(array); } - [System.Security.SecurityCritical] // auto-generated internal unsafe static void ZeroMemory(byte* src, long len) { while(len-- > 0) *(src + len) = 0; } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal unsafe static void Memcpy(byte[] dest, int destIndex, byte* src, int srcIndex, int len) { Contract.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!"); @@ -229,7 +217,6 @@ namespace System { } } - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal unsafe static void Memcpy(byte* pDest, int destIndex, byte[] src, int srcIndex, int len) { @@ -254,7 +241,6 @@ namespace System { // 1. This method is given access to other internal dlls and this close to release we do not want to change it. // 2. It is difficult to get this right for arm and again due to release dates we would like to visit it later. [FriendAccessAllowed] - [System.Security.SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #if ARM [MethodImplAttribute(MethodImplOptions.InternalCall)] @@ -268,7 +254,6 @@ namespace System { #endif // ARM // This method has different signature for x64 and other platforms and is done for performance reasons. - [System.Security.SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal unsafe static void Memmove(byte* dest, byte* src, nuint len) { @@ -595,7 +580,6 @@ namespace System { // Non-inlinable wrapper around the QCall that avoids poluting the fast path // with P/Invoke prolog/epilog. - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.NoInlining)] private unsafe static void _Memmove(byte* dest, byte* src, nuint len) @@ -605,13 +589,11 @@ namespace System { [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] extern private unsafe static void __Memmove(byte* dest, byte* src, nuint len); // The attributes on this method are chosen for best JIT performance. // Please do not edit unless intentional. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) @@ -626,7 +608,6 @@ namespace System { // The attributes on this method are chosen for best JIT performance. // Please do not edit unless intentional. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) diff --git a/src/coreclr/src/mscorlib/src/System/Byte.cs b/src/coreclr/src/mscorlib/src/System/Byte.cs index 2c24bf6..980412b 100644 --- a/src/coreclr/src/mscorlib/src/System/Byte.cs +++ b/src/coreclr/src/mscorlib/src/System/Byte.cs @@ -139,28 +139,24 @@ namespace System { } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.CurrentInfo); } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, format, NumberFormatInfo.CurrentInfo); } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.GetInstance(provider)); } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/CLRConfig.cs b/src/coreclr/src/mscorlib/src/System/CLRConfig.cs index 0831c4b..01ad7c3 100644 --- a/src/coreclr/src/mscorlib/src/System/CLRConfig.cs +++ b/src/coreclr/src/mscorlib/src/System/CLRConfig.cs @@ -19,12 +19,10 @@ namespace System { internal class CLRConfig { [FriendAccessAllowed] - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [SuppressUnmanagedCodeSecurity] internal static extern bool CheckLegacyManagedDeflateStream(); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [SuppressUnmanagedCodeSecurity] internal static extern bool CheckThrowUnobservedTaskExceptions(); diff --git a/src/coreclr/src/mscorlib/src/System/CfgParser.cs b/src/coreclr/src/mscorlib/src/System/CfgParser.cs index aba416c..facf07f 100644 --- a/src/coreclr/src/mscorlib/src/System/CfgParser.cs +++ b/src/coreclr/src/mscorlib/src/System/CfgParser.cs @@ -213,7 +213,6 @@ namespace System int textLength, int prefixLength); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void RunParser(String fileName); } @@ -245,7 +244,6 @@ namespace System return Parse(fileName, configPath, false); } - [System.Security.SecuritySafeCritical] // auto-generated internal ConfigNode Parse(String fileName, String configPath, bool skipSecurityStuff) { if (fileName == null) diff --git a/src/coreclr/src/mscorlib/src/System/Char.cs b/src/coreclr/src/mscorlib/src/System/Char.cs index 650b159..b571fa8 100644 --- a/src/coreclr/src/mscorlib/src/System/Char.cs +++ b/src/coreclr/src/mscorlib/src/System/Char.cs @@ -911,7 +911,6 @@ namespace System { ** Convert an UTF32 value into a surrogate pair. ==============================================================================*/ - [System.Security.SecuritySafeCritical] public static String ConvertFromUtf32(int utf32) { // For UTF32 values from U+00D800 ~ U+00DFFF, we should throw. They diff --git a/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs b/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs index fa51796..a8516e3 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs @@ -764,7 +764,6 @@ namespace System.Collections { // downcasting all elements. This copy may fail and is an O(n) operation. // Internally, this implementation calls Array.Copy. // - [SecuritySafeCritical] public virtual Array ToArray(Type type) { if (type==null) throw new ArgumentNullException(nameof(type)); @@ -1122,7 +1121,6 @@ namespace System.Collections { return array; } - [SecuritySafeCritical] public override Array ToArray(Type type) { if (type==null) @@ -2519,7 +2517,6 @@ namespace System.Collections { return array; } - [SecuritySafeCritical] public override Array ToArray(Type type) { if (type==null) throw new ArgumentNullException(nameof(type)); diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Comparer.cs b/src/coreclr/src/mscorlib/src/System/Collections/Comparer.cs index d905a6e..0e3c78b 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Comparer.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Comparer.cs @@ -83,7 +83,6 @@ namespace System.Collections { throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable")); } - [System.Security.SecurityCritical] // auto-generated_required public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs index 65061c7..5872874 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs @@ -72,7 +72,6 @@ namespace System.Collections.Generic } } - [System.Security.SecuritySafeCritical] // auto-generated private static IArraySortHelper CreateArraySortHelper() { if (typeof(IComparable).IsAssignableFrom(typeof(T))) @@ -689,7 +688,6 @@ namespace System.Collections.Generic } } - [System.Security.SecuritySafeCritical] // auto-generated private static IArraySortHelper CreateArraySortHelper() { if (typeof(IComparable).IsAssignableFrom(typeof(TKey))) diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Comparer.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Comparer.cs index 6e65daf..481b3e1 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Comparer.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Comparer.cs @@ -42,7 +42,6 @@ namespace System.Collections.Generic // Note that logic in this method is replicated in vm\compile.cpp to ensure that NGen // saves the right instantiations // - [System.Security.SecuritySafeCritical] // auto-generated private static Comparer CreateComparer() { object result = null; @@ -216,7 +215,6 @@ namespace System.Collections.Generic public override int GetHashCode() => GetType().GetHashCode(); - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { // Previously Comparer was not specialized for enums, @@ -252,7 +250,6 @@ namespace System.Collections.Generic public override int GetHashCode() => GetType().GetHashCode(); - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { info.SetType(typeof(ObjectComparer)); @@ -284,7 +281,6 @@ namespace System.Collections.Generic public override int GetHashCode() => GetType().GetHashCode(); - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { info.SetType(typeof(ObjectComparer)); @@ -316,7 +312,6 @@ namespace System.Collections.Generic public override int GetHashCode() => GetType().GetHashCode(); - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { info.SetType(typeof(ObjectComparer)); diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs index 2bbe7f9..f5dafc0 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs @@ -302,7 +302,6 @@ namespace System.Collections.Generic { return new Enumerator(this, Enumerator.KeyValuePair); } - [System.Security.SecurityCritical] // auto-generated_required public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.info); diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs index 8fd2548..a14125a 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs @@ -32,7 +32,6 @@ namespace System.Collections.Generic // Note that logic in this method is replicated in vm\compile.cpp to ensure that NGen // saves the right instantiations // - [System.Security.SecuritySafeCritical] // auto-generated private static EqualityComparer CreateComparer() { Contract.Ensures(Contract.Result>() != null); @@ -337,7 +336,6 @@ namespace System.Collections.Generic return b.GetHashCode(); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe override int IndexOf(byte[] array, byte value, int startIndex, int count) { if (array==null) throw new ArgumentNullException(nameof(array)); @@ -391,7 +389,6 @@ namespace System.Collections.Generic // This is used by the serialization engine. protected EnumEqualityComparer(SerializationInfo information, StreamingContext context) { } - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { // For back-compat we need to serialize the comparers for enums with underlying types other than int as ObjectEqualityComparer if (Type.GetTypeCode(Enum.GetUnderlyingType(typeof(T))) != TypeCode.Int32) { @@ -489,7 +486,6 @@ namespace System.Collections.Generic // This is used by the serialization engine. public LongEnumEqualityComparer(SerializationInfo information, StreamingContext context) { } - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { // The LongEnumEqualityComparer does not exist on 4.0 so we need to serialize this comparer as ObjectEqualityComparer @@ -552,14 +548,12 @@ namespace System.Collections.Generic } [Pure] - [SecuritySafeCritical] public int GetHashCode(String obj) { if(obj == null) return 0; return String.InternalMarvin32HashString(obj, obj.Length, _entropy); } [Pure] - [SecuritySafeCritical] public int GetHashCode(Object obj) { if(obj == null) return 0; @@ -611,7 +605,6 @@ namespace System.Collections.Generic } [Pure] - [SecuritySafeCritical] public int GetHashCode(Object obj) { if(obj == null) return 0; diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Hashtable.cs b/src/coreclr/src/mscorlib/src/System/Collections/Hashtable.cs index 930e1be..d74991e 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Hashtable.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Hashtable.cs @@ -1058,7 +1058,6 @@ namespace System.Collections { // The ISerializable Implementation // - [System.Security.SecurityCritical] public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); @@ -1314,7 +1313,6 @@ namespace System.Collections { ** context -- the StreamingContext for the current serialization (ignored) **Exceptions: ArgumentNullException if info is null. ==============================================================================*/ - [System.Security.SecurityCritical] // auto-generated public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Convert.cs b/src/coreclr/src/mscorlib/src/System/Convert.cs index 50ebba0..055911d 100644 --- a/src/coreclr/src/mscorlib/src/System/Convert.cs +++ b/src/coreclr/src/mscorlib/src/System/Convert.cs @@ -1129,7 +1129,6 @@ namespace System { throw new OverflowException(Environment.GetResourceString("Overflow_Int32")); } - [System.Security.SecuritySafeCritical] // auto-generated public static int ToInt32(decimal value) { return Decimal.FCallToInt32(value); } @@ -2114,7 +2113,6 @@ namespace System { } // Convert the byte value to a string in base fromBase - [System.Security.SecuritySafeCritical] // auto-generated public static String ToString (byte value, int toBase) { if (toBase!=2 && toBase!=8 && toBase!=10 && toBase!=16) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase")); @@ -2124,7 +2122,6 @@ namespace System { } // Convert the Int16 value to a string in base fromBase - [System.Security.SecuritySafeCritical] // auto-generated public static String ToString (short value, int toBase) { if (toBase!=2 && toBase!=8 && toBase!=10 && toBase!=16) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase")); @@ -2134,7 +2131,6 @@ namespace System { } // Convert the Int32 value to a string in base toBase - [System.Security.SecuritySafeCritical] // auto-generated public static String ToString (int value, int toBase) { if (toBase!=2 && toBase!=8 && toBase!=10 && toBase!=16) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase")); @@ -2144,7 +2140,6 @@ namespace System { } // Convert the Int64 value to a string in base toBase - [System.Security.SecuritySafeCritical] // auto-generated public static String ToString (long value, int toBase) { if (toBase!=2 && toBase!=8 && toBase!=10 && toBase!=16) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase")); @@ -2176,7 +2171,6 @@ namespace System { return ToBase64String(inArray, offset, length, Base64FormattingOptions.None); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(false)] public static unsafe String ToBase64String(byte[] inArray, int offset, int length, Base64FormattingOptions options) { //Do data verfication @@ -2223,7 +2217,6 @@ namespace System { return ToBase64CharArray(inArray, offsetIn, length, outArray, offsetOut, Base64FormattingOptions.None); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(false)] public static unsafe int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, Base64FormattingOptions options) { //Do data verfication @@ -2279,7 +2272,6 @@ namespace System { return retVal; } - [System.Security.SecurityCritical] // auto-generated private static unsafe int ConvertToBase64Array(char* outChars, byte* inData, int offset, int length, bool insertLineBreaks) { int lengthmod3 = length%3; int calcLength = offset + (length - lengthmod3); @@ -2366,7 +2358,6 @@ namespace System { /// /// The string to convert /// The array of bytes represented by the specifed Base64 string. - [SecuritySafeCritical] public static Byte[] FromBase64String(String s) { // "s" is an unfortunate parameter name, but we need to keep it for backward compat. @@ -2392,7 +2383,6 @@ namespace System { /// A position within the input array. /// Number of element to convert. /// The array of bytes represented by the specified Base64 encoding characters. - [SecuritySafeCritical] public static Byte[] FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length) { if (inArray == null) @@ -2428,7 +2418,6 @@ namespace System { /// Pointer to the first input char /// Number of input chars /// - [SecurityCritical] private static unsafe Byte[] FromBase64CharPtr(Char* inputPtr, Int32 inputLength) { // The validity of parameters much be checked by callers, thus we are Critical here. @@ -2482,7 +2471,6 @@ namespace System { /// Max length of the preallocated result buffer /// If the result buffer was not large enough to write all result bytes, return -1; /// Otherwise return the number of result bytes actually produced. - [SecurityCritical] private static unsafe Int32 FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) { // You may find this method weird to look at. It’s written for performance, not aesthetics. @@ -2662,7 +2650,6 @@ namespace System { /// Walk the entire input counting white spaces and padding chars, then compute result length /// based on 3 bytes per 4 chars. /// - [SecurityCritical] private static unsafe Int32 FromBase64_ComputeResultLength(Char* inputPtr, Int32 inputLength) { const UInt32 intEq = (UInt32) '='; diff --git a/src/coreclr/src/mscorlib/src/System/Currency.cs b/src/coreclr/src/mscorlib/src/System/Currency.cs index d29ad24..05a0980 100644 --- a/src/coreclr/src/mscorlib/src/System/Currency.cs +++ b/src/coreclr/src/mscorlib/src/System/Currency.cs @@ -46,7 +46,6 @@ namespace System { // Converts a Currency to a Decimal. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal ToDecimal(Currency c) { Decimal result = new Decimal (); @@ -54,7 +53,6 @@ namespace System { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallToDecimal(ref Decimal result,Currency c); } diff --git a/src/coreclr/src/mscorlib/src/System/DBNull.cs b/src/coreclr/src/mscorlib/src/System/DBNull.cs index 130366d..6f80af7 100644 --- a/src/coreclr/src/mscorlib/src/System/DBNull.cs +++ b/src/coreclr/src/mscorlib/src/System/DBNull.cs @@ -26,7 +26,6 @@ namespace System { public static readonly DBNull Value = new DBNull(); - [System.Security.SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.NullUnity, null, null); } diff --git a/src/coreclr/src/mscorlib/src/System/DateTime.cs b/src/coreclr/src/mscorlib/src/System/DateTime.cs index 4b4570f..a650ae6 100644 --- a/src/coreclr/src/mscorlib/src/System/DateTime.cs +++ b/src/coreclr/src/mscorlib/src/System/DateTime.cs @@ -558,13 +558,11 @@ namespace System { #if !FEATURE_CORECLR [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool LegacyParseMode(); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool EnableAmPmParseAdjustment(); @@ -912,7 +910,6 @@ namespace System { } public static DateTime UtcNow { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result().Kind == DateTimeKind.Utc); // following code is tuned for speed. Don't change it without running benchmark. @@ -924,7 +921,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern long GetSystemTimeAsFileTime(); diff --git a/src/coreclr/src/mscorlib/src/System/DateTimeOffset.cs b/src/coreclr/src/mscorlib/src/System/DateTimeOffset.cs index 40efcaf..fedc5f9 100644 --- a/src/coreclr/src/mscorlib/src/System/DateTimeOffset.cs +++ b/src/coreclr/src/mscorlib/src/System/DateTimeOffset.cs @@ -513,7 +513,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Decimal.cs b/src/coreclr/src/mscorlib/src/System/Decimal.cs index 0fb2bd1..fd16697 100644 --- a/src/coreclr/src/mscorlib/src/System/Decimal.cs +++ b/src/coreclr/src/mscorlib/src/System/Decimal.cs @@ -206,13 +206,11 @@ namespace System { // Constructs a Decimal from a float value. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern Decimal(float value); // Constructs a Decimal from a double value. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern Decimal(double value); @@ -335,7 +333,6 @@ namespace System { // Adds two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Add(Decimal d1, Decimal d2) { FCallAddSub (ref d1, ref d2, DECIMAL_ADD); @@ -346,11 +343,9 @@ namespace System { // of the operation. Passing in DECIMAL_ADD or DECIMAL_NEG for bSign indicates // addition or subtraction, respectively. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallAddSub(ref Decimal d1, ref Decimal d2, byte bSign); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallAddSubOverflowed(ref Decimal d1, ref Decimal d2, byte bSign, ref bool overflowed); @@ -363,13 +358,11 @@ namespace System { // Compares two Decimal values, returning an integer that indicates their // relationship. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int Compare(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern int FCallCompare(ref Decimal d1, ref Decimal d2); @@ -380,7 +373,6 @@ namespace System { // null is considered to be less than any instance. // If object is not of type Decimal, this method throws an ArgumentException. // - [System.Security.SecuritySafeCritical] // auto-generated public int CompareTo(Object value) { if (value == null) @@ -392,7 +384,6 @@ namespace System { return FCallCompare(ref this, ref other); } - [System.Security.SecuritySafeCritical] // auto-generated public int CompareTo(Decimal value) { return FCallCompare(ref this, ref value); @@ -400,7 +391,6 @@ namespace System { // Divides two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Divide(Decimal d1, Decimal d2) { FCallDivide (ref d1, ref d2); @@ -410,11 +400,9 @@ namespace System { // FCallDivide divides two decimal values. On return, d1 contains the result // of the operation. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallDivide(ref Decimal d1, ref Decimal d2); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallDivideOverflowed(ref Decimal d1, ref Decimal d2, ref bool overflowed); @@ -423,7 +411,6 @@ namespace System { // if the given object is a boxed Decimal and its value is equal to the // value of this Decimal. Returns false otherwise. // - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(Object value) { if (value is Decimal) { Decimal other = (Decimal)value; @@ -432,7 +419,6 @@ namespace System { return false; } - [System.Security.SecuritySafeCritical] // auto-generated public bool Equals(Decimal value) { return FCallCompare(ref this, ref value) == 0; @@ -440,14 +426,12 @@ namespace System { // Returns the hash code for this Decimal. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override int GetHashCode(); // Compares two Decimal values for equality. Returns true if the two // Decimal values are equal, or false if they are not equal. // - [System.Security.SecuritySafeCritical] // auto-generated public static bool Equals(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } @@ -455,14 +439,12 @@ namespace System { // Rounds a Decimal to an integer value. The Decimal argument is rounded // towards negative infinity. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Floor(Decimal d) { FCallFloor (ref d); return d; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallFloor(ref Decimal d); @@ -471,25 +453,21 @@ namespace System { // optionally followed by a decimal point (".") and another sequence of // digits. // - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatDecimal(this, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatDecimal(this, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatDecimal(this, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatDecimal(this, format, NumberFormatInfo.GetInstance(provider)); @@ -650,7 +628,6 @@ namespace System { // Returns the larger of two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static Decimal Max(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) >= 0? d1: d2; @@ -658,7 +635,6 @@ namespace System { // Returns the smaller of two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static Decimal Min(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) < 0? d1: d2; @@ -709,7 +685,6 @@ namespace System { // Multiplies two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Multiply(Decimal d1, Decimal d2) { FCallMultiply (ref d1, ref d2); @@ -719,11 +694,9 @@ namespace System { // FCallMultiply multiples two decimal values. On return, d1 contains the result // of the operation. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallMultiply(ref Decimal d1, ref Decimal d2); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallMultiplyOverflowed(ref Decimal d1, ref Decimal d2, ref bool overflowed); @@ -746,7 +719,6 @@ namespace System { return Round(d, 0); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Round(Decimal d, int decimals) { FCallRound (ref d, decimals); @@ -757,7 +729,6 @@ namespace System { return Round(d, 0, mode); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Round(Decimal d, int decimals, MidpointRounding mode) { if ((decimals < 0) || (decimals > 28)) throw new ArgumentOutOfRangeException(nameof(decimals), Environment.GetResourceString("ArgumentOutOfRange_DecimalRound")); @@ -775,13 +746,11 @@ namespace System { return d; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallRound(ref Decimal d, int decimals); // Subtracts two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Subtract(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); @@ -843,7 +812,6 @@ namespace System { // has fewer significant digits than a Decimal, this operation may // produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated internal static Currency ToCurrency(Decimal d) { Currency result = new Currency (); @@ -851,18 +819,15 @@ namespace System { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallToCurrency(ref Currency result, Decimal d); // Converts a Decimal to a double. Since a double has fewer significant // digits than a Decimal, this operation may produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double ToDouble(Decimal d); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int FCallToInt32(Decimal d); @@ -870,7 +835,6 @@ namespace System { // zero to the nearest integer value, and the result of this operation is // returned as an integer. // - [System.Security.SecuritySafeCritical] // auto-generated public static int ToInt32(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); if (d.hi == 0 && d.mid == 0) { @@ -890,7 +854,6 @@ namespace System { // to the nearest integer value, and the result of this operation is // returned as a long. // - [System.Security.SecuritySafeCritical] // auto-generated public static long ToInt64(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); if (d.hi == 0) { @@ -927,7 +890,6 @@ namespace System { // value is rounded towards zero to the nearest integer value, and the // result of this operation is returned as an unsigned integer. // - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public static uint ToUInt32(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); @@ -943,7 +905,6 @@ namespace System { // value is rounded towards zero to the nearest integer value, and the // result of this operation is returned as a long. // - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public static ulong ToUInt64(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); @@ -958,7 +919,6 @@ namespace System { // Converts a Decimal to a float. Since a float has fewer significant // digits than a Decimal, this operation may produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float ToSingle(Decimal d); @@ -966,7 +926,6 @@ namespace System { // towards zero to the nearest integer value, corresponding to removing all // digits after the decimal point. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Truncate(Decimal d) { FCallTruncate (ref d); @@ -974,7 +933,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallTruncate(ref Decimal d); @@ -1099,25 +1057,21 @@ namespace System { return Subtract(d, One); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator +(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_ADD); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator -(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator *(Decimal d1, Decimal d2) { FCallMultiply (ref d1, ref d2); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator /(Decimal d1, Decimal d2) { FCallDivide (ref d1, ref d2); return d1; @@ -1127,32 +1081,26 @@ namespace System { return Remainder(d1, d2); } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator ==(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator !=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) != 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator <(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) < 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator <=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) <= 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator >(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) > 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator >=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) >= 0; } diff --git a/src/coreclr/src/mscorlib/src/System/DefaultBinder.cs b/src/coreclr/src/mscorlib/src/System/DefaultBinder.cs index de0433d..248148a 100644 --- a/src/coreclr/src/mscorlib/src/System/DefaultBinder.cs +++ b/src/coreclr/src/mscorlib/src/System/DefaultBinder.cs @@ -33,7 +33,6 @@ namespace System { // // The most specific match will be selected. // - [System.Security.SecuritySafeCritical] // auto-generated public override MethodBase BindToMethod( BindingFlags bindingAttr, MethodBase[] match, ref Object[] args, ParameterModifier[] modifiers, CultureInfo cultureInfo, String[] names, out Object state) @@ -437,7 +436,6 @@ namespace System { // Given a set of fields that match the base criteria, select a field. // if value is null then we have no way to select a field - [System.Security.SecuritySafeCritical] // auto-generated public override FieldInfo BindToField(BindingFlags bindingAttr,FieldInfo[] match, Object value,CultureInfo cultureInfo) { if (match == null) { @@ -514,7 +512,6 @@ namespace System { // Given a set of methods that match the base criteria, select a method based // upon an array of types. This method should return null if no method matchs // the criteria. - [System.Security.SecuritySafeCritical] // auto-generated public override MethodBase SelectMethod(BindingFlags bindingAttr,MethodBase[] match,Type[] types,ParameterModifier[] modifiers) { int i; @@ -589,7 +586,6 @@ namespace System { } // Given a set of properties that match the base criteria, select one. - [System.Security.SecuritySafeCritical] // auto-generated public override PropertyInfo SelectProperty(BindingFlags bindingAttr,PropertyInfo[] match,Type returnType, Type[] indexes,ParameterModifier[] modifiers) { @@ -876,7 +872,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated private static int FindMostSpecificType(Type c1, Type c2, Type t) { // If the two types are exact move on... @@ -1084,14 +1079,12 @@ namespace System { // CanConvertPrimitive // This will determine if the source can be converted to the target type - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool CanConvertPrimitive(RuntimeType source,RuntimeType target); // CanConvertPrimitiveObjectToType // This method will determine if the primitive object can be converted // to a type. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern bool CanConvertPrimitiveObjectToType(Object source,RuntimeType type); diff --git a/src/coreclr/src/mscorlib/src/System/Delegate.cs b/src/coreclr/src/mscorlib/src/System/Delegate.cs index 347607f..f0961ec 100644 --- a/src/coreclr/src/mscorlib/src/System/Delegate.cs +++ b/src/coreclr/src/mscorlib/src/System/Delegate.cs @@ -20,29 +20,24 @@ namespace System { public abstract class Delegate : ICloneable, ISerializable { // _target is the object we will invoke on - [System.Security.SecurityCritical] internal Object _target; // MethodBase, either cached after first request or assigned from a DynamicMethod // For open delegates to collectible types, this may be a LoaderAllocator object - [System.Security.SecurityCritical] internal Object _methodBase; // _methodPtr is a pointer to the method we will invoke // It could be a small thunk if this is a static or UM call - [System.Security.SecurityCritical] internal IntPtr _methodPtr; // In the case of a static method passed to a delegate, this field stores // whatever _methodPtr would have stored: and _methodPtr points to a // small thunk which removes the "this" pointer before going on // to _methodPtrAux. - [System.Security.SecurityCritical] internal IntPtr _methodPtrAux; // This constructor is called from the class generated by the // compiler generated code - [System.Security.SecuritySafeCritical] // auto-generated protected Delegate(Object target,String method) { if (target == null) @@ -67,7 +62,6 @@ namespace System { // This constructor is called from a class to generate a // delegate based upon a static method name and the Type object // for the class defining the method. - [System.Security.SecuritySafeCritical] // auto-generated protected unsafe Delegate(Type target,String method) { if (target == null) @@ -113,7 +107,6 @@ namespace System { return DynamicInvokeImpl(args); } - [System.Security.SecuritySafeCritical] // auto-generated protected virtual object DynamicInvokeImpl(object[] args) { RuntimeMethodHandleInternal method = new RuntimeMethodHandleInternal(GetInvokeMethod()); @@ -123,7 +116,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(Object obj) { if (obj == null || !InternalEqualTypes(this, obj)) @@ -227,7 +219,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated protected virtual MethodInfo GetMethodImpl() { if ((_methodBase == null) || !(_methodBase is MethodInfo)) @@ -292,7 +283,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated public static Delegate Remove(Delegate source, Delegate value) { if (source == null) @@ -350,7 +340,6 @@ namespace System { } // V1 API. - [System.Security.SecuritySafeCritical] // auto-generated public static Delegate CreateDelegate(Type type, Object target, String method, bool ignoreCase, bool throwOnBindFailure) { if (type == null) @@ -402,7 +391,6 @@ namespace System { } // V1 API. - [System.Security.SecuritySafeCritical] // auto-generated public static Delegate CreateDelegate(Type type, Type target, String method, bool ignoreCase, bool throwOnBindFailure) { if (type == null) @@ -443,7 +431,6 @@ namespace System { } // V1 API. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Delegate CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure) { @@ -494,7 +481,6 @@ namespace System { } // V2 API. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Delegate CreateDelegate(Type type, Object firstArgument, MethodInfo method, bool throwOnBindFailure) { @@ -555,7 +541,6 @@ namespace System { // Implementation of ISerializable // - [System.Security.SecurityCritical] public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotSupportedException(); @@ -566,7 +551,6 @@ namespace System { // V2 internal API. // This is Critical because it skips the security check when creating the delegate. - [System.Security.SecurityCritical] // auto-generated internal unsafe static Delegate CreateDelegateNoSecurityCheck(Type type, Object target, RuntimeMethodHandle method) { // Validate the parameters. @@ -600,7 +584,6 @@ namespace System { } // Caution: this method is intended for deserialization only, no security checks are performed. - [System.Security.SecurityCritical] // auto-generated internal static Delegate CreateDelegateNoSecurityCheck(RuntimeType type, Object firstArgument, MethodInfo method) { // Validate the parameters. @@ -642,7 +625,6 @@ namespace System { return CreateDelegate(type, method, true); } - [System.Security.SecuritySafeCritical] internal static Delegate CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, Object firstArgument, DelegateBindingFlags flags, ref StackCrawlMark stackMark) { Contract.Assert((flags & DelegateBindingFlags.SkipSecurityChecks) == 0); @@ -663,7 +645,6 @@ namespace System { return UnsafeCreateDelegate(rtType, rtMethod, firstArgument, flags); } - [System.Security.SecurityCritical] internal static Delegate UnsafeCreateDelegate(RuntimeType rtType, RuntimeMethodInfo rtMethod, Object firstArgument, DelegateBindingFlags flags) { Delegate d = InternalAlloc(rtType); @@ -678,62 +659,49 @@ namespace System { // internal implementation details (FCALLS and utilities) // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool BindToMethodName(Object target, RuntimeType methodType, String method, DelegateBindingFlags flags); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool BindToMethodInfo(Object target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static MulticastDelegate InternalAlloc(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static MulticastDelegate InternalAllocLike(Delegate d); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool InternalEqualTypes(object a, object b); // Used by the ctor. Do not call directly. // The name of this function will appear in managed stacktraces as delegate constructor. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void DelegateConstruct(Object target, IntPtr slot); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetMulticastInvoke(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetInvokeMethod(); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IRuntimeMethodInfo FindMethodHandle(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool InternalEqualMethodHandles(Delegate left, Delegate right); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr AdjustTarget(Object target, IntPtr methodPtr); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetCallStub(IntPtr methodPtr); - [System.Security.SecuritySafeCritical] internal virtual Object GetTarget() { return (_methodPtrAux.IsNull()) ? _target : null; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool CompareUnmanagedFunctionPtrs (Delegate d1, Delegate d2); } diff --git a/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs b/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs index 39a95e9..83fe35a 100644 --- a/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs @@ -17,7 +17,6 @@ namespace System internal sealed class DelegateSerializationHolder : IObjectReference, ISerializable { #region Static Members - [System.Security.SecurityCritical] // auto-generated internal static DelegateEntry GetDelegateSerializationInfo( SerializationInfo info, Type delegateType, Object target, MethodInfo method, int targetIndex) { @@ -116,7 +115,6 @@ namespace System #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated private DelegateSerializationHolder(SerializationInfo info, StreamingContext context) { if (info == null) @@ -195,7 +193,6 @@ namespace System return new DelegateEntry(delegateType, delegateAssembly, target, targetTypeAssembly, targetTypeName, methodName); } - [System.Security.SecurityCritical] private Delegate GetDelegate(DelegateEntry de, int index) { Delegate d; @@ -251,7 +248,6 @@ namespace System #endregion #region IObjectReference - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { int count = 0; @@ -281,7 +277,6 @@ namespace System #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DelegateSerHolderSerial")); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs index 40efe75..2cc84ea 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs @@ -59,7 +59,6 @@ namespace System.Diagnostics { Fail(conditionString, message, null, exitCode, stackTraceFormat, 0); } - [System.Security.SecuritySafeCritical] // auto-generated internal static void Fail(String conditionString, String message, String windowTitle, int exitCode, StackTrace.TraceFormat stackTraceFormat, int numStackFramesToSkip) { // get the stacktrace @@ -107,7 +106,6 @@ namespace System.Diagnostics { // Called when an assert happens. // windowTitle can be null. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int ShowDefaultAssertDialog(String conditionString, String message, String stackTrace, String windowTitle); } diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/AssertFilter.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/AssertFilter.cs index b441fc3..ab60ee4 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/AssertFilter.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/AssertFilter.cs @@ -33,7 +33,6 @@ namespace System.Diagnostics { { } - [System.Security.SecuritySafeCritical] // auto-generated public override AssertFilters AssertFailure(String condition, String message, StackTrace location, StackTrace.TraceFormat stackTraceFormat, String windowTitle) diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs index 057d40f..0e0005c 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs @@ -805,7 +805,6 @@ namespace System.Diagnostics.Contracts { [CLSCompliant(false)] [Pure] [ContractRuntimeIgnored] - [SecurityCritical] #if FEATURE_RELIABILITY_CONTRACTS [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif @@ -852,7 +851,6 @@ namespace System.Diagnostics.Contracts { [CLSCompliant(false)] [Pure] [ContractRuntimeIgnored] - [SecurityCritical] #if FEATURE_RELIABILITY_CONTRACTS [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs index 75a85fe..d5e3f29 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs @@ -51,7 +51,6 @@ namespace System.Diagnostics.Contracts { /// This method is used internally to trigger a failure indicating to the "programmer" that he is using the interface incorrectly. /// It is NEVER used to indicate failure of actual contracts at runtime. /// - [SecuritySafeCritical] static partial void AssertMustUseRewriter(ContractFailureKind kind, String contractKind) { if (_assertingMustUseRewriter) @@ -121,18 +120,14 @@ namespace System.Diagnostics.Contracts { /// public static event EventHandler ContractFailed { #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #if FEATURE_LINK_DEMAND - [SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)] #endif #endif add { System.Runtime.CompilerServices.ContractHelper.InternalContractFailed += value; } #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #if FEATURE_LINK_DEMAND - [SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)] #endif #endif remove { @@ -176,9 +171,7 @@ namespace System.Diagnostics.Contracts { } #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #if FEATURE_LINK_DEMAND - [SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)] #endif #endif public void SetHandled() @@ -191,9 +184,7 @@ namespace System.Diagnostics.Contracts { } #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #if FEATURE_LINK_DEMAND - [SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)] #endif #endif public void SetUnwind() @@ -243,9 +234,7 @@ namespace System.Diagnostics.Contracts { } #if FEATURE_UNTRUSTED_CALLERS && FEATURE_SERIALIZATION - [SecurityCritical] #if FEATURE_LINK_DEMAND && FEATURE_SERIALIZATION - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] #endif // FEATURE_LINK_DEMAND #endif // FEATURE_UNTRUSTED_CALLERS public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) @@ -284,7 +273,6 @@ namespace System.Runtime.CompilerServices internal static event EventHandler InternalContractFailed { #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #endif add { // Eagerly prepare each event handler _marked with a reliability contract_, to @@ -301,7 +289,6 @@ namespace System.Runtime.CompilerServices } } #if FEATURE_UNTRUSTED_CALLERS - [SecurityCritical] #endif remove { lock (lockObject) @@ -326,7 +313,6 @@ namespace System.Runtime.CompilerServices [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] [System.Diagnostics.DebuggerNonUserCode] #if FEATURE_RELIABILITY_CONTRACTS - [SecuritySafeCritical] #endif static partial void RaiseContractFailedEventImplementation(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException, ref string resultFailureMessage) { diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Debugger.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Debugger.cs index 339c89e..8ebbc0a 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Debugger.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Debugger.cs @@ -32,7 +32,6 @@ namespace System.Diagnostics // Break causes a breakpoint to be signalled to an attached debugger. If no debugger // is attached, the user is asked if he wants to attach a debugger. If yes, then the // debugger is launched. - [System.Security.SecuritySafeCritical] // auto-generated public static void Break() { if (!Debugger.IsAttached) @@ -61,7 +60,6 @@ namespace System.Diagnostics BreakInternal(); } - [System.Security.SecuritySafeCritical] // auto-generated static void BreakCanThrow() { if (!Debugger.IsAttached) @@ -75,14 +73,12 @@ namespace System.Diagnostics BreakInternal(); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void BreakInternal(); // Launch launches & attaches a debugger to the process. If a debugger is already attached, // nothing happens. // - [System.Security.SecuritySafeCritical] // auto-generated public static bool Launch() { if (Debugger.IsAttached) @@ -147,7 +143,6 @@ namespace System.Diagnostics } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool LaunchInternal(); @@ -155,7 +150,6 @@ namespace System.Diagnostics // public static extern bool IsAttached { - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } @@ -173,20 +167,17 @@ namespace System.Diagnostics // Posts a message for the attached debugger. If there is no // debugger attached, has no effect. The debugger may or may not // report the message depending on its settings. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void Log(int level, String category, String message); // Checks to see if an attached debugger has logging enabled // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool IsLogging(); // Posts a custom notification for the attached debugger. If there is no // debugger attached, has no effect. The debugger may or may not // report the notification depending on its settings. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void CustomNotification(ICustomDebuggerNotification data); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs index a7124a2..64906f1 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs @@ -221,7 +221,6 @@ namespace System.Diagnostics.Tracing /// /// Turns on activity tracking. It is sticky, once on it stays on (race issues otherwise) /// - [System.Security.SecuritySafeCritical] public void Enable() { if (m_current == null) @@ -366,7 +365,6 @@ namespace System.Diagnostics.Tracing /// byte (since the top nibble can't be zero you can determine if this is true by seeing if /// this byte is nonZero. This offset is needed to efficiently create the ID for child activities. /// - [System.Security.SecuritySafeCritical] private unsafe void CreateActivityPathGuid(out Guid idRet, out int activityPathGuidOffset) { fixed (Guid* outPtr = &idRet) @@ -403,7 +401,6 @@ namespace System.Diagnostics.Tracing /// sufficient space for this ID. By doing this, we preserve the fact that this activity /// is a child (of unknown depth) from that ancestor. /// - [System.Security.SecurityCritical] private unsafe void CreateOverflowGuid(Guid* outPtr) { // Search backwards for an ancestor that has sufficient space to put the ID. @@ -452,7 +449,6 @@ namespace System.Diagnostics.Tracing /// is the maximum number of bytes that fit in a GUID) if the path did not fit. /// If 'overflow' is true, then the number is encoded as an 'overflow number (which has a /// special (longer prefix) that indicates that this ID is allocated differently - [System.Security.SecurityCritical] private static unsafe int AddIdToGuid(Guid* outPtr, int whereToAddId, uint id, bool overflow = false) { byte* ptr = (byte*)outPtr; @@ -526,7 +522,6 @@ namespace System.Diagnostics.Tracing /// Thus if it is non-zero it adds to the current byte, otherwise it advances and writes /// the new byte (in the high bits) of the next byte. /// - [System.Security.SecurityCritical] private static unsafe void WriteNibble(ref byte* ptr, byte* endPtr, uint value) { Contract.Assert(0 <= value && value < 16); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs index c7e1292..545e3e6 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs @@ -74,7 +74,6 @@ namespace System.Diagnostics.Tracing private static bool m_setInformationMissing; - [SecurityCritical] UnsafeNativeMethods.ManifestEtw.EtwEnableCallback m_etwCallback; // Trace Callback function private long m_regHandle; // Trace Registration Handle private byte m_level; // Tracing Level @@ -128,7 +127,6 @@ namespace System.Diagnostics.Tracing // // // - [System.Security.SecurityCritical] internal unsafe void Register(Guid providerGuid) { m_providerId = providerGuid; @@ -157,7 +155,6 @@ namespace System.Diagnostics.Tracing // // // - [System.Security.SecuritySafeCritical] protected virtual void Dispose(bool disposing) { // @@ -220,7 +217,6 @@ namespace System.Diagnostics.Tracing // // // - [System.Security.SecurityCritical] unsafe void EtwEnableCallBack( [In] ref System.Guid sourceId, [In] int controlCode, @@ -341,7 +337,6 @@ namespace System.Diagnostics.Tracing /// ETW session that was added or remove, and the bool specifies whether the /// session was added or whether it was removed from the set. /// - [System.Security.SecuritySafeCritical] private List> GetSessions() { List liveSessionList = null; @@ -417,7 +412,6 @@ namespace System.Diagnostics.Tracing /// for the current process ID, calling 'action' for each session, and passing it the /// ETW session and the 'AllKeywords' the session enabled for the current provider. /// - [System.Security.SecurityCritical] private unsafe void GetSessionInfo(Action action) { // We wish the EventSource package to be legal for Windows Store applications. @@ -545,7 +539,6 @@ namespace System.Diagnostics.Tracing /// returns an array of bytes representing the data, the index into that byte array where the data /// starts, and the command being issued associated with that data. /// - [System.Security.SecurityCritical] private unsafe bool GetDataFromController(int etwSessionId, UnsafeNativeMethods.ManifestEtw.EVENT_FILTER_DESCRIPTOR* filterData, out ControllerCommand command, out byte[] data, out int dataStart) { @@ -678,7 +671,6 @@ namespace System.Diagnostics.Tracing // // // - [System.Security.SecurityCritical] private static unsafe object EncodeObject(ref object data, ref EventData* dataDescriptor, ref byte* dataBuffer, ref uint totalEventSize) /*++ @@ -927,7 +919,6 @@ namespace System.Diagnostics.Tracing // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Performance-critical code")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] - [System.Security.SecurityCritical] internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, Guid* activityID, Guid* childActivityID, params object[] eventPayload) { int status = 0; @@ -1124,7 +1115,6 @@ namespace System.Diagnostics.Tracing // // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] - [System.Security.SecurityCritical] internal unsafe protected bool WriteEvent(ref EventDescriptor eventDescriptor, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data) { if (childActivityID != null) @@ -1147,7 +1137,6 @@ namespace System.Diagnostics.Tracing } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] - [System.Security.SecurityCritical] internal unsafe bool WriteEventRaw( ref EventDescriptor eventDescriptor, Guid* activityID, @@ -1176,7 +1165,6 @@ namespace System.Diagnostics.Tracing // These are look-alikes to the Manifest based ETW OS APIs that have been shimmed to work // either with Manifest ETW or Classic ETW (if Manifest based ETW is not available). - [SecurityCritical] private unsafe uint EventRegister(ref Guid providerId, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback) { m_providerId = providerId; @@ -1184,7 +1172,6 @@ namespace System.Diagnostics.Tracing return UnsafeNativeMethods.ManifestEtw.EventRegister(ref providerId, enableCallback, null, ref m_regHandle); } - [SecurityCritical] private uint EventUnregister(long registrationHandle) { return UnsafeNativeMethods.ManifestEtw.EventUnregister(registrationHandle); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs index 3bfcf52..2973b06 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs @@ -529,7 +529,6 @@ namespace System.Diagnostics.Tracing /// internal static Guid InternalCurrentThreadActivityId { - [System.Security.SecurityCritical] get { Guid retval = CurrentThreadActivityId; @@ -543,7 +542,6 @@ namespace System.Diagnostics.Tracing internal static Guid FallbackActivityId { - [System.Security.SecurityCritical] get { #pragma warning disable 612, 618 @@ -714,7 +712,6 @@ namespace System.Diagnostics.Tracing #pragma warning disable 1591 // optimized for common signatures (no args) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId) { @@ -722,7 +719,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (ints) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, int arg1) { @@ -735,7 +731,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, int arg1, int arg2) { @@ -750,7 +745,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3) { @@ -768,7 +762,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (longs) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, long arg1) { @@ -781,7 +774,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, long arg1, long arg2) { @@ -796,7 +788,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, long arg1, long arg2, long arg3) { @@ -814,7 +805,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (strings) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1) { @@ -831,7 +821,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1, string arg2) { @@ -852,7 +841,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1, string arg2, string arg3) { @@ -878,7 +866,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (string and ints) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1, int arg2) { @@ -897,7 +884,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1, int arg2, int arg3) { @@ -919,7 +905,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (string and longs) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, string arg1, long arg2) { @@ -939,7 +924,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (long and string) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, long arg1, string arg2) { @@ -959,7 +943,6 @@ namespace System.Diagnostics.Tracing } // optimized for common signatures (int and string) - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, int arg1, string arg2) { @@ -978,7 +961,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, byte[] arg1) { @@ -1009,7 +991,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, long arg1, byte[] arg2) { @@ -1067,7 +1048,6 @@ namespace System.Diagnostics.Tracing /// Pinned tracelogging-compatible metadata blob. /// The size of the metadata blob. /// Value for reserved: 2 for per-provider metadata, 1 for per-event metadata - [SecurityCritical] internal unsafe void SetMetadata(byte* pointer, int size, int reserved) { this.m_Ptr = (long)(ulong)(UIntPtr)pointer; @@ -1109,7 +1089,6 @@ namespace System.Diagnostics.Tracing /// } /// /// - [SecurityCritical] [CLSCompliant(false)] protected unsafe void WriteEventCore(int eventId, int eventDataCount, EventSource.EventData* data) { @@ -1141,7 +1120,6 @@ namespace System.Diagnostics.Tracing /// } /// /// - [SecurityCritical] [CLSCompliant(false)] protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, Guid* relatedActivityId, int eventDataCount, EventSource.EventData* data) { @@ -1299,7 +1277,6 @@ namespace System.Diagnostics.Tracing /// method signature. Even if you use this for rare events, this call should be guarded by an /// check so that the varargs call is not made when the EventSource is not active. /// - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] protected unsafe void WriteEvent(int eventId, params object[] args) { @@ -1314,7 +1291,6 @@ namespace System.Diagnostics.Tracing /// particular method signature. Even if you use this for rare events, this call should be guarded by an /// check so that the varargs call is not made when the EventSource is not active. /// - [SecuritySafeCritical] protected unsafe void WriteEventWithRelatedActivityId(int eventId, Guid relatedActivityId, params object[] args) { WriteEventVarargs(eventId, &relatedActivityId, args); @@ -1403,7 +1379,6 @@ namespace System.Diagnostics.Tracing } #endif - [SecurityCritical] private unsafe void WriteEventRaw( string eventName, ref EventDescriptor eventDescriptor, @@ -1445,7 +1420,6 @@ namespace System.Diagnostics.Tracing /// member, and any future access to the "Log" would throw the cached exception). /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "guid")] - [SecuritySafeCritical] private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, string[] traits) { try @@ -1744,7 +1718,6 @@ namespace System.Diagnostics.Tracing return new Guid(bytes); } - [SecurityCritical] private unsafe object DecodeObject(int eventId, int parameterId, ref EventSource.EventData* data) { // TODO FIX : We use reflection which in turn uses EventSource, right now we carefully avoid @@ -1891,7 +1864,6 @@ namespace System.Diagnostics.Tracing return dispatcher; } - [SecurityCritical] private unsafe void WriteEventVarargs(int eventId, Guid* childActivityID, object[] args) { if (m_eventSourceEnabled) @@ -2062,7 +2034,6 @@ namespace System.Diagnostics.Tracing } } - [SecurityCritical] unsafe private object[] SerializeEventArgs(int eventId, object[] args) { TraceLoggingEventTypes eventTypes = m_eventData[eventId].TraceLoggingEventTypes; @@ -2138,7 +2109,6 @@ namespace System.Diagnostics.Tracing return sum; } - [SecurityCritical] unsafe private void WriteToAllListeners(int eventId, Guid* childActivityID, int eventDataCount, EventSource.EventData* data) { // We represent a byte[] as a integer denoting the length and then a blob of bytes in the data pointer. This causes a spurious @@ -2162,7 +2132,6 @@ namespace System.Diagnostics.Tracing } // helper for writing to all EventListeners attached the current eventSource. - [SecurityCritical] unsafe private void WriteToAllListeners(int eventId, Guid* childActivityID, params object[] args) { EventWrittenEventArgs eventCallbackArgs = new EventWrittenEventArgs(this); @@ -2176,7 +2145,6 @@ namespace System.Diagnostics.Tracing DispatchToAllListeners(eventId, childActivityID, eventCallbackArgs); } - [SecurityCritical] private unsafe void DispatchToAllListeners(int eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs) { Exception lastThrownException = null; @@ -2218,7 +2186,6 @@ namespace System.Diagnostics.Tracing } } - [SecuritySafeCritical] [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")] private unsafe void WriteEventString(EventLevel level, long keywords, string msgString) { @@ -2313,7 +2280,6 @@ namespace System.Diagnostics.Tracing } #if FEATURE_ACTIVITYSAMPLING - [SecurityCritical] unsafe private SessionMask GetEtwSessionMask(int eventId, Guid* childActivityID) { SessionMask etwSessions = new SessionMask(); @@ -3025,7 +2991,6 @@ namespace System.Diagnostics.Tracing get { return m_eventSourceDisposed; } } - [SecuritySafeCritical] private void EnsureDescriptorsInitialized() { #if !ES_BUILD_STANDALONE @@ -3092,7 +3057,6 @@ namespace System.Diagnostics.Tracing // Send out the ETW manifest XML out to ETW // Today, we only send the manifest to ETW, custom listeners don't get it. - [SecuritySafeCritical] private unsafe bool SendManifest(byte[] rawManifest) { bool success = true; @@ -3824,7 +3788,6 @@ namespace System.Diagnostics.Tracing /// /// The method to probe. /// The literal value or -1 if the value could not be determined. - [SecuritySafeCritical] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Switch statement is clearer than alternatives")] static private int GetHelperCallFirstArg(MethodInfo method) { @@ -4821,7 +4784,6 @@ namespace System.Diagnostics.Tracing /// public Guid ActivityId { - [System.Security.SecurityCritical] get { return EventSource.CurrentThreadActivityId; } } @@ -4830,7 +4792,6 @@ namespace System.Diagnostics.Tracing /// public Guid RelatedActivityId { - [System.Security.SecurityCritical] get; internal set; } @@ -5435,7 +5396,6 @@ namespace System.Diagnostics.Tracing /// If 'childActivityID' is present, it will be added to the active set if the /// current activity is active. /// - [SecurityCritical] unsafe public static bool PassesActivityFilter( ActivityFilter filterList, Guid* childActivityID, @@ -5516,7 +5476,6 @@ namespace System.Diagnostics.Tracing return shouldBeLogged; } - [System.Security.SecuritySafeCritical] public static bool IsCurrentActivityActive(ActivityFilter filterList) { var activeActivities = GetActiveActivities(filterList); @@ -5533,7 +5492,6 @@ namespace System.Diagnostics.Tracing /// value for 'currentActivityid' is an indication tha caller has already verified /// that the current activity is active. /// - [SecurityCritical] unsafe public static void FlowActivityIfNeeded(ActivityFilter filterList, Guid* currentActivityId, Guid* childActivityID) { Contract.Assert(childActivityID != null); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs index 00bd0b7..0a689ef 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs @@ -29,7 +29,6 @@ namespace System.Diagnostics.Tracing /// /// A Guid that represents the new activity with which to mark /// the current thread - [System.Security.SecuritySafeCritical] public static void SetCurrentThreadActivityId(Guid activityId) { if (TplEtwProvider.Log != null) @@ -80,7 +79,6 @@ namespace System.Diagnostics.Tracing /// the current thread /// The Guid that represents the current activity /// which will continue at some point in the future, on the current thread - [System.Security.SecuritySafeCritical] public static void SetCurrentThreadActivityId(Guid activityId, out Guid oldActivityThatWillContinue) { oldActivityThatWillContinue = activityId; @@ -104,7 +102,6 @@ namespace System.Diagnostics.Tracing /// public static Guid CurrentThreadActivityId { - [System.Security.SecuritySafeCritical] get { // We ignore errors to keep with the convention that EventSources do not throw @@ -186,7 +183,6 @@ namespace System.Diagnostics.Tracing internal partial class EventProvider { - [System.Security.SecurityCritical] internal unsafe int SetInformation( UnsafeNativeMethods.ManifestEtw.EVENT_INFO_CLASS eventInfoClass, IntPtr data, diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs index d0d687e..079d7f4 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs @@ -22,7 +22,6 @@ namespace System.Diagnostics.Tracing /// EventWrite. The instance must be Disabled before the arrays referenced /// by the pointers are freed or unpinned. /// - [SecurityCritical] internal unsafe struct DataCollector { [ThreadStatic] diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs index 4b6e633..04a047f 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs @@ -21,7 +21,6 @@ namespace System.Diagnostics.Tracing /// full-trust code, this abstraction is unnecessary (though it probably /// doesn't hurt anything). /// - [SecuritySafeCritical] internal unsafe class TraceLoggingDataCollector { internal static readonly TraceLoggingDataCollector Instance = new TraceLoggingDataCollector(); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs index a34ed7b..07a5675 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs @@ -110,7 +110,6 @@ namespace System.Diagnostics.Tracing /// (Native API: EventWriteTransfer) /// /// The name of the event. Must not be null. - [SecuritySafeCritical] public unsafe void Write(string eventName) { if (eventName == null) @@ -138,7 +137,6 @@ namespace System.Diagnostics.Tracing /// Options for the event, such as the level, keywords, and opcode. Unset /// options will be set to default values. /// - [SecuritySafeCritical] public unsafe void Write(string eventName, EventSourceOptions options) { if (eventName == null) @@ -175,7 +173,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// - [SecuritySafeCritical] public unsafe void Write( string eventName, T data) @@ -212,7 +209,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// - [SecuritySafeCritical] public unsafe void Write( string eventName, EventSourceOptions options, @@ -251,7 +247,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// - [SecuritySafeCritical] public unsafe void Write( string eventName, ref EventSourceOptions options, @@ -297,7 +292,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// - [SecuritySafeCritical] public unsafe void Write( string eventName, ref EventSourceOptions options, @@ -354,7 +348,6 @@ namespace System.Diagnostics.Tracing /// the values must match the number and types of the fields described by the /// eventTypes parameter. /// - [SecuritySafeCritical] private unsafe void WriteMultiMerge( string eventName, ref EventSourceOptions options, @@ -415,7 +408,6 @@ namespace System.Diagnostics.Tracing /// the values must match the number and types of the fields described by the /// eventTypes parameter. /// - [SecuritySafeCritical] private unsafe void WriteMultiMergeInner( string eventName, ref EventSourceOptions options, @@ -526,7 +518,6 @@ namespace System.Diagnostics.Tracing /// The number and types of the values must match the number and types of the /// fields described by the eventTypes parameter. /// - [SecuritySafeCritical] internal unsafe void WriteMultiMerge( string eventName, ref EventSourceOptions options, @@ -604,7 +595,6 @@ namespace System.Diagnostics.Tracing #endif // FEATURE_MANAGED_ETW } - [SecuritySafeCritical] private unsafe void WriteImpl( string eventName, ref EventSourceOptions options, @@ -721,7 +711,6 @@ namespace System.Diagnostics.Tracing } } - [SecurityCritical] private unsafe void WriteToAllListeners(string eventName, ref EventDescriptor eventDescriptor, EventTags tags, Guid* pActivityId, EventPayload payload) { EventWrittenEventArgs eventCallbackArgs = new EventWrittenEventArgs(this); @@ -750,7 +739,6 @@ namespace System.Diagnostics.Tracing System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)] #endif - [SecurityCritical] [NonEvent] private unsafe void WriteCleanup(GCHandle* pPins, int cPins) { diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/LogSwitch.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/LogSwitch.cs index 80e7b86..84f6b91 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/LogSwitch.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/LogSwitch.cs @@ -33,7 +33,6 @@ namespace System.Diagnostics { // // All switches (except for the global LogSwitch) have a parent LogSwitch. // - [System.Security.SecuritySafeCritical] // auto-generated public LogSwitch(String name, String description, LogSwitch parent) { if (name != null && name.Length == 0) @@ -58,7 +57,6 @@ namespace System.Diagnostics { throw new ArgumentNullException ((name==null ? nameof(name) : nameof(parent))); } - [System.Security.SecuritySafeCritical] // auto-generated internal LogSwitch(String name, String description) { strName = name; @@ -100,7 +98,6 @@ namespace System.Diagnostics { public virtual LoggingLevels MinimumLevel { get { return iLevel; } - [System.Security.SecuritySafeCritical] // auto-generated set { iLevel = value; diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stackframe.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stackframe.cs index 3992a82..06d675e 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stackframe.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stackframe.cs @@ -43,9 +43,6 @@ namespace System.Diagnostics { } // Constructs a StackFrame corresponding to the active stack frame. -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public StackFrame() { InitMembers(); @@ -53,9 +50,6 @@ namespace System.Diagnostics { } // Constructs a StackFrame corresponding to the active stack frame. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public StackFrame(bool fNeedFileInfo) { InitMembers(); @@ -72,9 +66,6 @@ namespace System.Diagnostics { // Constructs a StackFrame corresponding to a calling stack frame. // - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public StackFrame(int skipFrames, bool fNeedFileInfo) { InitMembers(); @@ -194,11 +185,6 @@ namespace System.Diagnostics { // information is normally extracted from the debugging symbols // for the executable. // - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif public virtual String GetFileName() { if (strFileName != null) @@ -236,7 +222,6 @@ namespace System.Diagnostics { // Builds a readable representation of the stack frame // - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { StringBuilder sb = new StringBuilder(255); diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs index 6c2140f..390fcab 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs @@ -181,7 +181,6 @@ namespace System.Diagnostics { #endif } - [System.Security.SecuritySafeCritical] public virtual MethodBase GetMethodBase(int i) { // There may be a better way to do this. @@ -219,7 +218,6 @@ namespace System.Diagnostics { // serialization implementation // [OnSerializing] - [SecuritySafeCritical] void OnSerializing(StreamingContext context) { // this is called in the process of serializing this object. @@ -244,7 +242,6 @@ namespace System.Diagnostics { } [OnDeserialized] - [SecuritySafeCritical] void OnDeserialized(StreamingContext context) { // after we are done deserializing we need to transform the rgMethodBase in rgMethodHandle @@ -268,7 +265,6 @@ namespace System.Diagnostics { // StackTrace, we use an InheritanceDemand to prevent partially-trusted // subclasses. #if !FEATURE_CORECLR - [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] #endif [Serializable] [System.Runtime.InteropServices.ComVisible(true)] @@ -280,9 +276,6 @@ namespace System.Diagnostics { private int m_iMethodsToSkip; // Constructs a stack trace from the current location. -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public StackTrace() { m_iNumOfFrames = 0; @@ -292,9 +285,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location. // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(bool fNeedFileInfo) { m_iNumOfFrames = 0; @@ -305,9 +295,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location, in a caller's // frame // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(int skipFrames) { @@ -325,9 +312,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location, in a caller's // frame // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(int skipFrames, bool fNeedFileInfo) { @@ -357,9 +341,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location. // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(Exception e, bool fNeedFileInfo) { if (e == null) @@ -374,9 +355,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location, in a caller's // frame // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(Exception e, int skipFrames) { if (e == null) @@ -396,9 +374,6 @@ namespace System.Diagnostics { // Constructs a stack trace from the current location, in a caller's // frame // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public StackTrace(Exception e, int skipFrames, bool fNeedFileInfo) { if (e == null) @@ -430,9 +405,6 @@ namespace System.Diagnostics { // Constructs a stack trace for the given thread // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif [Obsolete("This constructor has been deprecated. Please use a constructor that does not require a Thread parameter. http://go.microsoft.com/fwlink/?linkid=14202")] public StackTrace(Thread targetThread, bool needFileInfo) { @@ -443,7 +415,6 @@ namespace System.Diagnostics { } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void GetStackFramesInternal(StackFrameHelper sfh, int iSkip, bool fNeedFileInfo, Exception e); @@ -576,9 +547,6 @@ namespace System.Diagnostics { // Builds a readable representation of the stack trace // -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public override String ToString() { // Include a trailing newline for backwards compatibility @@ -596,9 +564,6 @@ namespace System.Diagnostics { // Builds a readable representation of the stack trace, specifying // the format for backwards compatibility. -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif internal String ToString(TraceFormat traceFormat) { bool displayFilenames = true; // we'll try, but demand may fail @@ -745,9 +710,6 @@ namespace System.Diagnostics { // This helper is called from within the EE to construct a string representation // of the current stack trace. -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private static String GetManagedStackTraceStringHelper(bool fNeedFileInfo) { // Note all the frames in System.Diagnostics will be skipped when capturing diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs index b6177be..a0d3640 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs @@ -31,9 +31,6 @@ namespace System.Diagnostics.SymbolStore { // Define a source document. Guid's will be provided for the // languages, vendors, and document types that we currently know // about. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif ISymbolDocumentWriter DefineDocument(String url, Guid language, Guid languageVendor, @@ -42,9 +39,6 @@ namespace System.Diagnostics.SymbolStore { // Define the method that the user has defined as their entrypoint // for this module. This would be, perhaps, the user's main method // rather than compiler generated stubs before main. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void SetUserEntryPoint(SymbolToken entryMethod); // Open a method to emit symbol information into. The given method @@ -55,25 +49,16 @@ namespace System.Diagnostics.SymbolStore { // defined symbols for that method. // // There can be only one open method at a time. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void OpenMethod(SymbolToken method); // Close the current method. Once a method is closed, no more // symbols can be defined within it. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void CloseMethod(); // Define a group of sequence points within the current method. // Each line/column defines the start of a statement within a // method. The arrays should be sorted by offset. The offset is // always the offset from the start of the method, in bytes. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void DefineSequencePoints(ISymbolDocumentWriter document, int[] offsets, int[] lines, @@ -96,17 +81,11 @@ namespace System.Diagnostics.SymbolStore { // Note: scope id's are only valid in the current method. // - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif int OpenScope(int startOffset); // Close the current lexical scope. Once a scope is closed no more // variables can be defined within it. endOffset points past the // last instruction in the scope. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void CloseScope(int endOffset); // Define the offset range for a given lexical scope. @@ -120,9 +99,6 @@ namespace System.Diagnostics.SymbolStore { // variable of the same name that has multiple homes throughout a // scope. (Note: start/end offsets must not overlap in such a // case.) - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void DefineLocalVariable(String name, FieldAttributes attributes, byte[] signature, @@ -178,9 +154,6 @@ namespace System.Diagnostics.SymbolStore { // Defines a custom attribute based upon its name. Not to be // confused with Metadata custom attributes, these attributes are // held in the symbol store. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void SetSymAttribute(SymbolToken parent, String name, byte[] data); // Opens a new namespace. Call this before defining methods or @@ -195,9 +168,6 @@ namespace System.Diagnostics.SymbolStore { // current scope will also stop using the namespace, and the // namespace will be in use in all scopes that inherit from the // currently open scope. - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void UsingNamespace(String fullName); // Specifies the true start and end of a method within a source diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs index f600da8..6c438c9 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs @@ -240,10 +240,8 @@ namespace System.Diagnostics { // Native method to inform the EE about the creation of a new LogSwitch - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void AddLogSwitch(LogSwitch logSwitch); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ModifyLogSwitch (int iNewLevel, String strSwitchName, String strParentName); } diff --git a/src/coreclr/src/mscorlib/src/System/Double.cs b/src/coreclr/src/mscorlib/src/System/Double.cs index b2d509a..ce146a1 100644 --- a/src/coreclr/src/mscorlib/src/System/Double.cs +++ b/src/coreclr/src/mscorlib/src/System/Double.cs @@ -44,7 +44,6 @@ namespace System { internal static double NegativeZero = BitConverter.Int64BitsToDouble(unchecked((long)0x8000000000000000)); [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsInfinity(double d) { return (*(long*)(&d) & 0x7FFFFFFFFFFFFFFF) == 0x7FF0000000000000; @@ -79,14 +78,12 @@ namespace System { } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static bool IsNegative(double d) { return (*(UInt64*)(&d) & 0x8000000000000000) == 0x8000000000000000; } [Pure] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsNaN(double d) { @@ -187,7 +184,6 @@ namespace System { //The hashcode for a double is the absolute value of the integer representation //of that double. // - [System.Security.SecuritySafeCritical] public unsafe override int GetHashCode() { double d = m_value; if (d == 0) { @@ -198,25 +194,21 @@ namespace System { return unchecked((int)value) ^ ((int)(value >> 32)); } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatDouble(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatDouble(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatDouble(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatDouble(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/Empty.cs b/src/coreclr/src/mscorlib/src/System/Empty.cs index c54c99a..4790d9a 100644 --- a/src/coreclr/src/mscorlib/src/System/Empty.cs +++ b/src/coreclr/src/mscorlib/src/System/Empty.cs @@ -25,7 +25,6 @@ namespace System { return String.Empty; } - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Enum.cs b/src/coreclr/src/mscorlib/src/System/Enum.cs index 38228f7..f06e28f 100644 --- a/src/coreclr/src/mscorlib/src/System/Enum.cs +++ b/src/coreclr/src/mscorlib/src/System/Enum.cs @@ -23,7 +23,6 @@ namespace System #endregion #region Private Static Methods - [System.Security.SecuritySafeCritical] // auto-generated private static TypeValuesAndNames GetCachedValuesAndNames(RuntimeType enumType, bool getNames) { TypeValuesAndNames entry = enumType.GenericCache as TypeValuesAndNames; @@ -47,7 +46,6 @@ namespace System return entry; } - [System.Security.SecuritySafeCritical] private unsafe String InternalFormattedHexString() { fixed (void* pValue = &JitHelpers.GetPinningHelper(this).m_data) @@ -252,20 +250,16 @@ namespace System return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int InternalCompareTo(Object o1, Object o2); - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeType InternalGetUnderlyingType(RuntimeType enumType); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [System.Security.SuppressUnmanagedCodeSecurity] private static extern void GetEnumValuesAndNames(RuntimeTypeHandle enumType, ObjectHandleOnStack values, ObjectHandleOnStack names, bool getNames); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Object InternalBoxEnum(RuntimeType enumType, long value); #endregion @@ -728,7 +722,6 @@ namespace System #endregion #region Private Methods - [System.Security.SecuritySafeCritical] internal unsafe Object GetValue() { fixed (void* pValue = &JitHelpers.GetPinningHelper(this).m_data) @@ -770,7 +763,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] private unsafe ulong ToUInt64() { fixed (void* pValue = &JitHelpers.GetPinningHelper(this).m_data) @@ -823,22 +815,18 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool InternalHasFlag(Enum flags); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern CorElementType InternalGetCorElementType(); #endregion #region Object Overrides - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override bool Equals(Object obj); - [System.Security.SecuritySafeCritical] public override unsafe int GetHashCode() { // CONTRACT with the runtime: GetHashCode of enum types is implemented as GetHashCode of the underlying type. @@ -907,7 +895,6 @@ namespace System #endregion #region IComparable - [System.Security.SecuritySafeCritical] // auto-generated public int CompareTo(Object target) { const int retIncompatibleMethodTables = 2; // indicates that the method tables did not match @@ -973,7 +960,6 @@ namespace System return ToString(); } - [System.Security.SecuritySafeCritical] public Boolean HasFlag(Enum flag) { if (flag == null) throw new ArgumentNullException(nameof(flag)); @@ -1140,7 +1126,6 @@ namespace System #endregion #region ToObject - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, sbyte value) @@ -1156,7 +1141,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, short value) { @@ -1171,7 +1155,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, int value) { @@ -1186,7 +1169,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, byte value) { @@ -1201,7 +1183,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, ushort value) @@ -1217,7 +1198,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, uint value) @@ -1233,7 +1213,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, long value) { @@ -1248,7 +1227,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(true)] public static Object ToObject(Type enumType, ulong value) @@ -1264,7 +1242,6 @@ namespace System return InternalBoxEnum(rtType, unchecked((long)value)); } - [System.Security.SecuritySafeCritical] // auto-generated private static Object ToObject(Type enumType, char value) { if (enumType == null) @@ -1278,7 +1255,6 @@ namespace System return InternalBoxEnum(rtType, value); } - [System.Security.SecuritySafeCritical] // auto-generated private static Object ToObject(Type enumType, bool value) { if (enumType == null) diff --git a/src/coreclr/src/mscorlib/src/System/Environment.cs b/src/coreclr/src/mscorlib/src/System/Environment.cs index 50be7d4..febf465 100644 --- a/src/coreclr/src/mscorlib/src/System/Environment.cs +++ b/src/coreclr/src/mscorlib/src/System/Environment.cs @@ -88,7 +88,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal String GetResourceString(String key) { if (key == null || key.Length == 0) { @@ -124,11 +123,6 @@ namespace System { return userData.m_retVal; } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif private void GetResourceStringCode(Object userDataIn) { GetResourceStringUserData userData = (GetResourceStringUserData) userDataIn; @@ -193,9 +187,6 @@ namespace System { userData.m_retVal = s; } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif [PrePrepareMethod] private void GetResourceStringBackoutCode(Object userDataIn, bool exceptionThrown) { @@ -247,32 +238,24 @@ namespace System { **Exceptions: None ==============================================================================*/ public static extern int TickCount { - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } // Terminates this process with the given exit code. - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void _Exit(int exitCode); - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public static void Exit(int exitCode) { _Exit(exitCode); } public static extern int ExitCode { - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] get; - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] set; } @@ -280,11 +263,9 @@ namespace System { // Note: The CLR's Watson bucketization code looks at the caller of the FCALL method // to assign blame for crashes. Don't mess with this, such as by making it call // another managed helper method, unless you consult with some CLR Watson experts. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void FailFast(String message); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void FailFast(String message, uint exitCode); @@ -301,7 +282,6 @@ namespace System { // if the exception object is preallocated, the runtime will use the callsite's // IP for bucketing. If the exception object is not preallocated, it will use the bucket // details contained in the object (if any). - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void FailFast(String message, Exception exception); @@ -318,9 +298,6 @@ namespace System { return Directory.GetCurrentDirectory(); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif set { Directory.SetCurrentDirectory(value); } @@ -328,11 +305,6 @@ namespace System { // Returns the system directory (ie, C:\WinNT\System32). public static String SystemDirectory { -#if FEATURE_CORECLR - [System.Security.SecurityCritical] -#else - [System.Security.SecuritySafeCritical] // auto-generated -#endif get { StringBuilder sb = new StringBuilder(Path.MaxPath); int r = Win32Native.GetSystemDirectory(sb, Path.MaxPath); @@ -347,7 +319,6 @@ namespace System { // Returns the windows directory (ie, C:\WinNT). // Used by NLS+ custom culures only at the moment. internal static String InternalWindowsDirectory { - [System.Security.SecurityCritical] // auto-generated get { StringBuilder sb = new StringBuilder(Path.MaxPath); int r = Win32Native.GetWindowsDirectory(sb, Path.MaxPath); @@ -359,7 +330,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated public static String ExpandEnvironmentVariables(String name) { if (name == null) @@ -422,7 +392,6 @@ namespace System { } public static String MachineName { - [System.Security.SecuritySafeCritical] // auto-generated get { // UWP Debug scenarios @@ -442,20 +411,17 @@ namespace System { } } - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern Int32 GetProcessorCount(); public static int ProcessorCount { - [System.Security.SecuritySafeCritical] // auto-generated get { return GetProcessorCount(); } } public static int SystemPageSize { - [System.Security.SecuritySafeCritical] // auto-generated get { (new EnvironmentPermission(PermissionState.Unrestricted)).Demand(); Win32Native.SYSTEM_INFO info = new Win32Native.SYSTEM_INFO(); @@ -471,7 +437,6 @@ namespace System { **Arguments: None **Exceptions: None. ==============================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public static String[] GetCommandLineArgs() { new EnvironmentPermission(EnvironmentPermissionAccess.Read, "Path").Demand(); @@ -494,7 +459,6 @@ namespace System { return GetCommandLineArgsNative(); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern String[] GetCommandLineArgsNative(); @@ -557,7 +521,6 @@ namespace System { **Exceptions: IOException. **Permissions: SystemInfo Permission. ==============================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public static String[] GetLogicalDrives() { new EnvironmentPermission(PermissionState.Unrestricted).Demand(); @@ -627,12 +590,10 @@ namespace System { **Arguments: **Exceptions: ==============================================================================*/ - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern long GetWorkingSet(); public static long WorkingSet { - [System.Security.SecuritySafeCritical] // auto-generated get { new EnvironmentPermission(PermissionState.Unrestricted).Demand(); return GetWorkingSet(); @@ -647,7 +608,6 @@ namespace System { **Exceptions: ==============================================================================*/ public static OperatingSystem OSVersion { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); @@ -716,7 +676,6 @@ namespace System { // Does the current version of Windows have Windows Runtime suppport? internal static bool IsWinRTSupported { - [SecuritySafeCritical] get { if (!s_CheckedWinRT) { s_WinRTSupported = WinRTSupported(); @@ -727,7 +686,6 @@ namespace System { } } - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] @@ -736,11 +694,9 @@ namespace System { #endif // FEATURE_CORESYSTEM - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool GetVersion(Microsoft.Win32.Win32Native.OSVERSIONINFO osVer); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool GetVersionEx(Microsoft.Win32.Win32Native.OSVERSIONINFOEX osVer); @@ -752,7 +708,6 @@ namespace System { **Exceptions: ==============================================================================*/ public static String StackTrace { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); @@ -761,7 +716,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated internal static String GetStackTrace(Exception e, bool needFileInfo) { // Note: Setting needFileInfo to true will start up COM and set our @@ -778,7 +732,6 @@ namespace System { return st.ToString( System.Diagnostics.StackTrace.TraceFormat.Normal ); } - [System.Security.SecuritySafeCritical] // auto-generated private static void InitResourceHelper() { // Only the default AppDomain should have a ResourceHelper. All calls to // GetResourceString from any AppDomain delegate to GetResourceStringLocal @@ -808,7 +761,6 @@ namespace System { // if you change this method's signature then you must change the code that calls it // in excep.cpp and probably you will have to visit mscorlib.h to add the new signature // as well as metasig.h to create the new signature type - [System.Security.SecurityCritical] // auto-generated // NoInlining causes the caller and callee to not be inlined in mscorlib as it is an assumption of StackCrawlMark use [MethodImpl(MethodImplOptions.NoInlining)] internal static String GetResourceStringLocal(String key) { @@ -818,7 +770,6 @@ namespace System { return m_resHelper.GetResourceString(key); } - [System.Security.SecuritySafeCritical] // auto-generated internal static String GetResourceString(String key) { return GetResourceStringLocal(key); } @@ -900,7 +851,6 @@ namespace System { } public static bool Is64BitOperatingSystem { - [System.Security.SecuritySafeCritical] get { #if BIT64 // 64-bit programs run only on 64-bit @@ -915,13 +865,11 @@ namespace System { } public static extern bool HasShutdownStarted { - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } public static string UserName { - [System.Security.SecuritySafeCritical] // auto-generated get { new EnvironmentPermission(EnvironmentPermissionAccess.Read,"UserName").Demand(); @@ -937,13 +885,11 @@ namespace System { public static bool UserInteractive { - [System.Security.SecuritySafeCritical] // auto-generated get { return true; } } - [System.Security.SecuritySafeCritical] // auto-generated public static string GetFolderPath(SpecialFolder folder) { if (!Enum.IsDefined(typeof(SpecialFolder), folder)) throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)folder)); @@ -952,7 +898,6 @@ namespace System { return InternalGetFolderPath(folder, SpecialFolderOption.None); } - [System.Security.SecuritySafeCritical] // auto-generated public static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option) { if (!Enum.IsDefined(typeof(SpecialFolder),folder)) throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)folder)); @@ -963,13 +908,11 @@ namespace System { return InternalGetFolderPath(folder, option); } - [System.Security.SecurityCritical] internal static string UnsafeGetFolderPath(SpecialFolder folder) { return InternalGetFolderPath(folder, SpecialFolderOption.None, suppressSecurityChecks: true); } - [System.Security.SecurityCritical] private static string InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, bool suppressSecurityChecks = false) { #if FEATURE_CORESYSTEM @@ -1043,7 +986,6 @@ namespace System { public static string UserDomainName { - [System.Security.SecuritySafeCritical] // auto-generated get { new EnvironmentPermission(EnvironmentPermissionAccess.Read,"UserDomain").Demand(); @@ -1198,7 +1140,6 @@ namespace System { internal static extern int CurrentProcessorNumber { - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } diff --git a/src/coreclr/src/mscorlib/src/System/Exception.cs b/src/coreclr/src/mscorlib/src/System/Exception.cs index c610daa..ff714a7 100644 --- a/src/coreclr/src/mscorlib/src/System/Exception.cs +++ b/src/coreclr/src/mscorlib/src/System/Exception.cs @@ -73,7 +73,6 @@ namespace System { _innerException = innerException; } - [System.Security.SecuritySafeCritical] // auto-generated protected Exception(SerializationInfo info, StreamingContext context) { if (info==null) @@ -143,7 +142,6 @@ namespace System { } public virtual IDictionary Data { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_data == null) if (IsImmutableAgileException(this)) @@ -155,7 +153,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool IsImmutableAgileException(Exception e); @@ -260,11 +257,9 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern private IRuntimeMethodInfo GetMethodFromStackTrace(Object stackTrace); - [System.Security.SecuritySafeCritical] // auto-generated private MethodBase GetExceptionMethodFromStackTrace() { IRuntimeMethodInfo method = GetMethodFromStackTrace(_stackTrace); @@ -277,7 +272,6 @@ namespace System { } public MethodBase TargetSite { - [System.Security.SecuritySafeCritical] // auto-generated get { return GetTargetSiteInternal(); } @@ -285,7 +279,6 @@ namespace System { // this function is provided as a private helper to avoid the security demand - [System.Security.SecurityCritical] // auto-generated private MethodBase GetTargetSiteInternal() { if (_exceptionMethod!=null) { return _exceptionMethod; @@ -306,9 +299,6 @@ namespace System { // available, null is returned. public virtual String StackTrace { -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif get { // By default attempt to include file and line number info @@ -321,7 +311,6 @@ namespace System { // is true. Note that this requires FileIOPermission(PathDiscovery), and so // will usually fail in CoreCLR. To avoid the demand and resulting // SecurityException we can explicitly not even try to get fileinfo. - [System.Security.SecurityCritical] // auto-generated private string GetStackTrace(bool needFileInfo) { string stackTraceString = _stackTraceString; @@ -368,7 +357,6 @@ namespace System { } public virtual String Source { - [System.Security.SecurityCritical] // auto-generated get { if (_source == null) { @@ -397,21 +385,14 @@ namespace System { return _source; } - [System.Security.SecurityCritical] // auto-generated set { _source = value; } } -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public override String ToString() { return ToString(true, true); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private String ToString(bool needFileLineInfo, bool needMessage) { String message = (needMessage ? Message : null); String s; @@ -438,7 +419,6 @@ namespace System { return s; } - [System.Security.SecurityCritical] // auto-generated private String GetExceptionMethodString() { MethodBase methBase = GetTargetSiteInternal(); if (methBase==null) { @@ -491,7 +471,6 @@ namespace System { return result.ToString(); } - [System.Security.SecurityCritical] // auto-generated private MethodBase GetExceptionMethodFromString() { Contract.Assert(_exceptionMethodString != null, "Method string cannot be NULL!"); String[] args = _exceptionMethodString.Split(new char[]{'\0', '\n'}); @@ -528,7 +507,6 @@ namespace System { } #endif // FEATURE_SERIALIZATION - [System.Security.SecurityCritical] // auto-generated_required public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -646,9 +624,6 @@ namespace System { // This is used by the runtime when re-throwing a managed exception. It will // copy the stack trace to _remoteStackTraceString. -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif internal void InternalPreserveStackTrace() { string tmpStackTraceString; @@ -721,27 +696,21 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void PrepareForForeignExceptionRaise(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetStackTracesDeepCopy(Exception exception, out object currentStackTrace, out object dynamicMethodArray); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SaveStackTracesFromDeepCopy(Exception exception, object currentStackTrace, object dynamicMethodArray); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern object CopyStackTrace(object currentStackTrace); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern object CopyDynamicMethods(object currentDynamicMethods); - [SecuritySafeCritical] internal object DeepCopyStackTrace(object currentStackTrace) { if (currentStackTrace != null) @@ -754,7 +723,6 @@ namespace System { } } - [SecuritySafeCritical] internal object DeepCopyDynamicMethods(object currentDynamicMethods) { if (currentDynamicMethods != null) @@ -767,7 +735,6 @@ namespace System { } } - [SecuritySafeCritical] internal void GetStackTracesDeepCopy(out object currentStackTrace, out object dynamicMethodArray) { GetStackTracesDeepCopy(this, out currentStackTrace, out dynamicMethodArray); @@ -775,7 +742,6 @@ namespace System { // This is invoked by ExceptionDispatchInfo.Throw to restore the exception stack trace, corresponding to the original throw of the // exception, just before the exception is "rethrown". - [SecuritySafeCritical] internal void RestoreExceptionDispatchInfo(System.Runtime.ExceptionServices.ExceptionDispatchInfo exceptionDispatchInfo) { bool fCanProcessException = !(IsImmutableAgileException(this)); @@ -878,7 +844,6 @@ namespace System { // InternalToString is called by the runtime to get the exception text // and create a corresponding CrossAppDomainMarshaledException - [System.Security.SecurityCritical] // auto-generated internal virtual String InternalToString() { try @@ -907,13 +872,11 @@ namespace System { internal bool IsTransient { - [System.Security.SecuritySafeCritical] // auto-generated get { return nIsTransient(_HResult); } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static bool nIsTransient(int hr); @@ -935,7 +898,6 @@ namespace System { } // See comment on ExceptionMessageKind - [System.Security.SecuritySafeCritical] // auto-generated internal static String GetMessageFromNativeResources(ExceptionMessageKind kind) { string retMesg = null; @@ -943,7 +905,6 @@ namespace System { return retMesg; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetMessageFromNativeResources(ExceptionMessageKind kind, StringHandleOnStack retMesg); @@ -974,9 +935,6 @@ namespace System { // Normally, only Telesto's UEF will see these exceptions. // This override prints out the original Exception's ToString() // output and hides the fact that it is wrapped inside another excepton. -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif internal override String InternalToString() { return Message; diff --git a/src/coreclr/src/mscorlib/src/System/GC.cs b/src/coreclr/src/mscorlib/src/System/GC.cs index 3ee6114..e338e44 100644 --- a/src/coreclr/src/mscorlib/src/System/GC.cs +++ b/src/coreclr/src/mscorlib/src/System/GC.cs @@ -63,68 +63,53 @@ namespace System { public static class GC { - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetGCLatencyMode(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int SetGCLatencyMode(int newLatencyMode); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int _StartNoGCRegion(long totalSize, bool lohSizeKnown, long lohSize, bool disallowFullBlockingGC); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int _EndNoGCRegion(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetLOHCompactionMode(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SetLOHCompactionMode(int newLOHCompactionMode); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int GetGenerationWR(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern long GetTotalMemory(); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _Collect(int generation, int mode); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int GetMaxGeneration(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern int _CollectionCount (int generation, int getSpecialGCCount); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool IsServerGC(); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void _AddMemoryPressure(UInt64 bytesAllocated); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void _RemoveMemoryPressure(UInt64 bytesAllocated); - [System.Security.SecurityCritical] // auto-generated_required public static void AddMemoryPressure (long bytesAllocated) { if( bytesAllocated <= 0) { throw new ArgumentOutOfRangeException(nameof(bytesAllocated), @@ -140,7 +125,6 @@ namespace System { _AddMemoryPressure((ulong)bytesAllocated); } - [System.Security.SecurityCritical] // auto-generated_required public static void RemoveMemoryPressure (long bytesAllocated) { if( bytesAllocated <= 0) { throw new ArgumentOutOfRangeException(nameof(bytesAllocated), @@ -159,7 +143,6 @@ namespace System { // Returns the generation that obj is currently in. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetGeneration(Object obj); @@ -172,25 +155,21 @@ namespace System { // Garbage Collect all generations. // - [System.Security.SecuritySafeCritical] // auto-generated public static void Collect() { //-1 says to GC all generations. _Collect(-1, (int)InternalGCCollectionMode.Blocking); } - [System.Security.SecuritySafeCritical] // auto-generated public static void Collect(int generation, GCCollectionMode mode) { Collect(generation, mode, true); } - [System.Security.SecuritySafeCritical] // auto-generated public static void Collect(int generation, GCCollectionMode mode, bool blocking) { Collect(generation, mode, blocking, false); } - [System.Security.SecuritySafeCritical] // auto-generated public static void Collect(int generation, GCCollectionMode mode, bool blocking, bool compacting) { if (generation<0) @@ -227,7 +206,6 @@ namespace System { _Collect(generation, iInternalModes); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int CollectionCount (int generation) { @@ -240,7 +218,6 @@ namespace System { } // pass in true to get the BGC or FGC count. - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static int CollectionCount (int generation, bool getSpecialGCCount) { @@ -295,7 +272,6 @@ namespace System { // Returns the generation in which wo currently resides. // - [System.Security.SecuritySafeCritical] // auto-generated public static int GetGeneration(WeakReference wo) { int result = GetGenerationWR(wo.m_handle); KeepAlive(wo); @@ -305,16 +281,13 @@ namespace System { // Returns the maximum GC generation. Currently assumes only 1 heap. // public static int MaxGeneration { - [System.Security.SecuritySafeCritical] // auto-generated get { return GetMaxGeneration(); } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _WaitForPendingFinalizers(); - [System.Security.SecuritySafeCritical] // auto-generated public static void WaitForPendingFinalizers() { // QCalls can not be exposed from mscorlib directly, need to wrap it. _WaitForPendingFinalizers(); @@ -322,12 +295,10 @@ namespace System { // Indicates that the system should not call the Finalize() method on // an object that would normally require this call. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern void _SuppressFinalize(Object o); - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static void SuppressFinalize(Object obj) { if (obj == null) @@ -340,11 +311,9 @@ namespace System { // for which SuppressFinalize has already been called. The other situation // where calling ReRegisterForFinalize is useful is inside a finalizer that // needs to resurrect itself or an object that it references. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _ReRegisterForFinalize(Object o); - [System.Security.SecuritySafeCritical] // auto-generated public static void ReRegisterForFinalize(Object obj) { if (obj == null) throw new ArgumentNullException(nameof(obj)); @@ -356,7 +325,6 @@ namespace System { // the GC heap. This does not return the total size of the GC heap, but // only the live objects in the GC heap. // - [System.Security.SecuritySafeCritical] // auto-generated public static long GetTotalMemory(bool forceFullCollection) { long size = GetTotalMemory(); if (!forceFullCollection) @@ -379,16 +347,13 @@ namespace System { return newSize; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern long _GetAllocatedBytesForCurrentThread(); - [System.Security.SecuritySafeCritical] // auto-generated public static long GetAllocatedBytesForCurrentThread() { return _GetAllocatedBytesForCurrentThread(); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool _RegisterForFullGCNotification(int maxGenerationPercentage, int largeObjectHeapPercentage); @@ -401,7 +366,6 @@ namespace System { [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int _WaitForFullGCComplete(int millisecondsTimeout); - [SecurityCritical] public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold) { if ((maxGenerationThreshold <= 0) || (maxGenerationThreshold >= 100)) @@ -430,7 +394,6 @@ namespace System { } } - [SecurityCritical] public static void CancelFullGCNotification() { if (!_CancelFullGCNotification()) @@ -439,13 +402,11 @@ namespace System { } } - [SecurityCritical] public static GCNotificationStatus WaitForFullGCApproach() { return (GCNotificationStatus)_WaitForFullGCApproach(-1); } - [SecurityCritical] public static GCNotificationStatus WaitForFullGCApproach(int millisecondsTimeout) { if (millisecondsTimeout < -1) @@ -454,13 +415,11 @@ namespace System { return (GCNotificationStatus)_WaitForFullGCApproach(millisecondsTimeout); } - [SecurityCritical] public static GCNotificationStatus WaitForFullGCComplete() { return (GCNotificationStatus)_WaitForFullGCComplete(-1); } - [SecurityCritical] public static GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout) { if (millisecondsTimeout < -1) @@ -484,7 +443,6 @@ namespace System { AllocationExceeded = 3 } - [SecurityCritical] static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC) { StartNoGCRegionStatus status = (StartNoGCRegionStatus)_StartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC); @@ -498,31 +456,26 @@ namespace System { return true; } - [SecurityCritical] public static bool TryStartNoGCRegion(long totalSize) { return StartNoGCRegionWorker(totalSize, false, 0, false); } - [SecurityCritical] public static bool TryStartNoGCRegion(long totalSize, long lohSize) { return StartNoGCRegionWorker(totalSize, true, lohSize, false); } - [SecurityCritical] public static bool TryStartNoGCRegion(long totalSize, bool disallowFullBlockingGC) { return StartNoGCRegionWorker(totalSize, false, 0, disallowFullBlockingGC); } - [SecurityCritical] public static bool TryStartNoGCRegion(long totalSize, long lohSize, bool disallowFullBlockingGC) { return StartNoGCRegionWorker(totalSize, true, lohSize, disallowFullBlockingGC); } - [SecurityCritical] static EndNoGCRegionStatus EndNoGCRegionWorker() { EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion(); @@ -536,7 +489,6 @@ namespace System { return EndNoGCRegionStatus.Succeeded; } - [SecurityCritical] public static void EndNoGCRegion() { EndNoGCRegionWorker(); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/Calendar.cs b/src/coreclr/src/mscorlib/src/System/Globalization/Calendar.cs index a79a232..c2e809f 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/Calendar.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/Calendar.cs @@ -845,7 +845,6 @@ namespace System.Globalization { throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond")); } - [System.Security.SecuritySafeCritical] // auto-generated internal static int GetSystemTwoDigitYearSetting(int CalID, int defaultYearValue) { // Call nativeGetTwoDigitYearMax diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.cs index 8c187f0..7f21c1f 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.cs @@ -436,17 +436,14 @@ namespace System.Globalization // Get native two digit year max - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int nativeGetTwoDigitYearMax(int calID); // Call native side to load our calendar data - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool nativeGetCalendarData(CalendarData data, String localeName, int calendar); // Call native side to figure out which calendars are allowed - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int nativeGetCalendars(String localeName, bool useUserOverride, [In, Out] int[] calendars); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs index 04c1065..d26e04b 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs @@ -46,14 +46,11 @@ namespace System.Globalization { static bool s_initialized = InitTable(); // The native pointer to the 12:4:4 index table of the Unicode cateogry data. - [SecurityCritical] unsafe static ushort* s_pCategoryLevel1Index; - [SecurityCritical] unsafe static byte* s_pCategoriesValue; // The native pointer to the 12:4:4 index table of the Unicode numeric data. // The value of this index table is an index into the real value table stored in s_pNumericValues. - [SecurityCritical] unsafe static ushort* s_pNumericLevel1Index; // The numeric value table, which is indexed by s_pNumericLevel1Index. @@ -61,12 +58,10 @@ namespace System.Globalization { // unsafe static double* s_pNumericValues; // To get around the IA64 alignment issue. Our double data is aligned in 8-byte boundary, but loader loads the embeded table starting // at 4-byte boundary. This cause a alignment issue since double is 8-byte. - [SecurityCritical] unsafe static byte* s_pNumericValues; // The digit value table, which is indexed by s_pNumericLevel1Index. It shares the same indice as s_pNumericValues. // Every item contains the value for decimal digit/digit value. - [SecurityCritical] unsafe static DigitValues* s_pDigitValues; internal const String UNICODE_INFO_FILE_NAME = "charinfo.nlp"; @@ -111,7 +106,6 @@ namespace System.Globalization { //use. We allocate this once in the class initializer and then we don't need to worry //about it again. // - [System.Security.SecuritySafeCritical] // auto-generated unsafe static bool InitTable() { // Go to native side and get pointer to the native table @@ -245,7 +239,6 @@ namespace System.Globalization { // // Note that for ch in the range D800-DFFF we just treat it as any other non-numeric character // - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static double InternalGetNumericValue(int ch) { Contract.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range."); // Get the level 2 item from the highest 12 bit (8 - 19) of ch. @@ -278,7 +271,6 @@ namespace System.Globalization { // // Note that for ch in the range D800-DFFF we just treat it as any other non-numeric character // - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static DigitValues* InternalGetDigitValues(int ch) { Contract.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range."); // Get the level 2 item from the highest 12 bit (8 - 19) of ch. @@ -292,12 +284,10 @@ namespace System.Globalization { return &(s_pDigitValues[pBytePtr[(ch & 0x000f)]]); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static sbyte InternalGetDecimalDigitValue(int ch) { return (InternalGetDigitValues(ch)->decimalDigit); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static sbyte InternalGetDigitValue(int ch) { return (InternalGetDigitValues(ch)->digit); } @@ -441,7 +431,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static byte InternalGetCategoryValue(int ch, int offset) { Contract.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range."); // Get the level 2 item from the highest 12 bit (8 - 19) of ch. diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CompareInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CompareInfo.cs index b6b1a53..aed3983 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CompareInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CompareInfo.cs @@ -221,7 +221,6 @@ namespace System.Globalization { return(IsSortable(ch.ToString())); } - [System.Security.SecuritySafeCritical] [System.Runtime.InteropServices.ComVisible(false)] public static bool IsSortable(String text) { if (text == null) { @@ -393,7 +392,6 @@ namespace System.Globalization { return (Compare(string1, string2, CompareOptions.None)); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int Compare(String string1, String string2, CompareOptions options){ if (options == CompareOptions.OrdinalIgnoreCase) @@ -464,7 +462,6 @@ namespace System.Globalization { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int Compare(String string1, int offset1, int length1, String string2, int offset2, int length2, CompareOptions options) { if (options == CompareOptions.OrdinalIgnoreCase) @@ -541,7 +538,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual bool IsPrefix(String source, String prefix, CompareOptions options) { if (source == null || prefix == null) { @@ -596,7 +592,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual bool IsSuffix(String source, String suffix, CompareOptions options) { if (source == null || suffix == null) { @@ -742,7 +737,6 @@ namespace System.Globalization { return IndexOf(source, value, startIndex, count, CompareOptions.None); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int IndexOf(String source, char value, int startIndex, int count, CompareOptions options) { // Validate inputs @@ -775,7 +769,6 @@ namespace System.Globalization { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int IndexOf(String source, String value, int startIndex, int count, CompareOptions options) { // Validate inputs @@ -924,7 +917,6 @@ namespace System.Globalization { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int LastIndexOf(String source, char value, int startIndex, int count, CompareOptions options) { // Verify Arguments @@ -973,7 +965,6 @@ namespace System.Globalization { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual int LastIndexOf(String source, String value, int startIndex, int count, CompareOptions options) { // Verify Arguments @@ -1046,7 +1037,6 @@ namespace System.Globalization { return CreateSortKey(source, CompareOptions.None); } - [System.Security.SecuritySafeCritical] private SortKey CreateSortKey(String source, CompareOptions options) { if (source==null) { throw new ArgumentNullException(nameof(source)); } @@ -1202,7 +1192,6 @@ namespace System.Globalization { return GetHashCodeOfString(source, options, false, 0); } - [System.Security.SecuritySafeCritical] // auto-generated internal int GetHashCodeOfString(string source, CompareOptions options, bool forceRandomizedHashing, long additionalEntropy) { // @@ -1254,7 +1243,6 @@ namespace System.Globalization { } #endif - [System.Security.SecuritySafeCritical] internal static IntPtr InternalInitSortHandle(String localeName, out IntPtr handleOrigin) { return NativeInternalInitSortHandle(localeName, out handleOrigin); @@ -1265,7 +1253,6 @@ namespace System.Globalization { public SortVersion Version { - [SecuritySafeCritical] get { if(m_SortVersion == null) @@ -1280,32 +1267,27 @@ namespace System.Globalization { } } - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool InternalGetNlsVersionEx(IntPtr handle, IntPtr handleOrigin, String localeName, ref Win32Native.NlsVersionInfoEx lpNlsVersionInformation); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern IntPtr NativeInternalInitSortHandle(String localeName, out IntPtr handleOrigin); // Get a locale sensitive sort hash code from native code -- COMNlsInfo::InternalGetGlobalizedHashCode - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern int InternalGetGlobalizedHashCode(IntPtr handle, IntPtr handleOrigin, string localeName, string source, int length, int dwFlags, bool forceRandomizedHashing, long additionalEntropy); // Use native API calls to see if this string is entirely defined -- COMNlsInfo::InternalIsSortable - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool InternalIsSortable(IntPtr handle, IntPtr handleOrigin, String localeName, String source, int length); // Compare a string using the native API calls -- COMNlsInfo::InternalCompareString - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern int InternalCompareString(IntPtr handle, IntPtr handleOrigin, String localeName, String string1, int offset1, int length1, @@ -1313,13 +1295,11 @@ namespace System.Globalization { // InternalFindNLSStringEx parameters is not exactly matching kernel32::FindNLSStringEx parameters. // Call through to NewApis::FindNLSStringEx so we can get the right behavior - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern int InternalFindNLSStringEx(IntPtr handle, IntPtr handleOrigin, String localeName, int flags, String source, int sourceCount, int startIndex, string target, int targetCount); // Call through to NewAPis::LCMapStringEx so we can get appropriate behavior for all platforms - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern int InternalGetSortKey(IntPtr handle, IntPtr handleOrigin, String localeName, int flags, String source, int sourceCount, byte[] target, int targetCount); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs index d6c66a7..dc37cb0 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs @@ -546,7 +546,6 @@ namespace System.Globalization // Cache of regions we've already looked up private static volatile Dictionary s_cachedRegions; - [System.Security.SecurityCritical] // auto-generated internal static CultureData GetCultureDataForRegion(String cultureName, bool useUserOverride) { // First do a shortcut for Invariant @@ -650,7 +649,6 @@ namespace System.Globalization #if FEATURE_USE_LCID // Obtain locale name from LCID // NOTE: This will get neutral names, unlike the OS API - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String LCIDToLocaleName(int lcid); @@ -698,7 +696,6 @@ namespace System.Globalization s_replacementCultureNames = null; } - [System.Security.SecuritySafeCritical] // auto-generated internal static CultureInfo[] GetCultures(CultureTypes types) { // Disable warning 618: System.Globalization.CultureTypes.FrameworkCultures' is obsolete @@ -792,7 +789,6 @@ namespace System.Globalization //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated private static bool IsReplacementCultureName(String name) { Contract.Assert(name != null, "IsReplacementCultureName(): name should not be null"); @@ -870,7 +866,6 @@ namespace System.Globalization // Parent name (which may be a custom locale/culture) internal String SPARENT { - [System.Security.SecurityCritical] // auto-generated get { if (this.sParent == null) @@ -885,7 +880,6 @@ namespace System.Globalization // Localized pretty name for this locale (ie: Inglis (estados Unitos)) internal String SLOCALIZEDDISPLAYNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sLocalizedDisplayName == null) @@ -919,7 +913,6 @@ namespace System.Globalization // English pretty name for this locale (ie: English (United States)) internal String SENGDISPLAYNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sEnglishDisplayName == null) @@ -961,7 +954,6 @@ namespace System.Globalization // Native pretty name for this locale (ie: Deutsch (Deutschland)) internal String SNATIVEDISPLAYNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNativeDisplayName == null) @@ -1005,7 +997,6 @@ namespace System.Globalization // iso 639 language name, ie: en internal String SISO639LANGNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sISO639Language == null) @@ -1019,7 +1010,6 @@ namespace System.Globalization // iso 639 language name, ie: eng internal String SISO639LANGNAME2 { - [System.Security.SecurityCritical] // auto-generated get { if (this.sISO639Language2 == null) @@ -1033,7 +1023,6 @@ namespace System.Globalization // abbreviated windows language name (ie: enu) (non-standard, avoid this) internal String SABBREVLANGNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sAbbrevLang == null) @@ -1048,7 +1037,6 @@ namespace System.Globalization // This is only valid for Windows 8 and higher neutrals: internal String SLOCALIZEDLANGUAGE { - [System.Security.SecurityCritical] // auto-generated get { if (this.sLocalizedLanguage == null) @@ -1071,7 +1059,6 @@ namespace System.Globalization // English name for this language (Windows Only) ie: German internal String SENGLISHLANGUAGE { - [System.Security.SecurityCritical] // auto-generated get { if (this.sEnglishLanguage == null) @@ -1085,7 +1072,6 @@ namespace System.Globalization // Native name of this language (Windows Only) ie: Deutsch internal String SNATIVELANGUAGE { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNativeLanguage == null) @@ -1105,7 +1091,6 @@ namespace System.Globalization // region name (eg US) internal String SREGIONNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sRegionName == null) @@ -1141,7 +1126,6 @@ namespace System.Globalization // localized name for the country internal string SLOCALIZEDCOUNTRY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sLocalizedCountry == null) @@ -1167,7 +1151,6 @@ namespace System.Globalization // english country name (RegionInfo) ie: Germany internal String SENGCOUNTRY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sEnglishCountry == null) @@ -1181,7 +1164,6 @@ namespace System.Globalization // native country name (RegionInfo) ie: Deutschland internal String SNATIVECOUNTRY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNativeCountry == null) @@ -1195,7 +1177,6 @@ namespace System.Globalization // ISO 3166 Country Name internal String SISO3166CTRYNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sISO3166CountryName == null) @@ -1209,7 +1190,6 @@ namespace System.Globalization // ISO 3166 Country Name internal String SISO3166CTRYNAME2 { - [System.Security.SecurityCritical] // auto-generated get { if (this.sISO3166CountryName2 == null) @@ -1223,7 +1203,6 @@ namespace System.Globalization // abbreviated Country Name (windows version, non-standard, avoid) internal String SABBREVCTRYNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sAbbrevCountry == null) @@ -1267,7 +1246,6 @@ namespace System.Globalization // Console fallback name (ie: locale to use for console apps for unicode-only locales) internal String SCONSOLEFALLBACKNAME { - [System.Security.SecurityCritical] // auto-generated get { if (this.sConsoleFallbackName == null) @@ -1307,7 +1285,6 @@ namespace System.Globalization // (user can override) grouping of digits internal int[] WAGROUPING { - [System.Security.SecurityCritical] // auto-generated get { if (this.waGrouping == null || UseUserOverride) @@ -1325,7 +1302,6 @@ namespace System.Globalization // Not a Number internal String SNAN { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNaN == null) @@ -1339,7 +1315,6 @@ namespace System.Globalization // + Infinity internal String SPOSINFINITY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sPositiveInfinity == null) @@ -1353,7 +1328,6 @@ namespace System.Globalization // - Infinity internal String SNEGINFINITY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNegativeInfinity == null) @@ -1400,7 +1374,6 @@ namespace System.Globalization // Percent (%) symbol internal String SPERCENT { - [System.Security.SecurityCritical] // auto-generated get { if (this.sPercent == null) @@ -1415,7 +1388,6 @@ namespace System.Globalization // PerMille (‰) symbol internal String SPERMILLE { - [System.Security.SecurityCritical] // auto-generated get { if (this.sPerMille == null) @@ -1434,7 +1406,6 @@ namespace System.Globalization // (user can override) local monetary symbol, eg: $ internal String SCURRENCY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sCurrency == null || UseUserOverride) @@ -1448,7 +1419,6 @@ namespace System.Globalization // international monetary symbol (RegionInfo), eg: USD internal String SINTLSYMBOL { - [System.Security.SecurityCritical] // auto-generated get { if (this.sIntlMonetarySymbol == null) @@ -1462,7 +1432,6 @@ namespace System.Globalization // English name for this currency (RegionInfo), eg: US Dollar internal String SENGLISHCURRENCY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sEnglishCurrency == null) @@ -1476,7 +1445,6 @@ namespace System.Globalization // Native name for this currency (RegionInfo), eg: Schweiz Frank internal String SNATIVECURRENCY { - [System.Security.SecurityCritical] // auto-generated get { if (this.sNativeCurrency == null) @@ -1494,7 +1462,6 @@ namespace System.Globalization // (user can override) monetary grouping of digits internal int[] WAMONGROUPING { - [System.Security.SecurityCritical] // auto-generated get { if (this.waMonetaryGrouping == null || UseUserOverride) @@ -1528,7 +1495,6 @@ namespace System.Globalization // (user can override) list Separator internal String SLIST { - [System.Security.SecurityCritical] // auto-generated get { if (this.sListSeparator == null || UseUserOverride) @@ -1555,7 +1521,6 @@ namespace System.Globalization // (user can override) AM designator internal String SAM1159 { - [System.Security.SecurityCritical] // auto-generated get { if (this.sAM1159 == null || UseUserOverride) @@ -1569,7 +1534,6 @@ namespace System.Globalization // (user can override) PM designator internal String SPM2359 { - [System.Security.SecurityCritical] // auto-generated get { if (this.sPM2359 == null || UseUserOverride) @@ -1750,7 +1714,6 @@ namespace System.Globalization // time duration format internal String[] SADURATION { - [System.Security.SecurityCritical] // auto-generated get { if (this.saDurationFormats == null) @@ -2036,7 +1999,6 @@ namespace System.Globalization // es-ES_tradnl -> es-ES internal String STEXTINFO // Text info name to use for text information { - [System.Security.SecuritySafeCritical] get { if (this.sTextInfo == null) @@ -2062,7 +2024,6 @@ namespace System.Globalization // Compare info name (including sorting key) to use if custom internal String SCOMPAREINFO { - [System.Security.SecuritySafeCritical] get { if (this.sCompareInfo == null) @@ -2098,7 +2059,6 @@ namespace System.Globalization private String SSCRIPTS { - [System.Security.SecuritySafeCritical] // auto-generated get { if (this.sScripts == null) @@ -2111,7 +2071,6 @@ namespace System.Globalization private String SOPENTYPELANGUAGETAG { - [System.Security.SecuritySafeCritical] // auto-generated get { return DoGetLocaleInfo(LOCALE_SOPENTYPELANGUAGETAG); @@ -2120,7 +2079,6 @@ namespace System.Globalization private String FONTSIGNATURE { - [System.Security.SecuritySafeCritical] // auto-generated get { if (this.fontSignature == null) @@ -2133,7 +2091,6 @@ namespace System.Globalization private String SKEYBOARDSTOINSTALL { - [System.Security.SecuritySafeCritical] // auto-generated get { return DoGetLocaleInfo(LOCALE_SKEYBOARDSTOINSTALL); @@ -2191,7 +2148,6 @@ namespace System.Globalization // Obtain locale name from LCID // NOTE: This will get neutral names, unlike the OS API - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int LocaleNameToLCID(String localeName); @@ -2285,7 +2241,6 @@ namespace System.Globalization // Time separator (derived from time format) internal String TimeSeparator { - [System.Security.SecuritySafeCritical] // auto-generated get { if (sTimeSeparator == null || UseUserOverride) @@ -2567,7 +2522,6 @@ namespace System.Globalization return -1; } - [System.Security.SecurityCritical] string DoGetLocaleInfo(uint lctype) { Contract.Assert(this.sWindowsName != null, "[CultureData.DoGetLocaleInfo] Expected this.sWindowsName to be populated by COMNlsInfo::nativeInitCultureData already"); @@ -2576,7 +2530,6 @@ namespace System.Globalization // For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the // "windows" name, which can be specific for downlevel (< windows 7) os's. - [System.Security.SecurityCritical] // auto-generated string DoGetLocaleInfo(string localeName, uint lctype) { // Fix lctype if we don't want overrides @@ -2650,7 +2603,6 @@ namespace System.Globalization // not affected by the Calendar property in DTFI. // //////////////////////////////////////////////////////////////////////////// - [System.Security.SecurityCritical] // auto-generated internal void GetNFIValues(NumberFormatInfo nfi) { if (this.IsInvariantCulture) @@ -2997,20 +2949,16 @@ namespace System.Globalization internal const uint TIME_NOSECONDS = 0x00000002; // Don't use seconds (get short time format for enumtimeformats on win7+) // Get our initial minimal culture data (name, parent, etc.) - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool nativeInitCultureData(CultureData cultureData); // Grab the NumberFormatInfo data - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool nativeGetNumberFormatInfoValues(String localeName, NumberFormatInfo nfi, bool useUserOverride); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern String[] nativeEnumTimeFormats(String localeName, uint dwFlags, bool useUserOverride); - [System.Security.SecurityCritical] // auto-generated [SuppressUnmanagedCodeSecurityAttribute()] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] internal static extern int nativeEnumCultureNames(int cultureTypes, ObjectHandleOnStack retStringArray); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs index 54ea32b..3792097 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs @@ -146,7 +146,6 @@ namespace System.Globalization { #if FEATURE_APPX // When running under AppX, we use this to get some information about the language list - [SecurityCritical] private static volatile WindowsRuntimeResourceManagerBase s_WindowsRuntimeResourceManager; [ThreadStatic] @@ -191,7 +190,6 @@ namespace System.Globalization { return true; } - [System.Security.SecuritySafeCritical] // auto-generated static CultureInfo InitUserDefaultCulture() { String strDefault = GetDefaultLocaleName(LOCALE_USER_DEFAULT); @@ -235,7 +233,6 @@ namespace System.Globalization { } #if FEATURE_APPX - [SecuritySafeCritical] internal static CultureInfo GetCultureInfoForUserPreferredLanguageInAppX() { // If a call to GetCultureInfoForUserPreferredLanguageInAppX() generated a recursive @@ -281,7 +278,6 @@ namespace System.Globalization { return toReturn; } - [SecuritySafeCritical] internal static bool SetCultureInfoForUserPreferredLanguageInAppX(CultureInfo ci) { // If running within a compilation process (mscorsvw.exe, for example), it is illegal to @@ -829,10 +825,6 @@ namespace System.Globalization { return s_DefaultThreadCurrentCulture; } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Demand, ControlThread = true)] -#pragma warning restore 618 set { // If you add pre-conditions to this method, check to see if you also need to @@ -847,10 +839,6 @@ namespace System.Globalization { return s_DefaultThreadCurrentUICulture; } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Demand, ControlThread = true)] -#pragma warning restore 618 set { //If they're trying to use a Culture with a name that we can't use in resource lookup, @@ -901,7 +889,6 @@ namespace System.Globalization { public virtual CultureInfo Parent { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); @@ -1051,7 +1038,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String DisplayName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); @@ -1071,7 +1057,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public virtual String NativeName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); return (this.m_cultureData.SNATIVEDISPLAYNAME); @@ -1088,7 +1073,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public virtual String EnglishName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); return (this.m_cultureData.SENGDISPLAYNAME); @@ -1097,7 +1081,6 @@ namespace System.Globalization { // ie: en public virtual String TwoLetterISOLanguageName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); return (this.m_cultureData.SISO639LANGNAME); @@ -1106,7 +1089,6 @@ namespace System.Globalization { // ie: eng public virtual String ThreeLetterISOLanguageName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); return (this.m_cultureData.SISO639LANGNAME2); @@ -1122,7 +1104,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public virtual String ThreeLetterWindowsLanguageName { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(Contract.Result() != null); return (this.m_cultureData.SABBREVLANGNAME); @@ -1489,7 +1470,6 @@ namespace System.Globalization { } } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(false)] public CultureInfo GetConsoleFallbackUICulture() { @@ -1896,19 +1876,15 @@ namespace System.Globalization { // // Get Locale Info Ex calls. So we don't have to muck with the different int/string return types we declared two of these: - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String nativeGetLocaleInfoEx(String localeName, uint field); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int nativeGetLocaleInfoExInt(String localeName, uint field); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool nativeSetThreadLocale(String localeName); - [System.Security.SecurityCritical] private static String GetDefaultLocaleName(int localeType) { Contract.Assert(localeType == LOCALE_USER_DEFAULT || localeType == LOCALE_SYSTEM_DEFAULT, "[CultureInfo.GetDefaultLocaleName] localeType must be LOCALE_USER_DEFAULT or LOCALE_SYSTEM_DEFAULT"); @@ -1922,13 +1898,11 @@ namespace System.Globalization { } // Get the default locale name - [System.Security.SecurityCritical] // auto-generated [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool InternalGetDefaultLocaleName(int localetype, StringHandleOnStack localeString); - [System.Security.SecuritySafeCritical] // auto-generated private static String GetUserDefaultUILanguage() { string userDefaultUiLanguage = null; @@ -1940,13 +1914,11 @@ namespace System.Globalization { } // Get the user's default UI language, return locale name - [System.Security.SecurityCritical] // auto-generated [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool InternalGetUserDefaultUILanguage(StringHandleOnStack userDefaultUiLanguage); - [System.Security.SecuritySafeCritical] // auto-generated private static String GetSystemDefaultUILanguage() { string systemDefaultUiLanguage = null; @@ -1958,7 +1930,6 @@ namespace System.Globalization { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] @@ -1967,7 +1938,6 @@ namespace System.Globalization { // Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5 #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String[] nativeGetResourceFallbackArray(); #endif diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs index 9b5264f..17c0b43 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs @@ -66,7 +66,6 @@ namespace System.Globalization { m_invalidCultureName = (string) info.GetValue("InvalidCultureName", typeof(string)); } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs index f63de72..82fca3a 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs @@ -175,7 +175,6 @@ namespace System { FormatDigits(outputBuffer, value, len, false); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static void FormatDigits(StringBuilder outputBuffer, int value, int len, bool overrideLengthLimit) { Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0"); @@ -1138,7 +1137,6 @@ namespace System { // This is an MDA for cases when the user is using a local format with // a Utc DateTime. - [System.Security.SecuritySafeCritical] // auto-generated internal static void InvalidFormatForUtc(String format, DateTime dateTime) { #if MDA_SUPPORTED Mda.DateTimeInvalidLocalFormat(); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs index dd878a4..e4bd411 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs @@ -208,7 +208,6 @@ namespace System.Globalization { private String LanguageName { - [System.Security.SecurityCritical] // auto-generated get { if (m_langName == null) @@ -540,9 +539,6 @@ namespace System.Globalization { public String AMDesignator { -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated -#endif get { #if FEATURE_CORECLR @@ -1044,9 +1040,6 @@ namespace System.Globalization { public String PMDesignator { -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated -#endif get { #if FEATURE_CORECLR @@ -2375,7 +2368,6 @@ namespace System.Globalization { formatFlags = DateTimeFormatFlags.NotInitialized; } - [System.Security.SecurityCritical] // auto-generated internal TokenHashValue[] CreateTokenHashTable() { TokenHashValue[] temp = m_dtfiTokenHash; if (temp == null) { @@ -2689,7 +2681,6 @@ namespace System.Globalization { return (ch >= '\x0590' && ch <= '\x05ff'); } - [System.Security.SecurityCritical] // auto-generated internal bool Tokenize(TokenType TokenMask, out TokenType tokenType, out int tokenValue, ref __DTString str) { tokenType = TokenType.UnknownToken; tokenValue = 0; diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs index 40cbabc..4555bb2 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs @@ -498,9 +498,6 @@ namespace System.Globalization // //////////////////////////////////////////////////////////////////////////// - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal String[] GetDateWordsOfDTFI(DateTimeFormatInfo dtfi) { // Enumarate all LongDatePatterns, and get the DateWords and scan for month postfix. String[] datePatterns = dtfi.GetAllDateTimePatterns('D'); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs index b48067b..52921ed 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs @@ -581,7 +581,6 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // This is the lexer. Check the character at the current index, and put the found token in dtok and // some raw date/time information in raw. // - [System.Security.SecuritySafeCritical] // auto-generated private static Boolean Lex(DS dps, ref __DTString str, ref DateTimeToken dtok, ref DateTimeRawInfo raw, ref DateTimeResult result, ref DateTimeFormatInfo dtfi, DateTimeStyles styles) { @@ -2292,7 +2291,6 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // // This is the real method to do the parsing work. // - [System.Security.SecuritySafeCritical] // auto-generated internal static bool TryParse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, ref DateTimeResult result) { if (s == null) { result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, nameof(s)); @@ -4360,7 +4358,6 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // Used by DateTime.Parse() to get the next token. - [System.Security.SecurityCritical] // auto-generated internal void GetRegularToken(out TokenType tokenType, out int tokenValue, DateTimeFormatInfo dtfi) { tokenValue = 0; if (Index >= len) { @@ -4440,7 +4437,6 @@ Start: } } - [System.Security.SecurityCritical] // auto-generated internal TokenType GetSeparatorToken(DateTimeFormatInfo dtfi, out int indexBeforeSeparator, out char charBeforeSeparator) { indexBeforeSeparator = Index; charBeforeSeparator = m_current; @@ -4851,7 +4847,6 @@ Start: // internal unsafe struct DateTimeRawInfo { - [SecurityCritical] private int* num; internal int numCount; internal int month; @@ -4865,7 +4860,6 @@ Start: internal bool timeZone; - [System.Security.SecurityCritical] // auto-generated internal void Init(int * numberBuffer) { month = -1; year = -1; @@ -4875,11 +4869,9 @@ Start: fraction = -1; num = numberBuffer; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe void AddNumber(int value) { num[numCount++] = value; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe int GetNumber(int index) { return num[index]; } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs index 728c44b..89ac780 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs @@ -27,14 +27,12 @@ namespace System.Globalization { internal String m_bodyName; internal uint m_flags; - [SecurityCritical] unsafe internal CodePageDataItem(int dataIndex) { m_dataIndex = dataIndex; m_uiFamilyCodePage = EncodingTable.codePageDataPtr[dataIndex].uiFamilyCodePage; m_flags = EncodingTable.codePageDataPtr[dataIndex].flags; } - [System.Security.SecurityCritical] unsafe internal static String CreateString(sbyte* pStrings, uint index) { if (pStrings[0] == '|') // |str1|str2|str3 @@ -71,7 +69,6 @@ namespace System.Globalization { } unsafe public String WebName { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_webName==null) { m_webName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 0); @@ -87,7 +84,6 @@ namespace System.Globalization { } unsafe public String HeaderName { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_headerName==null) { m_headerName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 1); @@ -97,7 +93,6 @@ namespace System.Globalization { } unsafe public String BodyName { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_bodyName==null) { m_bodyName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 2); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingTable.cs b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingTable.cs index 12da52e..d908a2a 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingTable.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingTable.cs @@ -34,13 +34,11 @@ namespace System.Globalization // // This points to a native data table which maps an encoding name to the correct code page. // - [SecurityCritical] unsafe internal static InternalEncodingDataItem *encodingDataPtr = GetEncodingData(); // // This points to a native data table which stores the properties for the code page, and // the table is indexed by code page. // - [SecurityCritical] unsafe internal static InternalCodePageDataItem *codePageDataPtr = GetCodePageData(); // // This caches the mapping of an encoding name to a code page. @@ -51,14 +49,12 @@ namespace System.Globalization // private static Hashtable hashByCodePage = Hashtable.Synchronized(new Hashtable()); - [System.Security.SecuritySafeCritical] // static constructors should be safe to call static EncodingTable() { } // Find the data item by binary searching the table that we have in native. // nativeCompareOrdinalWC is an internal-only function. - [System.Security.SecuritySafeCritical] // auto-generated unsafe private static int internalGetCodePageFromName(String name) { int left = 0; int right = lastEncodingItem; @@ -98,7 +94,6 @@ namespace System.Globalization } // Return a list of all EncodingInfo objects describing all of our encodings - [System.Security.SecuritySafeCritical] // auto-generated internal static unsafe EncodingInfo[] GetEncodings() { if (lastCodePageItem == 0) @@ -161,7 +156,6 @@ namespace System.Globalization return codePage; } - [System.Security.SecuritySafeCritical] // auto-generated unsafe internal static CodePageDataItem GetCodePageDataItem(int codepage) { CodePageDataItem dataItem; @@ -198,22 +192,18 @@ namespace System.Globalization return null; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe static extern InternalEncodingDataItem *GetEncodingData(); // // Return the number of encoding data items. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int GetNumEncodingItems(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe static extern InternalCodePageDataItem* GetCodePageData(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal unsafe static extern byte* nativeCreateOpenFileMapping( String inSectionName, int inBytesToAllocate, out IntPtr mappedFileHandle); @@ -228,7 +218,6 @@ namespace System.Globalization [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] internal unsafe struct InternalEncodingDataItem { - [SecurityCritical] internal sbyte * webName; internal UInt16 codePage; } @@ -243,7 +232,6 @@ namespace System.Globalization internal UInt16 codePage; internal UInt16 uiFamilyCodePage; internal uint flags; - [SecurityCritical] internal sbyte * Names; } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs b/src/coreclr/src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs index 4de3fd3..14322d8 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs @@ -32,7 +32,6 @@ namespace System.Globalization { // Instance data members and instance methods. // // ---------------------------------------------------------------------------------------------------- - [System.Security.SecurityCritical] // auto-generated internal unsafe static byte* GetGlobalizationResourceBytePtr(Assembly assembly, String tableName) { Contract.Assert(assembly != null, "assembly can not be null. This should be generally the "+System.CoreLib.Name+" assembly."); Contract.Assert(tableName != null, "table name can not be null"); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/HijriCalendar.cs b/src/coreclr/src/mscorlib/src/System/Globalization/HijriCalendar.cs index d19e77a..39a01e5 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/HijriCalendar.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/HijriCalendar.cs @@ -209,7 +209,6 @@ namespace System.Globalization { public int HijriAdjustment { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_HijriAdvance == Int32.MinValue) { // Never been set before. Use the system value from registry. @@ -252,7 +251,6 @@ namespace System.Globalization { ** "AddHijriDate+1" => Add +1 days to the current calculated Hijri date. ** "AddHijriDate+2" => Add +2 days to the current calculated Hijri date. ============================================================================*/ - [System.Security.SecurityCritical] // auto-generated static int GetAdvanceHijriDate() { #if FEATURE_WIN32_REGISTRY diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs index 8035ff7..d2a216c 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs @@ -191,7 +191,6 @@ namespace System.Globalization } - [System.Security.SecuritySafeCritical] private String GetAsciiUsingOS(String unicode) { if (unicode.Length == 0) @@ -294,7 +293,6 @@ namespace System.Globalization } - [System.Security.SecuritySafeCritical] private string GetUnicodeUsingOS(string ascii) { uint flags = (uint)((AllowUnassigned ? IDN_ALLOW_UNASSIGNED : 0) | (UseStd3AsciiRules ? IDN_USE_STD3_ASCII_RULES : 0)); @@ -1158,7 +1156,6 @@ namespace System.Globalization private const int ERROR_INVALID_NAME = 123; - [System.Security.SecurityCritical] [SuppressUnmanagedCodeSecurityAttribute()] [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] private static extern int IdnToAscii( @@ -1172,7 +1169,6 @@ namespace System.Globalization char [] lpASCIICharStr, int cchASCIIChar); - [System.Security.SecurityCritical] [SuppressUnmanagedCodeSecurityAttribute()] [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] private static extern int IdnToUnicode( diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs b/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs index 07642b4..6b168ce 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs @@ -159,7 +159,6 @@ namespace System.Globalization { // . is a delimiter, but the value of . doesn't matter. // '_' marks the space between the japanese era name, japanese abbreviated era name // english name, and abbreviated english names. - [System.Security.SecuritySafeCritical] // auto-generated private static EraInfo[] GetErasFromRegistry() { // Look in the registry key and see if we can find any ranges diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs index 886fd88..a5dce46 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/NumberFormatInfo.cs @@ -210,7 +210,6 @@ namespace System.Globalization { // We aren't persisting dataItem any more (since its useless & we weren't using it), // Ditto with m_useUserOverride. Don't use them, we use a local copy of everything. - [System.Security.SecuritySafeCritical] // auto-generated internal NumberFormatInfo(CultureData cultureData) { if (cultureData != null) diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs index 1159d01..9b12bde 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs @@ -59,7 +59,6 @@ namespace System.Globalization { // In Silverlight we enforce that RegionInfos must be created with a full culture name // //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated public RegionInfo(String name) { if (name==null) throw new ArgumentNullException(nameof(name)); @@ -95,7 +94,6 @@ namespace System.Globalization { #if FEATURE_USE_LCID // We'd rather people use the named version since this doesn't allow custom locales - [System.Security.SecuritySafeCritical] // auto-generated public RegionInfo(int culture) { if (culture == CultureInfo.LOCALE_INVARIANT) //The InvariantCulture has no matching region @@ -127,14 +125,12 @@ namespace System.Globalization { } #endif - [System.Security.SecuritySafeCritical] // auto-generated internal RegionInfo(CultureData cultureData) { this.m_cultureData = cultureData; this.m_name = this.m_cultureData.SREGIONNAME; } - [System.Security.SecurityCritical] // auto-generated private void SetName(string name) { #if FEATURE_CORECLR @@ -163,7 +159,6 @@ namespace System.Globalization { [OptionalField(VersionAdded = 2)] internal int m_dataItem = 0; - [System.Security.SecurityCritical] // auto-generated [OnDeserialized] private void OnDeserialized(StreamingContext ctx) { @@ -203,7 +198,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public static RegionInfo CurrentRegion { - [System.Security.SecuritySafeCritical] // auto-generated get { RegionInfo temp = s_currentRegionInfo; if (temp == null) @@ -241,7 +235,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String EnglishName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SENGCOUNTRY); @@ -259,7 +252,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String DisplayName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SLOCALIZEDCOUNTRY); @@ -278,7 +270,6 @@ namespace System.Globalization { [System.Runtime.InteropServices.ComVisible(false)] public virtual String NativeName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SNATIVECOUNTRY); @@ -294,7 +285,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String TwoLetterISORegionName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SISO3166CTRYNAME); @@ -311,7 +301,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String ThreeLetterISORegionName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SISO3166CTRYNAME2); @@ -327,7 +316,6 @@ namespace System.Globalization { //////////////////////////////////////////////////////////////////////// public virtual String ThreeLetterWindowsRegionName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SABBREVCTRYNAME); @@ -368,7 +356,6 @@ namespace System.Globalization { [System.Runtime.InteropServices.ComVisible(false)] public virtual String CurrencyEnglishName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SENGLISHCURRENCY); @@ -386,7 +373,6 @@ namespace System.Globalization { [System.Runtime.InteropServices.ComVisible(false)] public virtual String CurrencyNativeName { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SNATIVECURRENCY); @@ -401,7 +387,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public virtual String CurrencySymbol { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SCURRENCY); } @@ -415,7 +400,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// public virtual String ISOCurrencySymbol { - [System.Security.SecuritySafeCritical] // auto-generated get { return (this.m_cultureData.SINTLSYMBOL); } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/TextInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/TextInfo.cs index 7eff22a..8731221 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/TextInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/TextInfo.cs @@ -212,7 +212,6 @@ namespace System.Globalization { return (Invariant.GetCaseInsensitiveHashCode(s, forceRandomizedHashing, additionalEntropy)); } - [System.Security.SecuritySafeCritical] internal static unsafe bool TryFastFindStringOrdinalIgnoreCase(int searchFlags, String source, int startIndex, String value, int count, ref int foundIndex) { return InternalTryFindStringOrdinalIgnoreCase(searchFlags, source, count, startIndex, value, value.Length, ref foundIndex); @@ -220,7 +219,6 @@ namespace System.Globalization { // This function doesn't check arguments. Please do check in the caller. // The underlying unmanaged code will assert the sanity of arguments. - [System.Security.SecuritySafeCritical] // auto-generated internal static unsafe int CompareOrdinalIgnoreCase(String str1, String str2) { // Compare the whole string and ignore case. @@ -229,7 +227,6 @@ namespace System.Globalization { // This function doesn't check arguments. Please do check in the caller. // The underlying unmanaged code will assert the sanity of arguments. - [System.Security.SecuritySafeCritical] // auto-generated internal static unsafe int CompareOrdinalIgnoreCaseEx(String strA, int indexA, String strB, int indexB, int lengthA, int lengthB ) { Contract.Assert(strA.Length >= indexA + lengthA, "[TextInfo.CompareOrdinalIgnoreCaseEx] Caller should've validated strA.Length >= indexA + lengthA"); @@ -481,7 +478,6 @@ namespace System.Globalization { public virtual String ListSeparator { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_listSeparator == null) { @@ -512,7 +508,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual char ToLower(char c) { if(IsAscii(c) && IsAsciiCasingSameAsInvariant) @@ -522,7 +517,6 @@ namespace System.Globalization { return (InternalChangeCaseChar(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, c, false)); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual String ToLower(String str) { if (str == null) { throw new ArgumentNullException(nameof(str)); } @@ -550,7 +544,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual char ToUpper(char c) { if (IsAscii(c) && IsAsciiCasingSameAsInvariant) @@ -561,7 +554,6 @@ namespace System.Globalization { } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual String ToUpper(String str) { if (str == null) { throw new ArgumentNullException(nameof(str)); } @@ -930,13 +922,11 @@ namespace System.Globalization { // is not null before calling this. Currenlty, CaseInsensitiveHashCodeProvider // does that. // - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe int GetCaseInsensitiveHashCode(String str) { return GetCaseInsensitiveHashCode(str, false, 0); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe int GetCaseInsensitiveHashCode(String str, bool forceRandomizedHashing, long additionalEntropy) { // Validate inputs @@ -951,23 +941,19 @@ namespace System.Globalization { } // Change case (ToUpper/ToLower) -- COMNlsInfo::InternalChangeCaseChar - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern char InternalChangeCaseChar(IntPtr handle, IntPtr handleOrigin, String localeName, char ch, bool isToUpper); // Change case (ToUpper/ToLower) -- COMNlsInfo::InternalChangeCaseString - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern String InternalChangeCaseString(IntPtr handle, IntPtr handleOrigin, String localeName, String str, bool isToUpper); // Get case insensitive hash -- ComNlsInfo::InternalGetCaseInsHash - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern int InternalGetCaseInsHash(IntPtr handle, IntPtr handleOrigin, String localeName, String str, bool forceRandomizedHashing, long additionalEntropy); // Call ::CompareStringOrdinal -- ComNlsInfo::InternalCompareStringOrdinalIgnoreCase // Start at indexes and compare for length characters (or remainder of string if length == -1) - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static unsafe extern int InternalCompareStringOrdinalIgnoreCase(String string1, int index1, String string2, int index2, int length1, int length2); @@ -975,7 +961,6 @@ namespace System.Globalization { // ComNlsInfo::InternalTryFindStringOrdinalIgnoreCase attempts a faster IndexOf/LastIndexOf OrdinalIgnoreCase using a kernel function. // Returns true if FindStringOrdinal was handled, with foundIndex set to the target's index into the source // Returns false when FindStringOrdinal wasn't handled - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs b/src/coreclr/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs index 8f58623..cf6ed95 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs @@ -11,7 +11,6 @@ namespace System.Globalization { internal static class TimeSpanFormat { - [System.Security.SecuritySafeCritical] // auto-generated private static String IntToString(int n, int digits) { return ParseNumbers.IntToString(n, 10, digits, '0', 0); } diff --git a/src/coreclr/src/mscorlib/src/System/Guid.cs b/src/coreclr/src/mscorlib/src/System/Guid.cs index c8ee9f0..d36d44e 100644 --- a/src/coreclr/src/mscorlib/src/System/Guid.cs +++ b/src/coreclr/src/mscorlib/src/System/Guid.cs @@ -752,17 +752,14 @@ namespace System { // // StringToShort, StringToInt, and StringToLong are wrappers around COMUtilNative integer parsing routines; - [System.Security.SecuritySafeCritical] private static unsafe bool StringToShort(String str, int requiredLength, int flags, out short result, ref GuidResult parseResult) { return StringToShort(str, null, requiredLength, flags, out result, ref parseResult); } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToShort(String str, ref int parsePos, int requiredLength, int flags, out short result, ref GuidResult parseResult) { fixed(int * ppos = &parsePos) { return StringToShort(str, ppos, requiredLength, flags, out result, ref parseResult); } } - [System.Security.SecurityCritical] private static unsafe bool StringToShort(String str, int* parsePos, int requiredLength, int flags, out short result, ref GuidResult parseResult) { result = 0; int x; @@ -771,17 +768,14 @@ namespace System { return retValue; } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToInt(String str, int requiredLength, int flags, out int result, ref GuidResult parseResult) { return StringToInt(str, null, requiredLength, flags, out result, ref parseResult); } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToInt(String str, ref int parsePos, int requiredLength, int flags, out int result, ref GuidResult parseResult) { fixed(int * ppos = &parsePos) { return StringToInt(str, ppos, requiredLength, flags, out result, ref parseResult); } } - [System.Security.SecurityCritical] private static unsafe bool StringToInt(String str, int* parsePos, int requiredLength, int flags, out int result, ref GuidResult parseResult) { result = 0; @@ -818,17 +812,14 @@ namespace System { } return true; } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToLong(String str, int flags, out long result, ref GuidResult parseResult) { return StringToLong(str, null, flags, out result, ref parseResult); } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToLong(String str, ref int parsePos, int flags, out long result, ref GuidResult parseResult) { fixed(int * ppos = &parsePos) { return StringToLong(str, ppos, flags, out result, ref parseResult); } } - [System.Security.SecuritySafeCritical] private static unsafe bool StringToLong(String str, int* parsePos, int flags, out long result, ref GuidResult parseResult) { result = 0; @@ -921,7 +912,6 @@ namespace System { return ToString("D",null); } - [System.Security.SecuritySafeCritical] public unsafe override int GetHashCode() { // Simply XOR all the bits of the GUID 32 bits at a time. @@ -1143,7 +1133,6 @@ namespace System { // This will create a new guid. Since we've now decided that constructors should 0-init, // we need a method that allows users to create a guid. - [System.Security.SecuritySafeCritical] // auto-generated public static Guid NewGuid() { // CoCreateGuid should never return Guid.Empty, since it attempts to maintain some // uniqueness guarantees. It should also never return a known GUID, but it's unclear @@ -1165,13 +1154,11 @@ namespace System { return (char) ((a > 9) ? a - 10 + 0x61 : a + 0x30); } - [System.Security.SecurityCritical] unsafe private static int HexsToChars(char* guidChars, int offset, int a, int b) { return HexsToChars(guidChars, offset, a, b, false); } - [System.Security.SecurityCritical] unsafe private static int HexsToChars(char* guidChars, int offset, int a, int b, bool hex) { if (hex) { @@ -1192,7 +1179,6 @@ namespace System { // IFormattable interface // We currently ignore provider - [System.Security.SecuritySafeCritical] public String ToString(String format, IFormatProvider provider) { if (format == null || format.Length == 0) diff --git a/src/coreclr/src/mscorlib/src/System/IAppDomainPauseManager.cs b/src/coreclr/src/mscorlib/src/System/IAppDomainPauseManager.cs index 7e03145..49fd9a6 100644 --- a/src/coreclr/src/mscorlib/src/System/IAppDomainPauseManager.cs +++ b/src/coreclr/src/mscorlib/src/System/IAppDomainPauseManager.cs @@ -20,16 +20,13 @@ namespace System using System.Runtime.Versioning; using System.Runtime.CompilerServices; - [System.Security.SecurityCritical] internal class AppDomainPauseManager { - [System.Security.SecurityCritical] public AppDomainPauseManager() { isPaused = false; } - [System.Security.SecurityCritical] static AppDomainPauseManager() { } @@ -37,19 +34,16 @@ namespace System static readonly AppDomainPauseManager instance = new AppDomainPauseManager(); internal static AppDomainPauseManager Instance { - [System.Security.SecurityCritical] get { return instance; } } // FAS: IAppDomainPauseConsumer interface implementation // currently there is nothing we do here as the implementation // of updating pause times have been moved to native CorHost2 - [System.Security.SecurityCritical] public void Pausing() { } - [System.Security.SecurityCritical] public void Paused() { Contract.Assert(!isPaused); @@ -67,7 +61,6 @@ namespace System isPaused = true; } - [System.Security.SecurityCritical] public void Resuming() { Contract.Assert(isPaused); @@ -75,7 +68,6 @@ namespace System ResumeEvent.Set(); } - [System.Security.SecurityCritical] public void Resumed() { Timer.Resume(); @@ -85,15 +77,12 @@ namespace System internal static bool IsPaused { - [System.Security.SecurityCritical] get { return isPaused; } } internal static ManualResetEvent ResumeEvent { - [System.Security.SecurityCritical] get; - [System.Security.SecurityCritical] set; } } diff --git a/src/coreclr/src/mscorlib/src/System/IO/BinaryReader.cs b/src/coreclr/src/mscorlib/src/System/IO/BinaryReader.cs index c7eff0f..b5be364 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/BinaryReader.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/BinaryReader.cs @@ -209,14 +209,12 @@ namespace System.IO { return ((ulong)hi) << 32 | lo; } - [System.Security.SecuritySafeCritical] // auto-generated public virtual unsafe float ReadSingle() { FillBuffer(4); uint tmpBuffer = (uint)(m_buffer[0] | m_buffer[1] << 8 | m_buffer[2] << 16 | m_buffer[3] << 24); return *((float*)&tmpBuffer); } - [System.Security.SecuritySafeCritical] // auto-generated public virtual unsafe double ReadDouble() { FillBuffer(8); uint lo = (uint)(m_buffer[0] | m_buffer[1] << 8 | @@ -294,7 +292,6 @@ namespace System.IO { return StringBuilderCache.GetStringAndRelease(sb); } - [SecuritySafeCritical] public virtual int Read(char[] buffer, int index, int count) { if (buffer==null) { throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer")); @@ -319,7 +316,6 @@ namespace System.IO { return InternalReadChars(buffer, index, count); } - [SecurityCritical] private int InternalReadChars(char[] buffer, int index, int count) { Contract.Requires(buffer != null); Contract.Requires(index >= 0 && count >= 0); @@ -472,7 +468,6 @@ namespace System.IO { return m_singleChar[0]; } - [SecuritySafeCritical] public virtual char[] ReadChars(int count) { if (count<0) { throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); diff --git a/src/coreclr/src/mscorlib/src/System/IO/BinaryWriter.cs b/src/coreclr/src/mscorlib/src/System/IO/BinaryWriter.cs index ca11868c..46275ec 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/BinaryWriter.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/BinaryWriter.cs @@ -177,7 +177,6 @@ namespace System.IO { // advanced by two. // Note this method cannot handle surrogates properly in UTF-8. // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual void Write(char ch) { if (Char.IsSurrogate(ch)) throw new ArgumentException(Environment.GetResourceString("Arg_SurrogatesNotAllowedAsSingleChar")); @@ -221,7 +220,6 @@ namespace System.IO { // Writes a double to this stream. The current position of the stream is // advanced by eight. // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual void Write(double value) { ulong TmpValue = *(ulong *)&value; @@ -324,7 +322,6 @@ namespace System.IO { // Writes a float to this stream. The current position of the stream is // advanced by four. // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual void Write(float value) { uint TmpValue = *(uint *)&value; @@ -341,7 +338,6 @@ namespace System.IO { // a four-byte unsigned integer, and then writes that many characters // to the stream. // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe virtual void Write(String value) { if (value==null) diff --git a/src/coreclr/src/mscorlib/src/System/IO/Directory.cs b/src/coreclr/src/mscorlib/src/System/IO/Directory.cs index 2d24d67..82f07f0 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/Directory.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/Directory.cs @@ -44,7 +44,6 @@ namespace System.IO return new DirectoryInfo(s); } - [System.Security.SecuritySafeCritical] public static DirectoryInfo CreateDirectory(String path) { if (path == null) throw new ArgumentNullException(nameof(path)); @@ -55,7 +54,6 @@ namespace System.IO return InternalCreateDirectoryHelper(path, true); } - [System.Security.SecurityCritical] internal static DirectoryInfo UnsafeCreateDirectory(String path) { if (path == null) @@ -67,7 +65,6 @@ namespace System.IO return InternalCreateDirectoryHelper(path, false); } - [System.Security.SecurityCritical] internal static DirectoryInfo InternalCreateDirectoryHelper(String path, bool checkHost) { Contract.Requires(path != null); @@ -123,7 +120,6 @@ namespace System.IO } - [System.Security.SecuritySafeCritical] internal unsafe static void InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, bool checkHost) { int length = fullPath.Length; @@ -261,19 +257,16 @@ namespace System.IO // Your application must have Read permission to the directory's // contents. // - [System.Security.SecuritySafeCritical] // auto-generated public static bool Exists(String path) { return InternalExistsHelper(path, true); } - [System.Security.SecurityCritical] internal static bool UnsafeExists(String path) { return InternalExistsHelper(path, false); } - [System.Security.SecurityCritical] internal static bool InternalExistsHelper(String path, bool checkHost) { try { @@ -308,7 +301,6 @@ namespace System.IO // Determine whether path describes an existing directory // on disk, avoiding security checks. - [System.Security.SecurityCritical] // auto-generated internal static bool InternalExists(String path) { int lastError = Win32Native.ERROR_SUCCESS; return InternalExists(path, out lastError); @@ -316,7 +308,6 @@ namespace System.IO // Determine whether path describes an existing directory // on disk, avoiding security checks. - [System.Security.SecurityCritical] // auto-generated internal static bool InternalExists(String path, out int lastError) { Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); lastError = File.FillAttributeInfo(path, ref data, false, true); @@ -407,7 +398,6 @@ namespace System.IO return InternalGetFileDirectoryNames(path, path, searchPattern, true, false, searchOption, true); } - [System.Security.SecurityCritical] internal static String[] UnsafeGetFiles(String path, String searchPattern, SearchOption searchOption) { Contract.Requires(path != null); @@ -470,7 +460,6 @@ namespace System.IO return InternalGetFileDirectoryNames(path, path, searchPattern, false, true, searchOption, true); } - [System.Security.SecurityCritical] internal static String[] UnsafeGetDirectories(String path, String searchPattern, SearchOption searchOption) { Contract.Requires(path != null); @@ -723,7 +712,6 @@ namespace System.IO // // Your application must have System Info permission. // - [System.Security.SecuritySafeCritical] // auto-generated public static String[] GetLogicalDrives() { Contract.Ensures(Contract.Result() != null); @@ -755,7 +743,6 @@ namespace System.IO return result; } - [System.Security.SecuritySafeCritical] public static String GetDirectoryRoot(String path) { if (path==null) throw new ArgumentNullException(nameof(path)); @@ -783,19 +770,16 @@ namespace System.IO **Arguments: The current DirectoryInfo to which to switch to the setter. **Exceptions: ==============================================================================*/ - [System.Security.SecuritySafeCritical] public static String GetCurrentDirectory() { return InternalGetCurrentDirectory(true); } - [System.Security.SecurityCritical] internal static String UnsafeGetCurrentDirectory() { return InternalGetCurrentDirectory(false); } - [System.Security.SecuritySafeCritical] private static string InternalGetCurrentDirectory(bool checkHost) { string currentDirectory = NewGetCurrentDirectory(); @@ -809,7 +793,6 @@ namespace System.IO return currentDirectory; } - [System.Security.SecurityCritical] private static string NewGetCurrentDirectory() { // Start with a buffer the size of MAX_PATH @@ -837,7 +820,6 @@ namespace System.IO } } - [System.Security.SecurityCritical] // auto-generated public static void SetCurrentDirectory(String path) { if (path==null) @@ -867,17 +849,14 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] public static void Move(String sourceDirName,String destDirName) { InternalMove(sourceDirName, destDirName, true); } - [System.Security.SecurityCritical] internal static void UnsafeMove(String sourceDirName,String destDirName) { InternalMove(sourceDirName, destDirName, false); } - [System.Security.SecurityCritical] private static void InternalMove(String sourceDirName,String destDirName,bool checkHost) { if (sourceDirName==null) throw new ArgumentNullException(nameof(sourceDirName)); @@ -937,21 +916,18 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] public static void Delete(String path) { String fullPath = Path.GetFullPath(path); Delete(fullPath, path, false, true); } - [System.Security.SecuritySafeCritical] public static void Delete(String path, bool recursive) { String fullPath = Path.GetFullPath(path); Delete(fullPath, path, recursive, true); } - [System.Security.SecurityCritical] internal static void UnsafeDelete(String path, bool recursive) { String fullPath = Path.GetFullPath(path); @@ -960,7 +936,6 @@ namespace System.IO // Called from DirectoryInfo as well. FullPath is fully qualified, // while the user path is used for feedback in exceptions. - [System.Security.SecurityCritical] // auto-generated internal static void Delete(String fullPath, String userPath, bool recursive, bool checkHost) { String demandPath; @@ -1002,7 +977,6 @@ namespace System.IO // Note that fullPath is fully qualified, while userPath may be // relative. Use userPath for all exception messages to avoid leaking // fully qualified path information. - [System.Security.SecurityCritical] // auto-generated private static void DeleteHelper(String fullPath, String userPath, bool recursive, bool throwOnTopLevelDirectoryNotFound) { bool r; diff --git a/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs b/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs index 9597382..47323f5 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs @@ -38,14 +38,11 @@ namespace System.IO // Migrating InheritanceDemands requires this default ctor, so we can annotate it. #if FEATURE_CORESYSTEM - [System.Security.SecurityCritical] #else - [System.Security.SecuritySafeCritical] #endif //FEATURE_CORESYSTEM private DirectoryInfo(){} - [System.Security.SecurityCritical] public static DirectoryInfo UnsafeCreateDirectoryInfo(String path) { if (path == null) @@ -57,7 +54,6 @@ namespace System.IO return di; } - [System.Security.SecuritySafeCritical] public DirectoryInfo(String path) { if (path==null) @@ -67,7 +63,6 @@ namespace System.IO Init(path, true); } - [System.Security.SecurityCritical] private void Init(String path, bool checkHost) { // Special case ":" to point to "" instead @@ -96,7 +91,6 @@ namespace System.IO } #if FEATURE_CORESYSTEM - [System.Security.SecuritySafeCritical] #endif //FEATURE_CORESYSTEM internal DirectoryInfo(String fullPath, bool junk) { @@ -109,7 +103,6 @@ namespace System.IO demandDir = new String[] {Directory.GetDemandDir(fullPath, true)}; } - [System.Security.SecurityCritical] // auto-generated private DirectoryInfo(SerializationInfo info, StreamingContext context) : base(info, context) { DisplayPath = GetDisplayName(OriginalPath, FullPath); @@ -125,7 +118,6 @@ namespace System.IO } public DirectoryInfo Parent { - [System.Security.SecuritySafeCritical] get { String parentName; // FullPath might be either "c:\bar" or "c:\bar\". Handle @@ -147,7 +139,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] public DirectoryInfo CreateSubdirectory(String path) { if (path == null) throw new ArgumentNullException(nameof(path)); @@ -156,7 +147,6 @@ namespace System.IO return CreateSubdirectory(path, null); } - [System.Security.SecurityCritical] // auto-generated public DirectoryInfo CreateSubdirectory(String path, Object directorySecurity) { if (path == null) @@ -166,7 +156,6 @@ namespace System.IO return CreateSubdirectoryHelper(path, directorySecurity); } - [System.Security.SecurityCritical] // auto-generated private DirectoryInfo CreateSubdirectoryHelper(String path, Object directorySecurity) { Contract.Requires(path != null); @@ -201,7 +190,6 @@ namespace System.IO // contents. // public override bool Exists { - [System.Security.SecuritySafeCritical] // auto-generated get { try @@ -460,7 +448,6 @@ namespace System.IO // public DirectoryInfo Root { - [System.Security.SecuritySafeCritical] get { String demandPath; @@ -478,7 +465,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] public void MoveTo(String destDirName) { if (destDirName==null) throw new ArgumentNullException(nameof(destDirName)); @@ -550,13 +536,11 @@ namespace System.IO _dataInitialised = -1; } - [System.Security.SecuritySafeCritical] public override void Delete() { Directory.Delete(FullPath, OriginalPath, false, true); } - [System.Security.SecuritySafeCritical] public void Delete(bool recursive) { Directory.Delete(FullPath, OriginalPath, recursive, true); diff --git a/src/coreclr/src/mscorlib/src/System/IO/DriveInfo.cs b/src/coreclr/src/mscorlib/src/System/IO/DriveInfo.cs index efb322b..174811d 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/DriveInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/DriveInfo.cs @@ -53,7 +53,6 @@ namespace System.IO private const String NameField = "_name"; // For serialization - [System.Security.SecuritySafeCritical] // auto-generated public DriveInfo(String driveName) { if (driveName == null) @@ -88,7 +87,6 @@ namespace System.IO new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPath).Demand(); } - [System.Security.SecurityCritical] // auto-generated private DriveInfo(SerializationInfo info, StreamingContext context) { // Need to add in a security check here once it has been spec'ed. @@ -104,7 +102,6 @@ namespace System.IO } public DriveType DriveType { - [System.Security.SecuritySafeCritical] // auto-generated get { // GetDriveType can't fail return (DriveType) Win32Native.GetDriveType(Name); @@ -112,7 +109,6 @@ namespace System.IO } public String DriveFormat { - [System.Security.SecuritySafeCritical] // auto-generated get { const int volNameLen = 50; StringBuilder volumeName = new StringBuilder(volNameLen); @@ -136,14 +132,12 @@ namespace System.IO } public bool IsReady { - [System.Security.SecuritySafeCritical] // auto-generated get { return Directory.InternalExists(Name); } } public long AvailableFreeSpace { - [System.Security.SecuritySafeCritical] // auto-generated get { long userBytes, totalBytes, freeBytes; int oldMode = Win32Native.SetErrorMode(Win32Native.SEM_FAILCRITICALERRORS); @@ -160,7 +154,6 @@ namespace System.IO } public long TotalFreeSpace { - [System.Security.SecuritySafeCritical] // auto-generated get { long userBytes, totalBytes, freeBytes; int oldMode = Win32Native.SetErrorMode(Win32Native.SEM_FAILCRITICALERRORS); @@ -177,7 +170,6 @@ namespace System.IO } public long TotalSize { - [System.Security.SecuritySafeCritical] // auto-generated get { // Don't cache this, to handle variable sized floppy drives // or other various removable media drives. @@ -213,7 +205,6 @@ namespace System.IO // Null is a valid volume label. public String VolumeLabel { - [System.Security.SecuritySafeCritical] // auto-generated get { // NTFS uses a limit of 32 characters for the volume label, // as of Windows Server 2003. @@ -240,7 +231,6 @@ namespace System.IO } return volumeName.ToString(); } - [System.Security.SecuritySafeCritical] // auto-generated set { String demandPath = _name + '.'; new FileIOPermission(FileIOPermissionAccess.Write, demandPath).Demand(); @@ -269,7 +259,6 @@ namespace System.IO #if FEATURE_SERIALIZATION /// - [System.Security.SecurityCritical] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // No need for an additional security check - everything is public. diff --git a/src/coreclr/src/mscorlib/src/System/IO/File.cs b/src/coreclr/src/mscorlib/src/System/IO/File.cs index c4b7c68..da58cdd 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/File.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/File.cs @@ -108,7 +108,6 @@ namespace System.IO InternalCopy(sourceFileName, destFileName, overwrite, true); } - [System.Security.SecurityCritical] internal static void UnsafeCopy(String sourceFileName, String destFileName, bool overwrite) { if (sourceFileName == null) throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName")); @@ -126,7 +125,6 @@ namespace System.IO /// /// Note: This returns the fully qualified name of the destination file. /// - [System.Security.SecuritySafeCritical] internal static String InternalCopy(String sourceFileName, String destFileName, bool overwrite, bool checkHost) { Contract.Requires(sourceFileName != null); @@ -202,7 +200,6 @@ namespace System.IO // // Your application must have Delete permission to the target file. // - [System.Security.SecuritySafeCritical] public static void Delete(String path) { if (path == null) throw new ArgumentNullException(nameof(path)); @@ -211,7 +208,6 @@ namespace System.IO InternalDelete(path, true); } - [System.Security.SecurityCritical] internal static void UnsafeDelete(String path) { if (path == null) @@ -221,7 +217,6 @@ namespace System.IO InternalDelete(path, false); } - [System.Security.SecurityCritical] internal static void InternalDelete(String path, bool checkHost) { String fullPath = Path.GetFullPath(path); @@ -243,7 +238,6 @@ namespace System.IO } - [System.Security.SecuritySafeCritical] // auto-generated public static void Decrypt(String path) { if (path == null) @@ -267,7 +261,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] // auto-generated public static void Encrypt(String path) { if (path == null) @@ -298,19 +291,16 @@ namespace System.IO // // Your application must have Read permission for the target directory. // - [System.Security.SecuritySafeCritical] public static bool Exists(String path) { return InternalExistsHelper(path, true); } - [System.Security.SecurityCritical] internal static bool UnsafeExists(String path) { return InternalExistsHelper(path, false); } - [System.Security.SecurityCritical] private static bool InternalExistsHelper(String path, bool checkHost) { try @@ -351,7 +341,6 @@ namespace System.IO return false; } - [System.Security.SecurityCritical] // auto-generated internal static bool InternalExists(String path) { Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); int dataInitialised = FillAttributeInfo(path, ref data, false, true); @@ -372,19 +361,16 @@ namespace System.IO return new FileStream(path, mode, access, share); } - [System.Security.SecuritySafeCritical] public static DateTime GetCreationTime(String path) { return InternalGetCreationTimeUtc(path, true).ToLocalTime(); } - [System.Security.SecuritySafeCritical] // auto-generated public static DateTime GetCreationTimeUtc(String path) { return InternalGetCreationTimeUtc(path, false); // this API isn't exposed in Silverlight } - [System.Security.SecurityCritical] private static DateTime InternalGetCreationTimeUtc(String path, bool checkHost) { String fullPath = Path.GetFullPath(path); @@ -404,19 +390,16 @@ namespace System.IO return DateTime.FromFileTimeUtc(dt); } - [System.Security.SecuritySafeCritical] public static DateTime GetLastAccessTime(String path) { return InternalGetLastAccessTimeUtc(path, true).ToLocalTime(); } - [System.Security.SecuritySafeCritical] // auto-generated public static DateTime GetLastAccessTimeUtc(String path) { return InternalGetLastAccessTimeUtc(path, false); // this API isn't exposed in Silverlight } - [System.Security.SecurityCritical] private static DateTime InternalGetLastAccessTimeUtc(String path, bool checkHost) { String fullPath = Path.GetFullPath(path); @@ -436,19 +419,16 @@ namespace System.IO return DateTime.FromFileTimeUtc(dt); } - [System.Security.SecuritySafeCritical] public static DateTime GetLastWriteTime(String path) { return InternalGetLastWriteTimeUtc(path, true).ToLocalTime(); } - [System.Security.SecuritySafeCritical] // auto-generated public static DateTime GetLastWriteTimeUtc(String path) { return InternalGetLastWriteTimeUtc(path, false); // this API isn't exposed in Silverlight } - [System.Security.SecurityCritical] private static DateTime InternalGetLastWriteTimeUtc(String path, bool checkHost) { String fullPath = Path.GetFullPath(path); @@ -468,7 +448,6 @@ namespace System.IO return DateTime.FromFileTimeUtc(dt); } - [System.Security.SecuritySafeCritical] public static FileAttributes GetAttributes(String path) { String fullPath = Path.GetFullPath(path); @@ -484,7 +463,6 @@ namespace System.IO return (FileAttributes) data.fileAttributes; } - [System.Security.SecurityCritical] public static void SetAttributes(String path, FileAttributes fileAttributes) { String fullPath = Path.GetFullPath(path); @@ -507,7 +485,6 @@ namespace System.IO FileAccess.Write, FileShare.None); } - [System.Security.SecuritySafeCritical] // auto-generated public static String ReadAllText(String path) { if (path == null) @@ -519,7 +496,6 @@ namespace System.IO return InternalReadAllText(path, Encoding.UTF8, true); } - [System.Security.SecuritySafeCritical] // auto-generated public static String ReadAllText(String path, Encoding encoding) { if (path == null) @@ -533,7 +509,6 @@ namespace System.IO return InternalReadAllText(path, encoding, true); } - [System.Security.SecurityCritical] internal static String UnsafeReadAllText(String path) { if (path == null) @@ -545,7 +520,6 @@ namespace System.IO return InternalReadAllText(path, Encoding.UTF8, false); } - [System.Security.SecurityCritical] private static String InternalReadAllText(String path, Encoding encoding, bool checkHost) { Contract.Requires(path != null); @@ -556,7 +530,6 @@ namespace System.IO return sr.ReadToEnd(); } - [System.Security.SecuritySafeCritical] // auto-generated public static void WriteAllText(String path, String contents) { if (path == null) @@ -568,7 +541,6 @@ namespace System.IO InternalWriteAllText(path, contents, StreamWriter.UTF8NoBOM, true); } - [System.Security.SecuritySafeCritical] // auto-generated public static void WriteAllText(String path, String contents, Encoding encoding) { if (path == null) @@ -582,7 +554,6 @@ namespace System.IO InternalWriteAllText(path, contents, encoding, true); } - [System.Security.SecurityCritical] internal static void UnsafeWriteAllText(String path, String contents) { if (path == null) @@ -594,7 +565,6 @@ namespace System.IO InternalWriteAllText(path, contents, StreamWriter.UTF8NoBOM, false); } - [System.Security.SecurityCritical] private static void InternalWriteAllText(String path, String contents, Encoding encoding, bool checkHost) { Contract.Requires(path != null); @@ -605,20 +575,17 @@ namespace System.IO sw.Write(contents); } - [System.Security.SecuritySafeCritical] // auto-generated public static byte[] ReadAllBytes(String path) { return InternalReadAllBytes(path, true); } - [System.Security.SecurityCritical] internal static byte[] UnsafeReadAllBytes(String path) { return InternalReadAllBytes(path, false); } - [System.Security.SecurityCritical] private static byte[] InternalReadAllBytes(String path, bool checkHost) { byte[] bytes; @@ -642,7 +609,6 @@ namespace System.IO return bytes; } - [System.Security.SecuritySafeCritical] // auto-generated public static void WriteAllBytes(String path, byte[] bytes) { if (path == null) @@ -656,7 +622,6 @@ namespace System.IO InternalWriteAllBytes(path, bytes, true); } - [System.Security.SecurityCritical] internal static void UnsafeWriteAllBytes(String path, byte[] bytes) { if (path == null) @@ -670,7 +635,6 @@ namespace System.IO InternalWriteAllBytes(path, bytes, false); } - [System.Security.SecurityCritical] private static void InternalWriteAllBytes(String path, byte[] bytes, bool checkHost) { Contract.Requires(path != null); @@ -888,17 +852,14 @@ namespace System.IO // sourceFileName and Write // permissions to destFileName. // - [System.Security.SecuritySafeCritical] public static void Move(String sourceFileName, String destFileName) { InternalMove(sourceFileName, destFileName, true); } - [System.Security.SecurityCritical] internal static void UnsafeMove(String sourceFileName, String destFileName) { InternalMove(sourceFileName, destFileName, false); } - [System.Security.SecurityCritical] private static void InternalMove(String sourceFileName, String destFileName, bool checkHost) { if (sourceFileName == null) throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName")); @@ -952,7 +913,6 @@ namespace System.IO InternalReplace(sourceFileName, destinationFileName, destinationBackupFileName, ignoreMetadataErrors); } - [System.Security.SecuritySafeCritical] private static void InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, bool ignoreMetadataErrors) { Contract.Requires(sourceFileName != null); @@ -985,7 +945,6 @@ namespace System.IO // Returns 0 on success, otherwise a Win32 error code. Note that // classes should use -1 as the uninitialized state for dataInitialized. - [System.Security.SecurityCritical] // auto-generated internal static int FillAttributeInfo(String path, ref Win32Native.WIN32_FILE_ATTRIBUTE_DATA data, bool tryagain, bool returnErrorOnNotFound) { int dataInitialised = 0; diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileInfo.cs b/src/coreclr/src/mscorlib/src/System/IO/FileInfo.cs index 5641951..23cf9cce 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileInfo.cs @@ -37,13 +37,10 @@ namespace System.IO // Migrating InheritanceDemands requires this default ctor, so we can annotate it. #if FEATURE_CORESYSTEM - [System.Security.SecurityCritical] #else - [System.Security.SecuritySafeCritical] #endif //FEATURE_CORESYSTEM private FileInfo(){} - [System.Security.SecurityCritical] public static FileInfo UnsafeCreateFileInfo(String fileName) { if (fileName == null) @@ -55,7 +52,6 @@ namespace System.IO return fi; } - [System.Security.SecuritySafeCritical] public FileInfo(String fileName) { if (fileName == null) @@ -65,7 +61,6 @@ namespace System.IO Init(fileName, true); } - [System.Security.SecurityCritical] private void Init(String fileName, bool checkHost) { OriginalPath = fileName; @@ -88,7 +83,6 @@ namespace System.IO return Path.GetFileName(originalPath); } - [System.Security.SecurityCritical] // auto-generated private FileInfo(SerializationInfo info, StreamingContext context) : base(info, context) { _name = Path.GetFileName(OriginalPath); @@ -96,7 +90,6 @@ namespace System.IO } #if FEATURE_CORESYSTEM - [System.Security.SecuritySafeCritical] #endif //FEATURE_CORESYSTEM internal FileInfo(String fullPath, bool ignoreThis) { @@ -112,7 +105,6 @@ namespace System.IO } public long Length { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_dataInitialised == -1) Refresh(); @@ -130,7 +122,6 @@ namespace System.IO /* Returns the name of the directory that the file is in */ public String DirectoryName { - [System.Security.SecuritySafeCritical] get { String directoryName = Path.GetDirectoryName(FullPath); @@ -167,7 +158,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] // auto-generated public StreamReader OpenText() { return new StreamReader(FullPath, Encoding.UTF8, true, StreamReader.DefaultBufferSize, false); @@ -239,7 +229,6 @@ namespace System.IO // // Your application must have Delete permission to the target file. // - [System.Security.SecuritySafeCritical] public override void Delete() { FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, DisplayPath, FullPath); @@ -273,7 +262,6 @@ namespace System.IO // // Your application must have Read permission for the target directory. public override bool Exists { - [System.Security.SecuritySafeCritical] // auto-generated get { try { if (_dataInitialised == -1) @@ -306,7 +294,6 @@ namespace System.IO return new FileStream(FullPath, mode, access, share); } - [System.Security.SecuritySafeCritical] // auto-generated public FileStream OpenRead() { return new FileStream(FullPath, FileMode.Open, FileAccess.Read, @@ -326,7 +313,6 @@ namespace System.IO // sourceFileName and Write // permissions to destFileName. // - [System.Security.SecuritySafeCritical] public void MoveTo(String destFileName) { if (destFileName==null) throw new ArgumentNullException(nameof(destFileName)); diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileLoadException.cs b/src/coreclr/src/mscorlib/src/System/IO/FileLoadException.cs index 508082e..2b56c00 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileLoadException.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileLoadException.cs @@ -135,11 +135,9 @@ namespace System.IO { } public String FusionLog { - [System.Security.SecuritySafeCritical] // auto-generated get { return _fusionLog; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { // Serialize data for our base classes. base will verify info != null. base.GetObjectData(info, context); @@ -156,7 +154,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated internal static String FormatFileLoadExceptionMessage(String fileName, int hResult) { @@ -169,12 +166,10 @@ namespace System.IO { return String.Format(CultureInfo.CurrentCulture, format, fileName, message); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetFileLoadExceptionMessage(int hResult, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetMessageForHR(int hresult, StringHandleOnStack retString); diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileNotFoundException.cs b/src/coreclr/src/mscorlib/src/System/IO/FileNotFoundException.cs index 67230f9..8cc75f8 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileNotFoundException.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileNotFoundException.cs @@ -136,11 +136,9 @@ namespace System.IO { } public String FusionLog { - [System.Security.SecuritySafeCritical] // auto-generated get { return _fusionLog; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { // Serialize data for our base classes. base will verify info != null. base.GetObjectData(info, context); diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileSecurityState.cs b/src/coreclr/src/mscorlib/src/System/IO/FileSecurityState.cs index f5a3f63..d10681f 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileSecurityState.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileSecurityState.cs @@ -22,7 +22,6 @@ using System.Security.Permissions; namespace System.IO { - [SecurityCritical] [System.Runtime.CompilerServices.FriendAccessAllowed] internal class FileSecurityState : SecurityState { @@ -35,7 +34,6 @@ namespace System.IO private String m_canonicalizedPath; // default ctor needed for security rule consistency - [SecurityCritical] private FileSecurityState() { } @@ -88,9 +86,6 @@ namespace System.IO } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override void EnsureState() { // this is the case for empty string machine name, etc diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs b/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs index 21e355d..9054621 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs @@ -168,7 +168,6 @@ namespace System.IO private List searchStack; private Directory.SearchData searchData; private String searchCriteria; - [System.Security.SecurityCritical] SafeFindHandle _hnd = null; bool needsParentPathDiscoveryDemand; @@ -187,7 +186,6 @@ namespace System.IO private int oldMode; private bool _checkHost; - [System.Security.SecuritySafeCritical] internal FileSystemEnumerableIterator(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler resultHandler, bool checkHost) { Contract.Requires(path != null); @@ -254,7 +252,6 @@ namespace System.IO } - [System.Security.SecurityCritical] private void CommonInit() { Contract.Assert(searchCriteria != null && searchData != null, "searchCriteria and searchData should be initialized"); @@ -307,7 +304,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] private FileSystemEnumerableIterator(String fullPath, String normalizedSearchPath, String searchCriteria, String userPath, SearchOption searchOption, SearchResultHandler resultHandler, bool checkHost) { this.fullPath = fullPath; @@ -354,7 +350,6 @@ namespace System.IO return new FileSystemEnumerableIterator(fullPath, normalizedSearchPath, searchCriteria, userPath, searchOption, _resultHandler, _checkHost); } - [System.Security.SecuritySafeCritical] protected override void Dispose(bool disposing) { try @@ -371,7 +366,6 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] public override bool MoveNext() { Win32Native.WIN32_FIND_DATA data = new Win32Native.WIN32_FIND_DATA(); @@ -506,7 +500,6 @@ namespace System.IO return false; } - [System.Security.SecurityCritical] private SearchResult CreateSearchResult(Directory.SearchData localSearchData, Win32Native.WIN32_FIND_DATA findData) { String userPathFinal = Path.Combine(localSearchData.userPath, findData.cFileName); @@ -514,14 +507,12 @@ namespace System.IO return new SearchResult(fullPathFinal, userPathFinal, findData); } - [System.Security.SecurityCritical] private void HandleError(int hr, String path) { Dispose(); __Error.WinIOError(hr, path); } - [System.Security.SecurityCritical] // auto-generated private void AddSearchableDirsToStack(Directory.SearchData localSearchData) { Contract.Requires(localSearchData != null); @@ -578,7 +569,6 @@ namespace System.IO } } - [System.Security.SecurityCritical] internal void DoDemand(String fullPathToDemand) { #if FEATURE_CORECLR @@ -653,10 +643,8 @@ namespace System.IO internal abstract class SearchResultHandler { - [System.Security.SecurityCritical] internal abstract bool IsResultIncluded(SearchResult result); - [System.Security.SecurityCritical] internal abstract TSource CreateObject(SearchResult result); } @@ -672,7 +660,6 @@ namespace System.IO _includeDirs = includeDirs; } - [System.Security.SecurityCritical] internal override bool IsResultIncluded(SearchResult result) { bool includeFile = _includeFiles && FileSystemEnumerableHelpers.IsFile(result.FindData); @@ -681,7 +668,6 @@ namespace System.IO return (includeFile || includeDir); } - [System.Security.SecurityCritical] internal override String CreateObject(SearchResult result) { return result.UserPath; @@ -690,13 +676,11 @@ namespace System.IO internal class FileInfoResultHandler : SearchResultHandler { - [System.Security.SecurityCritical] internal override bool IsResultIncluded(SearchResult result) { return FileSystemEnumerableHelpers.IsFile(result.FindData); } - [System.Security.SecurityCritical] internal override FileInfo CreateObject(SearchResult result) { String name = result.FullPath; @@ -715,13 +699,11 @@ namespace System.IO internal class DirectoryInfoResultHandler : SearchResultHandler { - [System.Security.SecurityCritical] internal override bool IsResultIncluded(SearchResult result) { return FileSystemEnumerableHelpers.IsDir(result.FindData); } - [System.Security.SecurityCritical] internal override DirectoryInfo CreateObject(SearchResult result) { String name = result.FullPath; @@ -743,7 +725,6 @@ namespace System.IO internal class FileSystemInfoResultHandler : SearchResultHandler { - [System.Security.SecurityCritical] internal override bool IsResultIncluded(SearchResult result) { bool includeFile = FileSystemEnumerableHelpers.IsFile(result.FindData); @@ -753,7 +734,6 @@ namespace System.IO return (includeDir || includeFile); } - [System.Security.SecurityCritical] internal override FileSystemInfo CreateObject(SearchResult result) { bool isFile = FileSystemEnumerableHelpers.IsFile(result.FindData); @@ -799,10 +779,8 @@ namespace System.IO { private String fullPath; // fully-qualifed path private String userPath; // user-specified path - [System.Security.SecurityCritical] private Win32Native.WIN32_FIND_DATA findData; - [System.Security.SecurityCritical] internal SearchResult(String fullPath, String userPath, Win32Native.WIN32_FIND_DATA findData) { Contract.Requires(fullPath != null); @@ -825,7 +803,6 @@ namespace System.IO internal Win32Native.WIN32_FIND_DATA FindData { - [System.Security.SecurityCritical] get { return findData; } } @@ -833,7 +810,6 @@ namespace System.IO internal static class FileSystemEnumerableHelpers { - [System.Security.SecurityCritical] // auto-generated internal static bool IsDir(Win32Native.WIN32_FIND_DATA data) { // Don't add "." nor ".." @@ -841,7 +817,6 @@ namespace System.IO && !data.cFileName.Equals(".") && !data.cFileName.Equals(".."); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsFile(Win32Native.WIN32_FIND_DATA data) { return 0 == (data.dwFileAttributes & Win32Native.FILE_ATTRIBUTE_DIRECTORY); diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileSystemInfo.cs b/src/coreclr/src/mscorlib/src/System/IO/FileSystemInfo.cs index f088235..be2189c 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileSystemInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileSystemInfo.cs @@ -21,7 +21,6 @@ namespace System.IO [ComVisible(true)] public abstract class FileSystemInfo : MarshalByRefObject, ISerializable { - [System.Security.SecurityCritical] // auto-generated internal Win32Native.WIN32_FILE_ATTRIBUTE_DATA _data; // Cache the file information internal int _dataInitialised = -1; // We use this field in conjunction with the Refresh methods, if we succeed // we store a zero, on failure we store the HResult in it so that we can @@ -35,9 +34,7 @@ namespace System.IO private String _displayPath = ""; // path that can be displayed to the user #if FEATURE_CORESYSTEM - [System.Security.SecurityCritical] #else - [System.Security.SecuritySafeCritical] #endif //FEATURE_CORESYSTEM protected FileSystemInfo() { @@ -58,7 +55,6 @@ namespace System.IO _dataInitialised = -1; } - [System.Security.SecurityCritical] internal void InitializeFrom(Win32Native.WIN32_FIND_DATA findData) { _data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); @@ -68,7 +64,6 @@ namespace System.IO // Full path of the direcory/file public virtual String FullName { - [System.Security.SecuritySafeCritical] get { String demandDir; @@ -85,7 +80,6 @@ namespace System.IO internal virtual String UnsafeGetFullName { - [System.Security.SecurityCritical] get { String demandDir; @@ -139,7 +133,6 @@ namespace System.IO [ComVisible(false)] public DateTime CreationTimeUtc { - [System.Security.SecuritySafeCritical] get { // get_CreationTime also depends on this security check FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath); @@ -172,7 +165,6 @@ namespace System.IO [ComVisible(false)] public DateTime LastAccessTimeUtc { - [System.Security.SecuritySafeCritical] get { // get_LastAccessTime also depends on this security check FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath); @@ -209,7 +201,6 @@ namespace System.IO [ComVisible(false)] public DateTime LastWriteTimeUtc { - [System.Security.SecuritySafeCritical] get { // get_LastWriteTime also depends on this security check FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath); @@ -231,14 +222,12 @@ namespace System.IO } } - [System.Security.SecuritySafeCritical] // auto-generated public void Refresh() { _dataInitialised = File.FillAttributeInfo(FullPath, ref _data, false, false); } public FileAttributes Attributes { - [System.Security.SecuritySafeCritical] get { FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath); @@ -255,7 +244,6 @@ namespace System.IO return (FileAttributes) _data.fileAttributes; } - [System.Security.SecurityCritical] // auto-generated set { bool r = Win32Native.SetFileAttributes(FullPath, (int) value); if (!r) { @@ -275,7 +263,6 @@ namespace System.IO } } - [System.Security.SecurityCritical] // auto-generated_required [ComVisible(false)] public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { diff --git a/src/coreclr/src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs b/src/coreclr/src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs index 4fd54f5..a9b04b2 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs @@ -24,10 +24,8 @@ namespace System.IO { private GCHandle _pinningHandle; // The new inheritance model requires a Critical default ctor since base (UnmanagedMemoryStream) has one - [System.Security.SecurityCritical] private PinnedBufferMemoryStream():base(){} - [System.Security.SecurityCritical] // auto-generated internal PinnedBufferMemoryStream(byte[] array) { Contract.Assert(array != null, "Array can't be null"); @@ -52,7 +50,6 @@ namespace System.IO { Dispose(false); } - [System.Security.SecuritySafeCritical] // auto-generated protected override void Dispose(bool disposing) { if (_isOpen) { diff --git a/src/coreclr/src/mscorlib/src/System/IO/Stream.cs b/src/coreclr/src/mscorlib/src/System/IO/Stream.cs index 4b52e87..1d4441a 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/Stream.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/Stream.cs @@ -448,7 +448,6 @@ namespace System.IO { : BeginEndReadAsync(buffer, offset, count); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool HasOverriddenBeginEndRead(); @@ -654,7 +653,6 @@ namespace System.IO { _buffer = null; } - [SecuritySafeCritical] // necessary for EC.Capture [MethodImpl(MethodImplOptions.NoInlining)] public ReadWriteTask( bool isRead, @@ -692,7 +690,6 @@ namespace System.IO { } } - [SecurityCritical] // necessary for CoreCLR private static void InvokeAsyncCallback(object completedTask) { var rwc = (ReadWriteTask)completedTask; @@ -701,10 +698,8 @@ namespace System.IO { callback(rwc); } - [SecurityCritical] // necessary for CoreCLR private static ContextCallback s_invokeAsyncCallback; - [SecuritySafeCritical] // necessary for ExecutionContext.Run void ITaskCompletionAction.Invoke(Task completingTask) { // Get the ExecutionContext. If there is none, just run the callback @@ -751,7 +746,6 @@ namespace System.IO { : BeginEndWriteAsync(buffer, offset, count); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool HasOverriddenBeginEndWrite(); diff --git a/src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs b/src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs index 3b55805..d74dccf 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs @@ -187,12 +187,10 @@ namespace System.IO : this(path, encoding, detectEncodingFromByteOrderMarks, DefaultBufferSize) { } - [System.Security.SecuritySafeCritical] public StreamReader(String path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : this(path, encoding, detectEncodingFromByteOrderMarks, bufferSize, true) { } - [System.Security.SecurityCritical] internal StreamReader(String path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool checkHost) { // Don't open a Stream before checking for invalid arguments, diff --git a/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs b/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs index 61c96e6..bb4aee7 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs @@ -143,11 +143,9 @@ namespace System.IO : this(path, append, encoding, DefaultBufferSize) { } - [System.Security.SecuritySafeCritical] public StreamWriter(String path, bool append, Encoding encoding, int bufferSize): this(path, append, encoding, bufferSize, true) { } - [System.Security.SecurityCritical] internal StreamWriter(String path, bool append, Encoding encoding, int bufferSize, bool checkHost) : base(null) { // Ask for CurrentCulture all the time @@ -164,7 +162,6 @@ namespace System.IO Init(stream, encoding, bufferSize, false); } - [System.Security.SecuritySafeCritical] private void Init(Stream streamArg, Encoding encodingArg, int bufferSize, bool shouldLeaveOpen) { this.stream = streamArg; @@ -189,7 +186,6 @@ namespace System.IO #endif } - [System.Security.SecurityCritical] private static Stream CreateFile(String path, bool append, bool checkHost) { FileMode mode = append? FileMode.Append: FileMode.Create; FileStream f = new FileStream(path, mode, FileAccess.Write, FileShare.Read, diff --git a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs index 354e7a9..6149dbc 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs @@ -28,7 +28,6 @@ namespace System.IO { /// this gives better throughput; benchmarks showed about 12-15% better. public class UnmanagedMemoryAccessor : IDisposable { - [System.Security.SecurityCritical] // auto-generated private SafeBuffer _buffer; private Int64 _offset; [ContractPublicPropertyName("Capacity")] @@ -46,20 +45,14 @@ namespace System.IO { // // // - [System.Security.SecuritySafeCritical] public UnmanagedMemoryAccessor(SafeBuffer buffer, Int64 offset, Int64 capacity) { Initialize(buffer, offset, capacity, FileAccess.Read); } - [System.Security.SecuritySafeCritical] // auto-generated public UnmanagedMemoryAccessor(SafeBuffer buffer, Int64 offset, Int64 capacity, FileAccess access) { Initialize(buffer, offset, capacity, access); } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 protected void Initialize(SafeBuffer buffer, Int64 offset, Int64 capacity, FileAccess access) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); @@ -155,7 +148,6 @@ namespace System.IO { return InternalReadByte(position); } - [System.Security.SecuritySafeCritical] // auto-generated public char ReadChar(Int64 position) { int sizeOfType = sizeof(char); EnsureSafeToRead(position, sizeOfType); @@ -192,7 +184,6 @@ namespace System.IO { } // See comment above. - [System.Security.SecuritySafeCritical] public Int16 ReadInt16(Int64 position) { int sizeOfType = sizeof(Int16); EnsureSafeToRead(position, sizeOfType); @@ -229,7 +220,6 @@ namespace System.IO { } - [System.Security.SecuritySafeCritical] // auto-generated public Int32 ReadInt32(Int64 position) { int sizeOfType = sizeof(Int32); EnsureSafeToRead(position, sizeOfType); @@ -264,7 +254,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated public Int64 ReadInt64(Int64 position) { int sizeOfType = sizeof(Int64); EnsureSafeToRead(position, sizeOfType); @@ -301,7 +290,6 @@ namespace System.IO { return result; } - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.AggressiveInlining)] private unsafe Int32 UnsafeReadInt32(byte* pointer) { @@ -318,7 +306,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated public Decimal ReadDecimal(Int64 position) { const int ScaleMask = 0x00FF0000; const int SignMask = unchecked((int)0x80000000); @@ -360,7 +347,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public Single ReadSingle(Int64 position) { int sizeOfType = sizeof(Single); EnsureSafeToRead(position, sizeOfType); @@ -396,7 +382,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated public Double ReadDouble(Int64 position) { int sizeOfType = sizeof(Double); EnsureSafeToRead(position, sizeOfType); @@ -436,7 +421,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public SByte ReadSByte(Int64 position) { int sizeOfType = sizeof(SByte); @@ -461,7 +445,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public UInt16 ReadUInt16(Int64 position) { int sizeOfType = sizeof(UInt16); @@ -498,7 +481,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public UInt32 ReadUInt32(Int64 position) { int sizeOfType = sizeof(UInt32); @@ -535,7 +517,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public UInt64 ReadUInt64(Int64 position) { int sizeOfType = sizeof(UInt64); @@ -588,7 +569,6 @@ namespace System.IO { // such, it is best to use the ReadXXX methods for small standard types such as ints, longs, // bools, etc. - [System.Security.SecurityCritical] // auto-generated_required public void Read(Int64 position, out T structure) where T : struct { if (position < 0) { throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -621,7 +601,6 @@ namespace System.IO { // struct that contains reference members will most likely cause the runtime to AV. This // is consistent with Marshal.PtrToStructure. - [System.Security.SecurityCritical] // auto-generated_required public int ReadArray(Int64 position, T[] array, Int32 offset, Int32 count) where T : struct { if (array == null) { throw new ArgumentNullException(nameof(array), "Buffer cannot be null."); @@ -695,7 +674,6 @@ namespace System.IO { InternalWrite(position, value); } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, char value) { int sizeOfType = sizeof(char); EnsureSafeToWrite(position, sizeOfType); @@ -730,7 +708,6 @@ namespace System.IO { } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Int16 value) { int sizeOfType = sizeof(Int16); EnsureSafeToWrite(position, sizeOfType); @@ -764,7 +741,6 @@ namespace System.IO { } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Int32 value) { int sizeOfType = sizeof(Int32); EnsureSafeToWrite(position, sizeOfType); @@ -799,7 +775,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Int64 value) { int sizeOfType = sizeof(Int64); EnsureSafeToWrite(position, sizeOfType); @@ -837,7 +812,6 @@ namespace System.IO { } } - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.AggressiveInlining)] private unsafe void UnsafeWriteInt32(byte* pointer, Int32 value) { @@ -855,7 +829,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Decimal value) { int sizeOfType = sizeof(Decimal); EnsureSafeToWrite(position, sizeOfType); @@ -889,7 +862,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Single value) { int sizeOfType = sizeof(Single); EnsureSafeToWrite(position, sizeOfType); @@ -925,7 +897,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public void Write(Int64 position, Double value) { int sizeOfType = sizeof(Double); EnsureSafeToWrite(position, sizeOfType); @@ -965,7 +936,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public void Write(Int64 position, SByte value) { int sizeOfType = sizeof(SByte); @@ -987,7 +957,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public void Write(Int64 position, UInt16 value) { int sizeOfType = sizeof(UInt16); @@ -1021,7 +990,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public void Write(Int64 position, UInt32 value) { int sizeOfType = sizeof(UInt32); @@ -1058,7 +1026,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public void Write(Int64 position, UInt64 value) { int sizeOfType = sizeof(UInt64); @@ -1103,7 +1070,6 @@ namespace System.IO { // though this is number is JIT and architecture dependent). As such, it is best to use // the WriteX methods for small standard types such as ints, longs, bools, etc. - [System.Security.SecurityCritical] // auto-generated_required public void Write(Int64 position, ref T structure) where T : struct { if (position < 0) { throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -1133,7 +1099,6 @@ namespace System.IO { // Writes 'count' structs of type T from 'array' (starting at 'offset') into unmanaged memory. - [System.Security.SecurityCritical] // auto-generated_required public void WriteArray(Int64 position, T[] array, Int32 offset, Int32 count) where T : struct { if (array == null) { throw new ArgumentNullException(nameof(array), "Buffer cannot be null."); @@ -1165,7 +1130,6 @@ namespace System.IO { _buffer.WriteArray((UInt64)(_offset + position), array, offset, count); } - [System.Security.SecuritySafeCritical] // auto-generated private byte InternalReadByte(Int64 position) { Contract.Assert(CanRead, "UMA not readable"); Contract.Assert(position >= 0, "position less than 0"); @@ -1188,7 +1152,6 @@ namespace System.IO { return result; } - [System.Security.SecuritySafeCritical] // auto-generated private void InternalWrite(Int64 position, byte value) { Contract.Assert(CanWrite, "UMA not writable"); Contract.Assert(position >= 0, "position less than 0"); diff --git a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs index 8573428..7ddfb46 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs @@ -85,9 +85,7 @@ namespace System.IO { { private const long UnmanagedMemStreamMaxLength = Int64.MaxValue; - [System.Security.SecurityCritical] // auto-generated private SafeBuffer _buffer; - [SecurityCritical] private unsafe byte* _mem; private long _length; private long _capacity; @@ -100,7 +98,6 @@ namespace System.IO { // Needed for subclasses that need to map a file, etc. - [System.Security.SecuritySafeCritical] // auto-generated protected UnmanagedMemoryStream() { unsafe { @@ -109,12 +106,10 @@ namespace System.IO { _isOpen = false; } - [System.Security.SecuritySafeCritical] // auto-generated public UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length) { Initialize(buffer, offset, length, FileAccess.Read, false); } - [System.Security.SecuritySafeCritical] // auto-generated public UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length, FileAccess access) { Initialize(buffer, offset, length, access, false); } @@ -122,17 +117,14 @@ namespace System.IO { // We must create one of these without doing a security check. This // class is created while security is trying to start up. Plus, doing // a Demand from Assembly.GetManifestResourceStream isn't useful. - [System.Security.SecurityCritical] // auto-generated internal UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length, FileAccess access, bool skipSecurityCheck) { Initialize(buffer, offset, length, access, skipSecurityCheck); } - [System.Security.SecuritySafeCritical] // auto-generated protected void Initialize(SafeBuffer buffer, long offset, long length, FileAccess access) { Initialize(buffer, offset, length, access, false); } - [System.Security.SecurityCritical] // auto-generated internal void Initialize(SafeBuffer buffer, long offset, long length, FileAccess access, bool skipSecurityCheck) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); @@ -185,14 +177,12 @@ namespace System.IO { _isOpen = true; } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe UnmanagedMemoryStream(byte* pointer, long length) { Initialize(pointer, length, length, FileAccess.Read, false); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, FileAccess access) { @@ -202,20 +192,17 @@ namespace System.IO { // We must create one of these without doing a security check. This // class is created while security is trying to start up. Plus, doing // a Demand from Assembly.GetManifestResourceStream isn't useful. - [System.Security.SecurityCritical] // auto-generated internal unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, FileAccess access, bool skipSecurityCheck) { Initialize(pointer, length, capacity, access, skipSecurityCheck); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] protected unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access) { Initialize(pointer, length, capacity, access, false); } - [System.Security.SecurityCritical] // auto-generated internal unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access, bool skipSecurityCheck) { if (pointer == null) @@ -262,7 +249,6 @@ namespace System.IO { get { return _isOpen && (_access & FileAccess.Write) != 0; } } - [System.Security.SecuritySafeCritical] // auto-generated protected override void Dispose(bool disposing) { _isOpen = false; @@ -317,7 +303,6 @@ namespace System.IO { Contract.EndContractBlock(); return Interlocked.Read(ref _position); } - [System.Security.SecuritySafeCritical] // auto-generated set { if (value < 0) throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -337,7 +322,6 @@ namespace System.IO { [CLSCompliant(false)] public unsafe byte* PositionPointer { - [System.Security.SecurityCritical] // auto-generated_required get { if (_buffer != null) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer")); @@ -351,7 +335,6 @@ namespace System.IO { if (!_isOpen) __Error.StreamIsClosed(); return ptr; } - [System.Security.SecurityCritical] // auto-generated_required set { if (_buffer != null) throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer")); @@ -369,7 +352,6 @@ namespace System.IO { } internal unsafe byte* Pointer { - [System.Security.SecurityCritical] // auto-generated get { if (_buffer != null) throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer")); @@ -378,7 +360,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public override int Read([In, Out] byte[] buffer, int offset, int count) { if (buffer==null) throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer")); @@ -469,7 +450,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public override int ReadByte() { if (!_isOpen) __Error.StreamIsClosed(); if (!CanRead) __Error.ReadNotSupported(); @@ -537,7 +517,6 @@ namespace System.IO { return finalPos; } - [System.Security.SecuritySafeCritical] // auto-generated public override void SetLength(long value) { if (value < 0) throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -563,7 +542,6 @@ namespace System.IO { } } - [System.Security.SecuritySafeCritical] // auto-generated public override void Write(byte[] buffer, int offset, int count) { if (buffer==null) throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer")); @@ -671,7 +649,6 @@ namespace System.IO { } - [System.Security.SecuritySafeCritical] // auto-generated public override void WriteByte(byte value) { if (!_isOpen) __Error.StreamIsClosed(); if (!CanWrite) __Error.WriteNotSupported(); diff --git a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs index 6b25b08..040ddbb 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs @@ -106,7 +106,6 @@ namespace System.IO { return _unmanagedStream.Seek(offset, loc); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override byte[] ToArray() { if (!_unmanagedStream._isOpen) __Error.StreamIsClosed(); if (!_unmanagedStream.CanRead) __Error.ReadNotSupported(); diff --git a/src/coreclr/src/mscorlib/src/System/IO/__Error.cs b/src/coreclr/src/mscorlib/src/System/IO/__Error.cs index af9c502..ad4972d 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/__Error.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/__Error.cs @@ -74,7 +74,6 @@ namespace System.IO { // discovery permission to that path. If we do not, return just the // file name. If we know it is a directory, then don't return the // directory name. - [System.Security.SecurityCritical] // auto-generated internal static String GetDisplayablePath(String path, bool isInvalidPath) { @@ -122,7 +121,6 @@ namespace System.IO { return path; } - [System.Security.SecuritySafeCritical] // auto-generated internal static void WinIOError() { int errorCode = Marshal.GetLastWin32Error(); WinIOError(errorCode, String.Empty); @@ -133,7 +131,6 @@ namespace System.IO { // will determine the appropriate exception to throw dependent on your // error, and depending on the error, insert a string into the message // gotten from the ResourceManager. - [System.Security.SecurityCritical] // auto-generated internal static void WinIOError(int errorCode, String maybeFullPath) { // This doesn't have to be perfect, but is a perf optimization. bool isInvalidPath = errorCode == Win32Native.ERROR_INVALID_NAME || errorCode == Win32Native.ERROR_BAD_PATHNAME; @@ -192,13 +189,11 @@ namespace System.IO { } // An alternative to WinIOError with friendlier messages for drives - [System.Security.SecuritySafeCritical] // auto-generated internal static void WinIODriveError(String driveName) { int errorCode = Marshal.GetLastWin32Error(); WinIODriveError(driveName, errorCode); } - [System.Security.SecurityCritical] // auto-generated internal static void WinIODriveError(String driveName, int errorCode) { switch (errorCode) { diff --git a/src/coreclr/src/mscorlib/src/System/Int16.cs b/src/coreclr/src/mscorlib/src/System/Int16.cs index 0adc64c..f02a5f2 100644 --- a/src/coreclr/src/mscorlib/src/System/Int16.cs +++ b/src/coreclr/src/mscorlib/src/System/Int16.cs @@ -71,13 +71,11 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.GetInstance(provider)); @@ -93,7 +91,6 @@ namespace System { return ToString(format, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated private String ToString(String format, NumberFormatInfo info) { Contract.Ensures(Contract.Result() != null); diff --git a/src/coreclr/src/mscorlib/src/System/Int32.cs b/src/coreclr/src/mscorlib/src/System/Int32.cs index 778a893..2da55bf 100644 --- a/src/coreclr/src/mscorlib/src/System/Int32.cs +++ b/src/coreclr/src/mscorlib/src/System/Int32.cs @@ -77,21 +77,18 @@ namespace System { return m_value; } - [System.Security.SecuritySafeCritical] // auto-generated [Pure] public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated [Pure] public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated [Pure] public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); @@ -99,7 +96,6 @@ namespace System { } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/Int64.cs b/src/coreclr/src/mscorlib/src/System/Int64.cs index 0cd2558..e5fcf86 100644 --- a/src/coreclr/src/mscorlib/src/System/Int64.cs +++ b/src/coreclr/src/mscorlib/src/System/Int64.cs @@ -76,25 +76,21 @@ namespace System { return (unchecked((int)((long)m_value)) ^ (int)(m_value >> 32)); } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatInt64(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt64(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt64(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt64(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/IntPtr.cs b/src/coreclr/src/mscorlib/src/System/IntPtr.cs index b7674af..f3da81d 100644 --- a/src/coreclr/src/mscorlib/src/System/IntPtr.cs +++ b/src/coreclr/src/mscorlib/src/System/IntPtr.cs @@ -26,13 +26,11 @@ namespace System { [System.Runtime.InteropServices.ComVisible(true)] public struct IntPtr : IEquatable, ISerializable { - [SecurityCritical] unsafe private void* m_value; // The compiler treats void* closest to uint hence explicit casts are required to preserve int behavior public static readonly IntPtr Zero; // fast way to compare IntPtr to (IntPtr)0 while IntPtr.Zero doesn't work due to slow statics access - [System.Security.SecuritySafeCritical] // auto-generated [Pure] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal unsafe bool IsNull() @@ -40,7 +38,6 @@ namespace System { return (this.m_value == null); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] [System.Runtime.Versioning.NonVersionable] public unsafe IntPtr(int value) @@ -52,7 +49,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] [System.Runtime.Versioning.NonVersionable] public unsafe IntPtr(long value) @@ -64,7 +60,6 @@ namespace System { #endif } - [System.Security.SecurityCritical] [CLSCompliant(false)] [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] [System.Runtime.Versioning.NonVersionable] @@ -73,7 +68,6 @@ namespace System { m_value = value; } - [System.Security.SecurityCritical] // auto-generated private unsafe IntPtr(SerializationInfo info, StreamingContext context) { long l = info.GetInt64("value"); @@ -84,7 +78,6 @@ namespace System { m_value = (void *)l; } - [System.Security.SecurityCritical] unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); @@ -97,7 +90,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override bool Equals(Object obj) { if (obj is IntPtr) { return (m_value == ((IntPtr)obj).m_value); @@ -105,13 +97,11 @@ namespace System { return false; } - [SecuritySafeCritical] unsafe bool IEquatable.Equals(IntPtr other) { return m_value == other.m_value; } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override int GetHashCode() { #if FEATURE_CORECLR #if BIT64 @@ -125,7 +115,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.Versioning.NonVersionable] public unsafe int ToInt32() { @@ -137,7 +126,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.Versioning.NonVersionable] public unsafe long ToInt64() { @@ -148,7 +136,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override String ToString() { #if BIT64 return ((long)m_value).ToString(CultureInfo.InvariantCulture); @@ -157,7 +144,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe String ToString(String format) { Contract.Ensures(Contract.Result() != null); @@ -184,7 +170,6 @@ namespace System { return new IntPtr(value); } - [System.Security.SecurityCritical] [CLSCompliant(false), ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] [System.Runtime.Versioning.NonVersionable] public static unsafe explicit operator IntPtr (void* value) @@ -192,7 +177,6 @@ namespace System { return new IntPtr(value); } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] public static unsafe explicit operator void* (IntPtr value) @@ -200,7 +184,6 @@ namespace System { return value.m_value; } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static explicit operator int (IntPtr value) { @@ -212,7 +195,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static explicit operator long (IntPtr value) { @@ -223,7 +205,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.Versioning.NonVersionable] public unsafe static bool operator == (IntPtr value1, IntPtr value2) @@ -231,7 +212,6 @@ namespace System { return value1.m_value == value2.m_value; } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.Versioning.NonVersionable] public unsafe static bool operator != (IntPtr value1, IntPtr value2) @@ -289,7 +269,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.Versioning.NonVersionable] diff --git a/src/coreclr/src/mscorlib/src/System/Internal.cs b/src/coreclr/src/mscorlib/src/System/Internal.cs index c6be49f..cd7166d 100644 --- a/src/coreclr/src/mscorlib/src/System/Internal.cs +++ b/src/coreclr/src/mscorlib/src/System/Internal.cs @@ -214,7 +214,6 @@ namespace System // typed as matching instantiations of mscorlib copies of WinRT interfaces (IIterable, IVector, // IMap, ...) which is necessary to generate all required IL stubs. - [SecurityCritical] static void CommonlyUsedWinRTRedirectedInterfaceStubs() { WinRT_IEnumerable(null, null, null); @@ -261,7 +260,6 @@ namespace System WinRT_Nullable(); } - [SecurityCritical] static void WinRT_IEnumerable(IterableToEnumerableAdapter iterableToEnumerableAdapter, EnumerableToIterableAdapter enumerableToIterableAdapter, IIterable iterable) { // instantiate stubs for the one method on IEnumerable and the one method on IIterable @@ -269,7 +267,6 @@ namespace System enumerableToIterableAdapter.First_Stub(); } - [SecurityCritical] static void WinRT_IList(VectorToListAdapter vectorToListAdapter, VectorToCollectionAdapter vectorToCollectionAdapter, ListToVectorAdapter listToVectorAdapter, IVector vector) { WinRT_IEnumerable(null, null, null); @@ -294,7 +291,6 @@ namespace System listToVectorAdapter.Clear(); } - [SecurityCritical] static void WinRT_IReadOnlyCollection(VectorViewToReadOnlyCollectionAdapter vectorViewToReadOnlyCollectionAdapter) { WinRT_IEnumerable(null, null, null); @@ -303,7 +299,6 @@ namespace System vectorViewToReadOnlyCollectionAdapter.Count(); } - [SecurityCritical] static void WinRT_IReadOnlyList(IVectorViewToIReadOnlyListAdapter vectorToListAdapter, IReadOnlyListToIVectorViewAdapter listToVectorAdapter, IVectorView vectorView) { WinRT_IEnumerable(null, null, null); @@ -317,7 +312,6 @@ namespace System listToVectorAdapter.Size(); } - [SecurityCritical] static void WinRT_IDictionary(MapToDictionaryAdapter mapToDictionaryAdapter, MapToCollectionAdapter mapToCollectionAdapter, DictionaryToMapAdapter dictionaryToMapAdapter, IMap map) { WinRT_IEnumerable>(null, null, null); @@ -343,7 +337,6 @@ namespace System dictionaryToMapAdapter.Clear(); } - [SecurityCritical] static void WinRT_IReadOnlyDictionary(IMapViewToIReadOnlyDictionaryAdapter mapToDictionaryAdapter, IReadOnlyDictionaryToIMapViewAdapter dictionaryToMapAdapter, IMapView mapView, MapViewToReadOnlyCollectionAdapter mapViewToReadOnlyCollectionAdapter) { WinRT_IEnumerable>(null, null, null); @@ -364,7 +357,6 @@ namespace System dictionaryToMapAdapter.HasKey(default(K)); } - [SecurityCritical] static void WinRT_Nullable() where T : struct { Nullable nullable = new Nullable(); diff --git a/src/coreclr/src/mscorlib/src/System/LowLevelConsole.cs b/src/coreclr/src/mscorlib/src/System/LowLevelConsole.cs index 3aba3db..316583e 100644 --- a/src/coreclr/src/mscorlib/src/System/LowLevelConsole.cs +++ b/src/coreclr/src/mscorlib/src/System/LowLevelConsole.cs @@ -16,16 +16,13 @@ namespace System public static class Console { - [SecurityCritical] static SafeFileHandle _outputHandle; - [SecuritySafeCritical] static Console() { _outputHandle = new SafeFileHandle(Win32Native.GetStdHandle(Win32Native.STD_OUTPUT_HANDLE), false); } - [SecuritySafeCritical] public static unsafe void Write(string s) { byte[] bytes = Encoding.UTF8.GetBytes(s); diff --git a/src/coreclr/src/mscorlib/src/System/Math.cs b/src/coreclr/src/mscorlib/src/System/Math.cs index 9ff0a9f..3ac1f06 100644 --- a/src/coreclr/src/mscorlib/src/System/Math.cs +++ b/src/coreclr/src/mscorlib/src/System/Math.cs @@ -35,16 +35,12 @@ namespace System { public const double PI = 3.14159265358979323846; public const double E = 2.7182818284590452354; - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Acos(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Asin(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Atan(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Atan2(double y,double x); @@ -52,15 +48,12 @@ namespace System { return Decimal.Ceiling(d); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Ceiling(double a); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Cos (double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Cosh(double value); @@ -68,11 +61,9 @@ namespace System { return Decimal.Floor(d); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Floor(double d); - [System.Security.SecuritySafeCritical] // auto-generated private static unsafe double InternalRound(double value, int digits, MidpointRounding mode) { if (Abs(value) < doubleRoundLimit) { Double power10 = roundPower10Double[digits]; @@ -92,26 +83,20 @@ namespace System { return value; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static double InternalTruncate(double d) { SplitFractionDouble(&d); return d; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Sin(double a); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Tan(double a); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Sinh(double value); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Tanh(double value); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Round(double a); @@ -153,7 +138,6 @@ namespace System { return Decimal.Round(d, decimals, mode); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern double SplitFractionDouble(double* value); @@ -165,20 +149,15 @@ namespace System { return InternalTruncate(d); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Sqrt(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Log (double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Log10(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Exp(double d); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double Pow(double x, double y); @@ -284,7 +263,6 @@ namespace System { return -value; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static float Abs(float value); // This is special code to handle NaN (We need to make sure NaN's aren't @@ -296,7 +274,6 @@ namespace System { // it runs the else case, which returns +value instead of negating it. // return (value < 0) ? -value : value; - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] extern public static double Abs(double value); // This is special code to handle NaN (We need to make sure NaN's aren't diff --git a/src/coreclr/src/mscorlib/src/System/MathF.cs b/src/coreclr/src/mscorlib/src/System/MathF.cs index 12d0782..fb80092 100644 --- a/src/coreclr/src/mscorlib/src/System/MathF.cs +++ b/src/coreclr/src/mscorlib/src/System/MathF.cs @@ -34,39 +34,30 @@ namespace System { public static float Abs(float x) => Math.Abs(x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Acos(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Asin(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Atan(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Atan2(float y, float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Ceiling(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Cos(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Cosh(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Exp(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Floor(float x); @@ -121,7 +112,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Log(float x); @@ -150,7 +140,6 @@ namespace System { return Log(x) / Log(y); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Log10(float x); @@ -160,11 +149,9 @@ namespace System { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static float Min(float x, float y) => Math.Min(x, y); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Pow(float x, float y); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Round(float x); @@ -208,30 +195,24 @@ namespace System { public static int Sign(float x) => Math.Sign(x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Sin(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Sinh(float x); - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Sqrt(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Tan(float x); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float Tanh(float x); public static float Truncate(float x) => InternalTruncate(x); - [System.Security.SecuritySafeCritical] // auto-generated private static unsafe float InternalRound(float x, int digits, MidpointRounding mode) { if (Abs(x) < singleRoundLimit) @@ -260,14 +241,12 @@ namespace System { return x; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static float InternalTruncate(float x) { SplitFractionSingle(&x); return x; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern float SplitFractionSingle(float* x); } diff --git a/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs b/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs index 4196ea8..d96d037 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs +++ b/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs @@ -39,7 +39,6 @@ namespace System { public override String Message { - [System.Security.SecuritySafeCritical] // auto-generated get { if (ClassName == null) { return base.Message; diff --git a/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs b/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs index 07d516d..ab773dc 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs +++ b/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs @@ -48,7 +48,6 @@ namespace System { public override String Message { - [System.Security.SecuritySafeCritical] // auto-generated get { if (ClassName == null) { return base.Message; @@ -62,7 +61,6 @@ namespace System { } // Called to format signature - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String FormatSignature(byte [] signature); @@ -82,7 +80,6 @@ namespace System { MemberName = memberName; } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs b/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs index cba33ef..7943490 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs +++ b/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs @@ -41,7 +41,6 @@ namespace System { public override String Message { - [System.Security.SecuritySafeCritical] // auto-generated get { if (ClassName == null) { return base.Message; diff --git a/src/coreclr/src/mscorlib/src/System/MulticastDelegate.cs b/src/coreclr/src/mscorlib/src/System/MulticastDelegate.cs index f59db16..1c35d46 100644 --- a/src/coreclr/src/mscorlib/src/System/MulticastDelegate.cs +++ b/src/coreclr/src/mscorlib/src/System/MulticastDelegate.cs @@ -20,9 +20,7 @@ namespace System // 1. Multicast delegate // 2. Secure/Wrapper delegate // 3. Inner delegate of secure delegate where the secure delegate security context is a collectible method - [System.Security.SecurityCritical] private Object _invocationList; - [System.Security.SecurityCritical] private IntPtr _invocationCount; // This constructor is called from the class generated by the @@ -39,19 +37,16 @@ namespace System { } - [System.Security.SecuritySafeCritical] internal bool IsUnmanagedFunctionPtr() { return (_invocationCount == (IntPtr)(-1)); } - [System.Security.SecuritySafeCritical] internal bool InvocationListLogicallyNull() { return (_invocationList == null) || (_invocationList is LoaderAllocator) || (_invocationList is DynamicResolver); } - [System.Security.SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { int targetIndex = 0; @@ -101,7 +96,6 @@ namespace System // equals returns true IIF the delegate is not null and has the // same target, method and invocation list as this object - [System.Security.SecuritySafeCritical] // auto-generated public override sealed bool Equals(Object obj) { if (obj == null) @@ -180,7 +174,6 @@ namespace System } // Recursive function which will check for equality of the invocation list. - [System.Security.SecuritySafeCritical] private bool InvocationListEquals(MulticastDelegate d) { Contract.Assert(d != null && (_invocationList as Object[]) != null, "bogus delegate in multicast list comparison"); @@ -199,7 +192,6 @@ namespace System return true; } - [System.Security.SecurityCritical] private bool TrySetSlot(Object[] a, int index, Object o) { if (a[index] == null && System.Threading.Interlocked.CompareExchange(ref a[index], o, null) == null) @@ -222,7 +214,6 @@ namespace System return false; } - [System.Security.SecurityCritical] private MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount, bool thisIsMultiCastAlready) { // First, allocate a new multicast delegate just like this one, i.e. same type as the this object @@ -247,13 +238,11 @@ namespace System return result; } - [System.Security.SecurityCritical] internal MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount) { return NewMulticastDelegate(invocationList, invocationCount, false); } - [System.Security.SecurityCritical] internal void StoreDynamicMethod(MethodInfo dynamicMethod) { if (_invocationCount != (IntPtr)0) @@ -270,7 +259,6 @@ namespace System // This method will combine this delegate with the passed delegate // to form a new delegate. - [System.Security.SecuritySafeCritical] // auto-generated protected override sealed Delegate CombineImpl(Delegate follow) { if ((Object)follow == null) // cast to object for a more efficient test @@ -356,7 +344,6 @@ namespace System } } - [System.Security.SecurityCritical] private Object[] DeleteFromInvocationList(Object[] invocationList, int invocationCount, int deleteIndex, int deleteCount) { Object[] thisInvocationList = _invocationList as Object[]; @@ -390,7 +377,6 @@ namespace System // look at the invocation list.) If this is found we remove it from // this list and return a new delegate. If its not found a copy of the // current list is returned. - [System.Security.SecuritySafeCritical] // auto-generated protected override sealed Delegate RemoveImpl(Delegate value) { // There is a special case were we are removing using a delegate as @@ -464,7 +450,6 @@ namespace System } // This method returns the Invocation list of this multicast delegate. - [System.Security.SecuritySafeCritical] public override sealed Delegate[] GetInvocationList() { Contract.Ensures(Contract.Result() != null); @@ -505,7 +490,6 @@ namespace System return !d1.Equals(d2); } - [System.Security.SecuritySafeCritical] public override sealed int GetHashCode() { if (IsUnmanagedFunctionPtr()) @@ -528,7 +512,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] internal override Object GetTarget() { if (_invocationCount != (IntPtr)0) @@ -562,7 +545,6 @@ namespace System return base.GetTarget(); } - [System.Security.SecuritySafeCritical] protected override MethodInfo GetMethodImpl() { if (_invocationCount != (IntPtr)0 && _invocationList != null) @@ -613,7 +595,6 @@ namespace System throw new ArgumentException(Environment.GetResourceString("Arg_DlgtNullInst")); } - [System.Security.SecurityCritical] [System.Diagnostics.DebuggerNonUserCode] private void CtorClosed(Object target, IntPtr methodPtr) { @@ -623,7 +604,6 @@ namespace System this._methodPtr = methodPtr; } - [System.Security.SecurityCritical] [System.Diagnostics.DebuggerNonUserCode] private void CtorClosedStatic(Object target, IntPtr methodPtr) { @@ -631,7 +611,6 @@ namespace System this._methodPtr = methodPtr; } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorRTClosed(Object target, IntPtr methodPtr) { @@ -639,7 +618,6 @@ namespace System this._methodPtr = AdjustTarget(target, methodPtr); } - [System.Security.SecurityCritical] [System.Diagnostics.DebuggerNonUserCode] private void CtorOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk) { @@ -648,7 +626,6 @@ namespace System this._methodPtrAux = methodPtr; } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorSecureClosed(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod) { @@ -661,7 +638,6 @@ namespace System this._invocationCount = GetInvokeMethod(); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorSecureClosedStatic(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod) { @@ -674,7 +650,6 @@ namespace System this._invocationCount = GetInvokeMethod(); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorSecureRTClosed(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod) { @@ -687,7 +662,6 @@ namespace System this._invocationCount = GetInvokeMethod(); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorSecureOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr callThunk, IntPtr creatorMethod) { @@ -700,7 +674,6 @@ namespace System this._invocationCount = GetInvokeMethod(); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk) { @@ -709,7 +682,6 @@ namespace System this._methodPtrAux = GetCallStub(methodPtr); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorSecureVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr callThunk, IntPtr creatorMethod) { @@ -722,7 +694,6 @@ namespace System this._invocationCount = GetInvokeMethod(); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorCollectibleClosedStatic(Object target, IntPtr methodPtr, IntPtr gchandle) { @@ -731,7 +702,6 @@ namespace System this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorCollectibleOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) { @@ -741,7 +711,6 @@ namespace System this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle); } - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.DebuggerNonUserCode] private void CtorCollectibleVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) { diff --git a/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs b/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs index d108f92..3a896ce 100644 --- a/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs +++ b/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs @@ -57,7 +57,6 @@ namespace System { get { return _offendingNumber; } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Number.cs b/src/coreclr/src/mscorlib/src/System/Number.cs index a4b88a9..1f2e79e 100644 --- a/src/coreclr/src/mscorlib/src/System/Number.cs +++ b/src/coreclr/src/mscorlib/src/System/Number.cs @@ -289,38 +289,28 @@ namespace System { private Number() { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatDecimal(Decimal value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatDouble(double value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatInt32(int value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatUInt32(uint value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatInt64(long value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatUInt64(ulong value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern String FormatSingle(float value, String format, NumberFormatInfo info); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public unsafe static extern Boolean NumberBufferToDecimal(byte* number, ref Decimal value); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal unsafe static extern Boolean NumberBufferToDouble(byte* number, ref Double value); [MethodImplAttribute(MethodImplOptions.InternalCall)] [System.Runtime.CompilerServices.FriendAccessAllowed] - [System.Security.SecurityCritical] // auto-generated internal static extern unsafe string FormatNumberBuffer(byte* number, string format, NumberFormatInfo info, char* allDigits); // Constants used by number parsing @@ -350,15 +340,12 @@ namespace System { // Enough space for NumberMaxDigit characters plus null and 3 32 bit integers and a pointer public static readonly Int32 NumberBufferBytes = 12 + ((NumberMaxDigits + 1) * 2) + IntPtr.Size; - [SecurityCritical] private Byte * baseAddress; - [SecurityCritical] public Char * digits; public Int32 precision; public Int32 scale; public Boolean sign; - [System.Security.SecurityCritical] // auto-generated public NumberBuffer(Byte* stackBuffer) { this.baseAddress = stackBuffer; this.digits = (((Char*) stackBuffer) + 6); @@ -367,7 +354,6 @@ namespace System { this.sign = false; } - [System.Security.SecurityCritical] // auto-generated public Byte* PackForNative() { Int32* baseInteger = (Int32*) baseAddress; baseInteger[0] = precision; @@ -391,7 +377,6 @@ namespace System { return returnValue; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean HexNumberToUInt32(ref NumberBuffer number, ref UInt32 value) { Int32 i = number.scale; @@ -436,7 +421,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean HexNumberToUInt64(ref NumberBuffer number, ref UInt64 value) { Int32 i = number.scale; @@ -485,7 +469,6 @@ namespace System { return (((ch) == 0x20) || ((ch) >= 0x09 && (ch) <= 0x0D)); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean NumberToInt32(ref NumberBuffer number, ref Int32 value) { Int32 i = number.scale; @@ -519,7 +502,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean NumberToInt64(ref NumberBuffer number, ref Int64 value) { Int32 i = number.scale; @@ -553,7 +535,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean NumberToUInt32(ref NumberBuffer number, ref UInt32 value) { Int32 i = number.scale; @@ -581,7 +562,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static Boolean NumberToUInt64(ref NumberBuffer number, ref UInt64 value) { Int32 i = number.scale; @@ -609,13 +589,11 @@ namespace System { return true; } - [System.Security.SecurityCritical] // auto-generated private unsafe static char * MatchChars(char* p, string str) { fixed (char* stringPointer = str) { return MatchChars(p, stringPointer); } } - [System.Security.SecurityCritical] // auto-generated private unsafe static char * MatchChars(char* p, char* str) { Contract.Assert(p != null && str != null, ""); @@ -634,7 +612,6 @@ namespace System { return null; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Decimal ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -649,7 +626,6 @@ namespace System { return result; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Double ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) { if (value == null) { throw new ArgumentNullException(nameof(value)); @@ -683,7 +659,6 @@ namespace System { return d; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Int32 ParseInt32(String s, NumberStyles style, NumberFormatInfo info) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -705,7 +680,6 @@ namespace System { return i; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Int64 ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; NumberBuffer number = new NumberBuffer(numberBufferBytes); @@ -726,7 +700,6 @@ namespace System { return i; } - [System.Security.SecurityCritical] // auto-generated private unsafe static Boolean ParseNumber(ref char * str, NumberStyles options, ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, Boolean parseDecimal) { const Int32 StateSign = 0x0001; @@ -903,7 +876,6 @@ namespace System { return false; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Single ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt) { if (value == null) { throw new ArgumentNullException(nameof(value)); @@ -940,7 +912,6 @@ namespace System { return castSingle; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static UInt32 ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -963,7 +934,6 @@ namespace System { return i; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static UInt64 ParseUInt64(String value, NumberStyles options, NumberFormatInfo numfmt) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; NumberBuffer number = new NumberBuffer(numberBufferBytes); @@ -983,7 +953,6 @@ namespace System { return i; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static void StringToNumber(String str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo info, Boolean parseDecimal) { if (str == null) { @@ -1010,7 +979,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt, out Decimal result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -1027,7 +995,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt, out Double result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; NumberBuffer number = new NumberBuffer(numberBufferBytes); @@ -1043,7 +1010,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseInt32(String s, NumberStyles style, NumberFormatInfo info, out Int32 result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -1067,7 +1033,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseInt64(String s, NumberStyles style, NumberFormatInfo info, out Int64 result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -1091,7 +1056,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt, out Single result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; NumberBuffer number = new NumberBuffer(numberBufferBytes); @@ -1113,7 +1077,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseUInt32(String s, NumberStyles style, NumberFormatInfo info, out UInt32 result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -1137,7 +1100,6 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Boolean TryParseUInt64(String s, NumberStyles style, NumberFormatInfo info, out UInt64 result) { Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes]; @@ -1165,7 +1127,6 @@ namespace System { return TryStringToNumber(str, options, ref number, null, numfmt, parseDecimal); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.CompilerServices.FriendAccessAllowed] internal unsafe static Boolean TryStringToNumber(String str, NumberStyles options, ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, Boolean parseDecimal) { diff --git a/src/coreclr/src/mscorlib/src/System/Object.cs b/src/coreclr/src/mscorlib/src/System/Object.cs index 4fca978..13cddb5 100644 --- a/src/coreclr/src/mscorlib/src/System/Object.cs +++ b/src/coreclr/src/mscorlib/src/System/Object.cs @@ -95,7 +95,6 @@ public class Object // Returns a Type object which represent this object instance. // - [System.Security.SecuritySafeCritical] // auto-generated [Pure] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern Type GetType(); @@ -113,14 +112,12 @@ public class Object // so that other object may only call this method on themselves. It is entended to // support the ICloneable interface. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] protected extern Object MemberwiseClone(); // Sets the value specified in the variant on the field // - [System.Security.SecurityCritical] // auto-generated private void FieldSetter(String typeName, String fieldName, Object val) { Contract.Requires(typeName != null); diff --git a/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs b/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs index cf92cef..d2eca37 100644 --- a/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs +++ b/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs @@ -64,7 +64,6 @@ namespace System { objectName = info.GetString("ObjectName"); } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("ObjectName",ObjectName,typeof(String)); diff --git a/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs b/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs index 1ed1e32..c986f67 100644 --- a/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs +++ b/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs @@ -20,7 +20,6 @@ namespace System { { // ChangeType // This binder uses OLEAUT to change the type of the variant. - [System.Security.SecuritySafeCritical] // overrides transparent member public override Object ChangeType(Object value, Type type, CultureInfo cultureInfo) { Variant myValue = new Variant(value); diff --git a/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs b/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs index 7bdb2f3..a11d4bc 100644 --- a/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs +++ b/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs @@ -71,7 +71,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated_required public void GetObjectData(SerializationInfo info, StreamingContext context) { if( info == null ) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/ParseNumbers.cs b/src/coreclr/src/mscorlib/src/System/ParseNumbers.cs index 01c2ae3..2a375f7 100644 --- a/src/coreclr/src/mscorlib/src/System/ParseNumbers.cs +++ b/src/coreclr/src/mscorlib/src/System/ParseNumbers.cs @@ -33,41 +33,33 @@ namespace System { // NATIVE METHODS // For comments on these methods please see $\src\vm\COMUtilNative.cpp // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static long StringToLong(System.String s, int radix, int flags) { return StringToLong(s,radix,flags, null); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public unsafe extern static long StringToLong(System.String s, int radix, int flags, int* currPos); - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static long StringToLong(System.String s, int radix, int flags, ref int currPos) { fixed(int * ppos = &currPos) { return StringToLong( s, radix, flags, ppos); } } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static int StringToInt(System.String s, int radix, int flags) { return StringToInt(s,radix,flags, null); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public unsafe extern static int StringToInt(System.String s, int radix, int flags, int* currPos); - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static int StringToInt(System.String s, int radix, int flags, ref int currPos) { fixed(int * ppos = &currPos) { return StringToInt( s, radix, flags, ppos); } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern static String IntToString(int l, int radix, int width, char paddingChar, int flags); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern static String LongToString(long l, int radix, int width, char paddingChar, int flags); } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.cs index f5146f6..677e4aa 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.cs @@ -48,9 +48,6 @@ namespace System.Reflection [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_Assembly))] [System.Runtime.InteropServices.ComVisible(true)] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 public abstract class Assembly : _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable { protected Assembly() {} @@ -103,7 +100,6 @@ namespace System.Reflection return base.GetHashCode(); } - [System.Security.SecurityCritical] public static Assembly LoadFrom(String assemblyFile) { if(assemblyFile == null) @@ -113,7 +109,6 @@ namespace System.Reflection } // Locate an assembly for reflection by the name of the file containing the manifest. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly ReflectionOnlyLoadFrom(String assemblyFile) { @@ -132,7 +127,6 @@ namespace System.Reflection } // Evidence is protected in Assembly.Load() - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of LoadFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly LoadFrom(String assemblyFile, @@ -153,7 +147,6 @@ namespace System.Reflection } // Evidence is protected in Assembly.Load() - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of LoadFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly LoadFrom(String assemblyFile, @@ -175,7 +168,6 @@ namespace System.Reflection ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly LoadFrom(String assemblyFile, byte[] hashValue, @@ -184,7 +176,6 @@ namespace System.Reflection throw new NotSupportedException(Environment.GetResourceString("NotSupported_AssemblyLoadFromHash")); } - [SecurityCritical] public static Assembly UnsafeLoadFrom(string assemblyFile) { return LoadFrom(assemblyFile); @@ -192,7 +183,6 @@ namespace System.Reflection // Locate an assembly by the long form of the assembly name. // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890" - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(String assemblyString) { @@ -207,7 +197,6 @@ namespace System.Reflection // Calls Type.GetType for WinRT types. // Note: Type.GetType fails for assembly names that start with weird characters like '['. By calling it for managed types we would // break AppCompat. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static Type GetType_Compat(String assemblyString, String typeName) { @@ -237,7 +226,6 @@ namespace System.Reflection // Locate an assembly for reflection by the long form of the assembly name. // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890" // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly ReflectionOnlyLoad(String assemblyString) { @@ -247,7 +235,6 @@ namespace System.Reflection return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, true /*forIntrospection*/); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public static Assembly Load(String assemblyString, Evidence assemblySecurity) @@ -261,7 +248,6 @@ namespace System.Reflection // Locate an assembly by its name. The name can be strong or // weak. The assembly is loaded into the domain of the caller. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(AssemblyName assemblyRef) { @@ -281,7 +267,6 @@ namespace System.Reflection // Locate an assembly by its name. The name can be strong or // weak. The assembly is loaded into the domain of the caller. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static Assembly Load(AssemblyName assemblyRef, IntPtr ptrLoadContextBinder) { @@ -299,7 +284,6 @@ namespace System.Reflection return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, false /*suppressSecurityChecks*/, ptrLoadContextBinder); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public static Assembly Load(AssemblyName assemblyRef, Evidence assemblySecurity) @@ -311,7 +295,6 @@ namespace System.Reflection return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, assemblySecurity, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, false /*suppressSecurityChecks*/); } - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")] public static Assembly LoadWithPartialName(String partialName) { @@ -323,7 +306,6 @@ namespace System.Reflection // Loads the assembly with a COFF based IMAGE containing // an emitted assembly. The assembly is loaded into the domain // of the caller. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(byte[] rawAssembly) { @@ -338,7 +320,6 @@ namespace System.Reflection // Loads the assembly for reflection with a COFF based IMAGE containing // an emitted assembly. The assembly is loaded into the domain // of the caller. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { @@ -360,7 +341,6 @@ namespace System.Reflection // an emitted assembly. The assembly is loaded into the domain // of the caller. The second parameter is the raw bytes // representing the symbol store that matches the assembly. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore) @@ -380,7 +360,6 @@ namespace System.Reflection // Load an assembly from a byte array, controlling where the grant set of this assembly is // propigated from. - [SecuritySafeCritical] [MethodImpl(MethodImplOptions.NoInlining)] // Due to the stack crawl mark public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore, @@ -408,7 +387,6 @@ namespace System.Reflection private static Dictionary s_loadfile = new Dictionary(); - [System.Security.SecuritySafeCritical] // auto-generated public static Assembly LoadFile(String path) { Contract.Ensures(Contract.Result() != null); @@ -438,7 +416,6 @@ namespace System.Reflection return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(Stream assemblyStream, Stream pdbStream) { @@ -448,7 +425,6 @@ namespace System.Reflection StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeAssembly.InternalLoadFromStream(assemblyStream, pdbStream, ref stackMark); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly Load(Stream assemblyStream) { @@ -462,7 +438,6 @@ namespace System.Reflection /* * Get the assembly that the current code is running from. */ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly GetExecutingAssembly() { @@ -470,7 +445,6 @@ namespace System.Reflection return RuntimeAssembly.GetExecutingAssembly(ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Assembly GetCallingAssembly() { @@ -481,7 +455,6 @@ namespace System.Reflection return RuntimeAssembly.GetExecutingAssembly(ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated public static Assembly GetEntryAssembly() { AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager; if (domainManager == null) @@ -494,12 +467,10 @@ namespace System.Reflection #region public methods public virtual event ModuleResolveEventHandler ModuleResolve { - [System.Security.SecurityCritical] // auto-generated_required add { throw new NotImplementedException(); } - [System.Security.SecurityCritical] // auto-generated_required remove { throw new NotImplementedException(); @@ -508,7 +479,6 @@ namespace System.Reflection public virtual String CodeBase { - [System.Security.SecurityCritical] // auto-generated get { throw new NotImplementedException(); @@ -517,20 +487,17 @@ namespace System.Reflection public virtual String EscapedCodeBase { - [System.Security.SecuritySafeCritical] // auto-generated get { return AssemblyName.EscapeCodeBase(CodeBase); } } - [System.Security.SecurityCritical] // auto-generated public virtual AssemblyName GetName() { return GetName(false); } - [System.Security.SecurityCritical] // auto-generated public virtual AssemblyName GetName(bool copiedName) { throw new NotImplementedException(); @@ -652,7 +619,6 @@ namespace System.Reflection public bool IsFullyTrusted { - [SecuritySafeCritical] get { return true; @@ -668,7 +634,6 @@ namespace System.Reflection } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotImplementedException(); @@ -823,7 +788,6 @@ namespace System.Reflection // Returns the file in the File table of the manifest that matches the // given name. (Name should not include path.) - [System.Security.SecurityCritical] // auto-generated public virtual FileStream GetFile(String name) { throw new NotImplementedException(); @@ -834,7 +798,6 @@ namespace System.Reflection return GetFiles(false); } - [System.Security.SecurityCritical] // auto-generated public virtual FileStream[] GetFiles(bool getResourceModules) { throw new NotImplementedException(); @@ -867,7 +830,6 @@ namespace System.Reflection public virtual String Location { - [System.Security.SecurityCritical] // auto-generated get { throw new NotImplementedException(); @@ -977,7 +939,6 @@ namespace System.Reflection private ASSEMBLY_FLAGS Flags { - [SecuritySafeCritical] get { if ((m_flags & ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_INITIALIZED) == 0) @@ -1007,12 +968,10 @@ namespace System.Reflection public override event ModuleResolveEventHandler ModuleResolve { - [System.Security.SecurityCritical] // auto-generated_required add { _ModuleResolve += value; } - [System.Security.SecurityCritical] // auto-generated_required remove { _ModuleResolve -= value; @@ -1021,14 +980,12 @@ namespace System.Reflection private const String s_localFilePrefix = "file:"; - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetCodeBase(RuntimeAssembly assembly, bool copiedName, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated internal String GetCodeBase(bool copiedName) { String codeBase = null; @@ -1038,7 +995,6 @@ namespace System.Reflection public override String CodeBase { - [System.Security.SecurityCritical] // auto-generated get { String codeBase = GetCodeBase(false); VerifyCodeBaseDiscovery(codeBase); @@ -1054,7 +1010,6 @@ namespace System.Reflection // If the assembly is copied before it is loaded, the codebase will be set to the // actual file loaded if copiedName is true. If it is false, then the original code base // is returned. - [System.Security.SecurityCritical] // auto-generated public override AssemblyName GetName(bool copiedName) { AssemblyName an = new AssemblyName(); @@ -1088,14 +1043,12 @@ namespace System.Reflection return an; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetFullName(RuntimeAssembly assembly, StringHandleOnStack retString); public override String FullName { - [System.Security.SecuritySafeCritical] // auto-generated get { // If called by Object.ToString(), return val may be NULL. if (m_fullname == null) @@ -1109,14 +1062,12 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetEntryPoint(RuntimeAssembly assembly, ObjectHandleOnStack retMethod); public override MethodInfo EntryPoint { - [System.Security.SecuritySafeCritical] // auto-generated get { IRuntimeMethodInfo methodHandle = null; GetEntryPoint(GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref methodHandle)); @@ -1128,7 +1079,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetType(RuntimeAssembly assembly, @@ -1138,7 +1088,6 @@ namespace System.Reflection ObjectHandleOnStack type, ObjectHandleOnStack keepAlive); - [System.Security.SecuritySafeCritical] public override Type GetType(String name, bool throwOnError, bool ignoreCase) { // throw on null strings regardless of the value of "throwOnError" @@ -1153,17 +1102,14 @@ namespace System.Reflection return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static void GetForwardedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes); - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetExportedTypes() { Type[] types = null; @@ -1173,7 +1119,6 @@ namespace System.Reflection public override IEnumerable DefinedTypes { - [System.Security.SecuritySafeCritical] get { List rtTypes = new List(); @@ -1190,7 +1135,6 @@ namespace System.Reflection } // Load a resource based on the NameSpace of the type. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public override Stream GetManifestResourceStream(Type type, String name) { @@ -1198,7 +1142,6 @@ namespace System.Reflection return GetManifestResourceStream(type, name, false, ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public override Stream GetManifestResourceStream(String name) { @@ -1207,7 +1150,6 @@ namespace System.Reflection } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) @@ -1269,7 +1211,6 @@ namespace System.Reflection return CustomAttributeData.GetCustomAttributesInternal(this); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static RuntimeAssembly InternalLoadFrom(String assemblyFile, Evidence securityEvidence, @@ -1292,7 +1233,6 @@ namespace System.Reflection } // Wrapper function to wrap the typical use of InternalLoad. - [System.Security.SecurityCritical] // auto-generated internal static RuntimeAssembly InternalLoad(String assemblyString, Evidence assemblySecurity, ref StackCrawlMark stackMark, @@ -1301,7 +1241,6 @@ namespace System.Reflection return InternalLoad(assemblyString, assemblySecurity, ref stackMark, IntPtr.Zero, forIntrospection); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static RuntimeAssembly InternalLoad(String assemblyString, Evidence assemblySecurity, @@ -1323,7 +1262,6 @@ namespace System.Reflection } // Creates AssemblyName. Fills assembly if AssemblyResolve event has been raised. - [System.Security.SecurityCritical] // auto-generated internal static AssemblyName CreateAssemblyName( String assemblyString, bool forIntrospection, @@ -1349,7 +1287,6 @@ namespace System.Reflection } // Wrapper function to wrap the typical use of InternalLoadAssemblyName. - [System.Security.SecurityCritical] // auto-generated internal static RuntimeAssembly InternalLoadAssemblyName( AssemblyName assemblyRef, Evidence assemblySecurity, @@ -1363,7 +1300,6 @@ namespace System.Reflection return InternalLoadAssemblyName(assemblyRef, assemblySecurity, reqAssembly, ref stackMark, IntPtr.Zero, true /*throwOnError*/, forIntrospection, suppressSecurityChecks, ptrLoadContextBinder); } - [System.Security.SecurityCritical] // auto-generated internal static RuntimeAssembly InternalLoadAssemblyName( AssemblyName assemblyRef, Evidence assemblySecurity, @@ -1434,7 +1370,6 @@ namespace System.Reflection }; #if FEATURE_APPX - [System.Security.SecuritySafeCritical] internal bool IsFrameworkAssembly() { ASSEMBLY_FLAGS flags = Flags; @@ -1449,19 +1384,16 @@ namespace System.Reflection return (flags & ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_SAFE_REFLECTION) != 0; } - [System.Security.SecuritySafeCritical] private bool IsDesignerBindingContext() { return RuntimeAssembly.nIsDesignerBindingContext(this); } - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static bool nIsDesignerBindingContext(RuntimeAssembly assembly); #endif - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern RuntimeAssembly _nLoad(AssemblyName fileName, String codeBase, @@ -1474,7 +1406,6 @@ namespace System.Reflection bool suppressSecurityChecks, IntPtr ptrLoadContextBinder); - [System.Security.SecurityCritical] // auto-generated private static RuntimeAssembly nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, @@ -1490,7 +1421,6 @@ namespace System.Reflection throwOnFileNotFound, forIntrospection, suppressSecurityChecks, ptrLoadContextBinder); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool IsReflectionOnly(RuntimeAssembly assembly); @@ -1499,7 +1429,6 @@ namespace System.Reflection [ComVisible(false)] public override bool ReflectionOnly { - [System.Security.SecuritySafeCritical] // auto-generated get { return IsReflectionOnly(GetNativeHandle()); @@ -1510,7 +1439,6 @@ namespace System.Reflection // an emitted assembly. The assembly is loaded into the domain // of the caller. Currently is implemented only for UnmanagedMemoryStream // (no derived classes since we are not calling Read()) - [System.Security.SecurityCritical] // auto-generated internal static RuntimeAssembly InternalLoadFromStream(Stream assemblyStream, Stream pdbStream, ref StackCrawlMark stackMark) { if (assemblyStream == null) @@ -1560,12 +1488,10 @@ namespace System.Reflection // Returns the module in this assembly with name 'name' - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetModule(RuntimeAssembly assembly, String name, ObjectHandleOnStack retModule); - [System.Security.SecuritySafeCritical] // auto-generated public override Module GetModule(String name) { Module retModule = null; @@ -1575,7 +1501,6 @@ namespace System.Reflection // Returns the file in the File table of the manifest that matches the // given name. (Name should not include path.) - [System.Security.SecurityCritical] // auto-generated public override FileStream GetFile(String name) { RuntimeModule m = (RuntimeModule)GetModule(name); @@ -1587,7 +1512,6 @@ namespace System.Reflection FileAccess.Read, FileShare.Read, FileStream.DefaultBufferSize, false); } - [System.Security.SecurityCritical] // auto-generated public override FileStream[] GetFiles(bool getResourceModules) { Module[] m = GetModules(getResourceModules); @@ -1603,23 +1527,19 @@ namespace System.Reflection } // Returns the names of all the resources - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern String[] GetManifestResourceNames(RuntimeAssembly assembly); // Returns the names of all the resources - [System.Security.SecuritySafeCritical] // auto-generated public override String[] GetManifestResourceNames() { return GetManifestResourceNames(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetExecutingAssembly(StackCrawlMarkHandle stackMark, ObjectHandleOnStack retAssembly); - [System.Security.SecurityCritical] // auto-generated internal static RuntimeAssembly GetExecutingAssembly(ref StackCrawlMark stackMark) { RuntimeAssembly retAssembly = null; @@ -1628,17 +1548,14 @@ namespace System.Reflection } // Returns the names of all the resources - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern AssemblyName[] GetReferencedAssemblies(RuntimeAssembly assembly); - [System.Security.SecuritySafeCritical] // auto-generated public override AssemblyName[] GetReferencedAssemblies() { return GetReferencedAssemblies(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern int GetManifestResourceInfo(RuntimeAssembly assembly, @@ -1647,7 +1564,6 @@ namespace System.Reflection StringHandleOnStack retFileName, StackCrawlMarkHandle stackMark); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public override ManifestResourceInfo GetManifestResourceInfo(String resourceName) { @@ -1666,14 +1582,12 @@ namespace System.Reflection (ResourceLocation) location); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetLocation(RuntimeAssembly assembly, StringHandleOnStack retString); public override String Location { - [System.Security.SecurityCritical] // auto-generated get { String location = null; @@ -1686,7 +1600,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetImageRuntimeVersion(RuntimeAssembly assembly, StringHandleOnStack retString); @@ -1696,7 +1609,6 @@ namespace System.Reflection [ComVisible(false)] public override String ImageRuntimeVersion { - [System.Security.SecuritySafeCritical] // auto-generated get{ String s = null; GetImageRuntimeVersion(GetNativeHandle(), JitHelpers.GetStringHandleOnStack(ref s)); @@ -1705,27 +1617,23 @@ namespace System.Reflection } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static bool IsGlobalAssemblyCache(RuntimeAssembly assembly); public override bool GlobalAssemblyCache { - [System.Security.SecuritySafeCritical] // auto-generated get { return false; } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static Int64 GetHostContext(RuntimeAssembly assembly); public override Int64 HostContext { - [System.Security.SecuritySafeCritical] // auto-generated get { return 0; @@ -1760,7 +1668,6 @@ namespace System.Reflection #endif // !PLATFORM_UNIX } - [System.Security.SecurityCritical] // auto-generated internal Stream GetManifestResourceStream( Type type, String name, @@ -1788,7 +1695,6 @@ namespace System.Reflection } // GetResource will return a pointer to the resources in memory. - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static unsafe extern byte* GetResource(RuntimeAssembly assembly, @@ -1797,7 +1703,6 @@ namespace System.Reflection StackCrawlMarkHandle stackMark, bool skipSecurityCheck); - [System.Security.SecurityCritical] // auto-generated internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck) { ulong length = 0; @@ -1815,7 +1720,6 @@ namespace System.Reflection return null; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetVersion(RuntimeAssembly assembly, @@ -1824,7 +1728,6 @@ namespace System.Reflection out int buildNum, out int revNum); - [System.Security.SecurityCritical] // auto-generated internal Version GetVersion() { int majorVer, minorVer, build, revision; @@ -1832,12 +1735,10 @@ namespace System.Reflection return new Version (majorVer, minorVer, build, revision); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetLocale(RuntimeAssembly assembly, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated internal CultureInfo GetLocale() { String locale = null; @@ -1850,19 +1751,16 @@ namespace System.Reflection return new CultureInfo(locale); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool FCallIsDynamic(RuntimeAssembly assembly); public override bool IsDynamic { - [SecuritySafeCritical] get { return FCallIsDynamic(GetNativeHandle()); } } - [System.Security.SecurityCritical] // auto-generated private void VerifyCodeBaseDiscovery(String codeBase) { if ((codeBase != null) && @@ -1872,12 +1770,10 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetSimpleName(RuntimeAssembly assembly, StringHandleOnStack retSimpleName); - [SecuritySafeCritical] internal String GetSimpleName() { string name = null; @@ -1885,35 +1781,29 @@ namespace System.Reflection return name; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static AssemblyHashAlgorithm GetHashAlgorithm(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated private AssemblyHashAlgorithm GetHashAlgorithm() { return GetHashAlgorithm(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static AssemblyNameFlags GetFlags(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated private AssemblyNameFlags GetFlags() { return GetFlags(GetNativeHandle()); } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] private static extern void GetRawBytes(RuntimeAssembly assembly, ObjectHandleOnStack retRawBytes); // Get the raw bytes of the assembly - [SecuritySafeCritical] internal byte[] GetRawBytes() { byte[] rawBytes = null; @@ -1922,12 +1812,10 @@ namespace System.Reflection return rawBytes; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetPublicKey(RuntimeAssembly assembly, ObjectHandleOnStack retPublicKey); - [System.Security.SecurityCritical] // auto-generated internal byte[] GetPublicKey() { byte[] publicKey = null; @@ -1935,12 +1823,10 @@ namespace System.Reflection return publicKey; } - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetGrantSet(RuntimeAssembly assembly, ObjectHandleOnStack granted, ObjectHandleOnStack denied); - [SecurityCritical] internal void GetGrantSet(out PermissionSet newGrant, out PermissionSet newDenied) { PermissionSet granted = null, denied = null; @@ -1948,60 +1834,51 @@ namespace System.Reflection newGrant = granted; newDenied = denied; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private extern static bool IsAllSecurityCritical(RuntimeAssembly assembly); // Is everything introduced by this assembly critical - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsAllSecurityCritical() { return IsAllSecurityCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private extern static bool IsAllSecuritySafeCritical(RuntimeAssembly assembly); // Is everything introduced by this assembly safe critical - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsAllSecuritySafeCritical() { return IsAllSecuritySafeCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private extern static bool IsAllPublicAreaSecuritySafeCritical(RuntimeAssembly assembly); // Is everything introduced by this assembly safe critical - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsAllPublicAreaSecuritySafeCritical() { return IsAllPublicAreaSecuritySafeCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private extern static bool IsAllSecurityTransparent(RuntimeAssembly assembly); // Is everything introduced by this assembly transparent - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsAllSecurityTransparent() { return IsAllSecurityTransparent(GetNativeHandle()); } // This method is called by the VM. - [System.Security.SecurityCritical] private RuntimeModule OnModuleResolveEvent(String moduleName) { ModuleResolveEventHandler moduleResolve = _ModuleResolve; @@ -2034,7 +1911,6 @@ namespace System.Reflection return InternalGetSatelliteAssembly(culture, version, ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal Assembly InternalGetSatelliteAssembly(CultureInfo culture, Version version, @@ -2049,7 +1925,6 @@ namespace System.Reflection return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal RuntimeAssembly InternalGetSatelliteAssembly(String name, CultureInfo culture, @@ -2084,7 +1959,6 @@ namespace System.Reflection } // Helper method used by InternalGetSatelliteAssembly only. Not abstracted for use elsewhere. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable private RuntimeAssembly InternalProbeForSatelliteAssemblyNextToParentAssembly(AssemblyName an, String name, @@ -2192,11 +2066,9 @@ namespace System.Reflection return retAssembly; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern RuntimeAssembly nLoadFile(String path, Evidence evidence); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern RuntimeAssembly nLoadImage(byte[] rawAssembly, byte[] rawSymbolStore, @@ -2205,7 +2077,6 @@ namespace System.Reflection bool fIntrospection, SecurityContextSource securityContextSource); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static internal extern unsafe void nLoadFromUnmanagedArray(bool fIntrospection, @@ -2216,7 +2087,6 @@ namespace System.Reflection StackCrawlMarkHandle stackMark, ObjectHandleOnStack retAssembly); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetModules(RuntimeAssembly assembly, @@ -2224,7 +2094,6 @@ namespace System.Reflection bool getResourceModules, ObjectHandleOnStack retModuleHandles); - [System.Security.SecuritySafeCritical] // auto-generated private RuntimeModule[] GetModulesInternal(bool loadIfNotFound, bool getResourceModules) { @@ -2243,11 +2112,9 @@ namespace System.Reflection return GetModulesInternal(false, getResourceModules); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeModule GetManifestModule(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetToken(RuntimeAssembly assembly); } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/AssemblyName.cs b/src/coreclr/src/mscorlib/src/System/Reflection/AssemblyName.cs index 293cc9b..48eab33 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/AssemblyName.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/AssemblyName.cs @@ -104,19 +104,12 @@ namespace System.Reflection { public String CodeBase { -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif get { return _CodeBase; } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif set { _CodeBase = value; } } public String EscapedCodeBase { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_CodeBase == null) @@ -190,7 +183,6 @@ namespace System.Reflection { * if the file contains an assembly manifest. This method causes * the file to be opened and closed. */ - [System.Security.SecuritySafeCritical] // auto-generated static public AssemblyName GetAssemblyName(String assemblyFile) { if(assemblyFile == null) @@ -231,7 +223,6 @@ namespace System.Reflection { // The compressed version of the public key formed from a truncated hash. // Will throw a SecurityException if _PublicKey is invalid - [System.Security.SecuritySafeCritical] // auto-generated public byte[] GetPublicKeyToken() { if (_PublicKeyToken == null) @@ -280,7 +271,6 @@ namespace System.Reflection { public String FullName { - [System.Security.SecuritySafeCritical] // auto-generated get { return nToString(); } @@ -296,7 +286,6 @@ namespace System.Reflection { return s; } - [System.Security.SecurityCritical] // auto-generated_required public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -361,7 +350,6 @@ namespace System.Reflection { m_siInfo = info; } - [System.Security.SecuritySafeCritical] // auto-generated public AssemblyName(String assemblyName) { if (assemblyName == null) @@ -375,7 +363,6 @@ namespace System.Reflection { nInit(); } - [System.Security.SecuritySafeCritical] // auto-generated static public bool ReferenceMatchesDefinition(AssemblyName reference, AssemblyName definition) { @@ -390,7 +377,6 @@ namespace System.Reflection { /// "parse" tells us to parse the simple name of the assembly as if it was the full name /// almost never the right thing to do, but needed for compat - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern bool ReferenceMatchesDefinitionInternal(AssemblyName reference, AssemblyName definition, @@ -398,11 +384,9 @@ namespace System.Reflection { - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void nInit(out RuntimeAssembly assembly, bool forIntrospection, bool raiseResolveEvent); - [System.Security.SecurityCritical] // auto-generated internal void nInit() { RuntimeAssembly dummy = null; @@ -489,19 +473,15 @@ namespace System.Reflection { // This call opens and closes the file, but does not add the // assembly to the domain. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern AssemblyName nGetFileInformation(String s); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern String nToString(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern byte[] nGetPublicKeyToken(); - [System.Security.SecurityCritical] // auto-generated static internal String EscapeCodeBase(String codebase) { if (codebase == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Associates.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Associates.cs index 8b34e77..290a629 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Associates.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Associates.cs @@ -35,7 +35,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated private static unsafe RuntimeMethodInfo AssignAssociates( int tkMethod, RuntimeType declaredType, @@ -109,7 +108,6 @@ namespace System.Reflection return associateMethod; } - [System.Security.SecurityCritical] // auto-generated internal static unsafe void AssignAssociates( MetadataImport scope, int mdPropEvent, diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs index db294cb..ee9cf8a 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs @@ -25,9 +25,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_ConstructorInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class ConstructorInfo : MethodBase, _ConstructorInfo { @@ -202,7 +199,6 @@ namespace System.Reflection internal INVOCATION_FLAGS InvocationFlags { - [System.Security.SecuritySafeCritical] get { if ((m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) == 0) @@ -258,7 +254,6 @@ namespace System.Reflection #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal RuntimeConstructorInfo( RuntimeMethodHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, BindingFlags bindingFlags) @@ -276,7 +271,6 @@ namespace System.Reflection #region NonPublic Methods RuntimeMethodHandleInternal IRuntimeMethodInfo.Value { - [System.Security.SecuritySafeCritical] get { return new RuntimeMethodHandleInternal(m_handle); @@ -375,7 +369,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) @@ -400,7 +393,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeMethodHandle.GetName(this); } } [System.Runtime.InteropServices.ComVisible(true)] @@ -424,7 +416,6 @@ namespace System.Reflection public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeMethodHandle.GetMethodDef(this); } } public override Module Module @@ -442,7 +433,6 @@ namespace System.Reflection // This seems to always returns System.Void. internal override Type GetReturnType() { return Signature.ReturnType; } - [System.Security.SecuritySafeCritical] // auto-generated internal override ParameterInfo[] GetParametersNoCopy() { if (m_parameters == null) @@ -547,7 +537,6 @@ namespace System.Reflection throw new TargetException(); } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable @@ -617,7 +606,6 @@ namespace System.Reflection } - [System.Security.SecuritySafeCritical] // overrides SC member #pragma warning disable 618 [ReflectionPermissionAttribute(SecurityAction.Demand, Flags = ReflectionPermissionFlag.MemberAccess)] #pragma warning restore 618 @@ -666,7 +654,6 @@ namespace System.Reflection #endregion #region ConstructorInfo Overrides - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable @@ -728,7 +715,6 @@ namespace System.Reflection #endregion #region ISerializable Implementation - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs b/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs index ba943d1..ff131bf 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs @@ -63,7 +63,6 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeType target) { Contract.Assert(target != null); @@ -86,7 +85,6 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeFieldInfo target) { Contract.Assert(target != null); @@ -109,7 +107,6 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeMethodInfo target) { Contract.Assert(target != null); @@ -132,7 +129,6 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeConstructorInfo target) { Contract.Assert(target != null); @@ -140,7 +136,6 @@ namespace System.Reflection return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeEventInfo target) { Contract.Assert(target != null); @@ -148,7 +143,6 @@ namespace System.Reflection return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimePropertyInfo target) { Contract.Assert(target != null); @@ -156,7 +150,6 @@ namespace System.Reflection return GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeModule target) { Contract.Assert(target != null); @@ -167,7 +160,6 @@ namespace System.Reflection return GetCustomAttributes(target, target.MetadataToken); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeAssembly target) { Contract.Assert(target != null); @@ -190,7 +182,6 @@ namespace System.Reflection return Array.AsReadOnly(pca); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IList GetCustomAttributesInternal(RuntimeParameterInfo target) { Contract.Assert(target != null); @@ -302,7 +293,6 @@ namespace System.Reflection return new CustomAttributeType(encodedType, encodedArrayType, encodedEnumType, enumName); } - [System.Security.SecurityCritical] // auto-generated private static IList GetCustomAttributes(RuntimeModule module, int tkTarget) { CustomAttributeRecord[] records = GetCustomAttributeRecords(module, tkTarget); @@ -316,7 +306,6 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecurityCritical] // auto-generated internal unsafe static CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken) { MetadataImport scope = module.MetadataImport; @@ -369,7 +358,6 @@ namespace System.Reflection { } - [System.Security.SecuritySafeCritical] // auto-generated private CustomAttributeData(RuntimeModule scope, CustomAttributeRecord caRecord) { m_scope = scope; @@ -753,7 +741,6 @@ namespace System.Reflection } } - [SecuritySafeCritical] private static object EncodedValueToRawValue(long val, CustomAttributeEncoding encodedType) { switch (encodedType) @@ -1015,7 +1002,6 @@ namespace System.Reflection internal struct CustomAttributeEncodedArgument { #region Parser - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ParseAttributeArguments( IntPtr pCa, @@ -1024,7 +1010,6 @@ namespace System.Reflection ref CustomAttributeNamedParameter[] CustomAttributeTypedArgument, RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated internal static void ParseAttributeArguments(ConstArray attributeBlob, ref CustomAttributeCtorParameter[] customAttributeCtorParameters, ref CustomAttributeNamedParameter[] customAttributeNamedParameters, @@ -1131,11 +1116,9 @@ namespace System.Reflection IntPtr m_Next; IntPtr m_Assembly; - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void Push(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public extern void Pop(); @@ -1183,7 +1166,6 @@ namespace System.Reflection #endregion #region Internal Static Members - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeType type, RuntimeType caType, bool inherit) { Contract.Requires(type != null); @@ -1213,7 +1195,6 @@ namespace System.Reflection return false; } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit) { Contract.Requires(method != null); @@ -1241,7 +1222,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType) { Contract.Requires(ctor != null); @@ -1253,7 +1233,6 @@ namespace System.Reflection return IsCustomAttributeDefined(ctor.GetRuntimeModule(), ctor.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType) { Contract.Requires(property != null); @@ -1265,7 +1244,6 @@ namespace System.Reflection return IsCustomAttributeDefined(property.GetRuntimeModule(), property.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType) { Contract.Requires(e != null); @@ -1277,7 +1255,6 @@ namespace System.Reflection return IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType) { Contract.Requires(field != null); @@ -1289,7 +1266,6 @@ namespace System.Reflection return IsCustomAttributeDefined(field.GetRuntimeModule(), field.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType) { Contract.Requires(parameter != null); @@ -1301,7 +1277,6 @@ namespace System.Reflection return IsCustomAttributeDefined(parameter.GetRuntimeModule(), parameter.MetadataToken, caType); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType) { Contract.Requires(assembly != null); @@ -1313,7 +1288,6 @@ namespace System.Reflection return IsCustomAttributeDefined(assembly.ManifestModule as RuntimeModule, RuntimeAssembly.GetToken(assembly.GetNativeHandle()), caType); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeModule module, RuntimeType caType) { Contract.Requires(module != null); @@ -1325,7 +1299,6 @@ namespace System.Reflection return IsCustomAttributeDefined(module, module.MetadataToken, caType); } - [System.Security.SecurityCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit) { Contract.Requires(type != null); @@ -1429,7 +1402,6 @@ namespace System.Reflection return AllowCriticalCustomAttributes(parameter.DefiningMethod); } - [System.Security.SecurityCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit) { Contract.Requires(method != null); @@ -1474,7 +1446,6 @@ namespace System.Reflection return typedResult; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType) { Contract.Requires(ctor != null); @@ -1487,7 +1458,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) { Contract.Requires(property != null); @@ -1506,7 +1476,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType) { Contract.Requires(e != null); @@ -1524,7 +1493,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType) { Contract.Requires(field != null); @@ -1537,7 +1505,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType) { Contract.Requires(parameter != null); @@ -1550,7 +1517,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) { Contract.Requires(assembly != null); @@ -1565,7 +1531,6 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType) { Contract.Requires(module != null); @@ -1579,20 +1544,17 @@ namespace System.Reflection return attributes; } - [System.Security.SecuritySafeCritical] internal static bool IsAttributeDefined(RuntimeModule decoratedModule, int decoratedMetadataToken, int attributeCtorToken) { return IsCustomAttributeDefined(decoratedModule, decoratedMetadataToken, null, attributeCtorToken, false); } - [System.Security.SecurityCritical] // auto-generated private static bool IsCustomAttributeDefined( RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType attributeFilterType) { return IsCustomAttributeDefined(decoratedModule, decoratedMetadataToken, attributeFilterType, 0, false); } - [System.Security.SecurityCritical] // auto-generated private static bool IsCustomAttributeDefined( RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType attributeFilterType, int attributeCtorToken, bool mustBeInheritable) { @@ -1642,14 +1604,12 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated private unsafe static object[] GetCustomAttributes( RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType, bool isDecoratedTargetSecurityTransparent) { return GetCustomAttributes(decoratedModule, decoratedMetadataToken, pcaCount, attributeFilterType, false, null, isDecoratedTargetSecurityTransparent); } - [System.Security.SecurityCritical] private unsafe static object[] GetCustomAttributes( RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType, bool mustBeInheritable, IList derivedAttributes, bool isDecoratedTargetSecurityTransparent) @@ -1841,7 +1801,6 @@ namespace System.Reflection return result; } - [System.Security.SecurityCritical] // auto-generated private unsafe static bool FilterCustomAttributeRecord( CustomAttributeRecord caRecord, MetadataImport scope, @@ -1946,7 +1905,6 @@ namespace System.Reflection #endregion #region Private Static Methods - [System.Security.SecurityCritical] // auto-generated private static bool AttributeUsageCheck( RuntimeType attributeType, bool mustBeInheritable, object[] attributes, IList derivedAttributes) { @@ -1979,7 +1937,6 @@ namespace System.Reflection return true; } - [System.Security.SecurityCritical] // auto-generated internal static AttributeUsageAttribute GetAttributeUsage(RuntimeType decoratedAttribute) { RuntimeModule decoratedModule = decoratedAttribute.GetRuntimeModule(); @@ -2014,11 +1971,9 @@ namespace System.Reflection #endregion #region Private Static FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _ParseAttributeUsageAttribute( IntPtr pCa, int cCa, out int targets, out bool inherited, out bool allowMultiple); - [System.Security.SecurityCritical] // auto-generated private static void ParseAttributeUsageAttribute( ConstArray ca, out AttributeTargets targets, out bool inherited, out bool allowMultiple) { @@ -2027,10 +1982,8 @@ namespace System.Reflection targets = (AttributeTargets)_targets; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern Object _CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, byte** ppBlob, byte* pEndBlob, int* pcNamedArgs); - [System.Security.SecurityCritical] // auto-generated private static unsafe Object CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs) { byte* pBlob = (byte*)blob; @@ -2042,11 +1995,9 @@ namespace System.Reflection return ca; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern static void _GetPropertyOrFieldData( RuntimeModule pModule, byte** ppBlobStart, byte* pBlobEnd, out string name, out bool bIsProperty, out RuntimeType type, out object value); - [System.Security.SecurityCritical] // auto-generated private unsafe static void GetPropertyOrFieldData( RuntimeModule module, ref IntPtr blobStart, IntPtr blobEnd, out string name, out bool isProperty, out RuntimeType type, out object value) { @@ -2056,7 +2007,6 @@ namespace System.Reflection blobStart = (IntPtr)pBlobStart; } - [System.Security.SecuritySafeCritical] private static object[] CreateAttributeArrayHelper(Type elementType, int elementCount) { return (object[])Array.UnsafeCreateInstance(elementType, elementCount); @@ -2083,7 +2033,6 @@ namespace System.Reflection #endregion #region Static Constructor - [System.Security.SecurityCritical] // auto-generated static PseudoCustomAttribute() { RuntimeType[] pcas = new RuntimeType[] @@ -2113,7 +2062,6 @@ namespace System.Reflection s_pca = temp_pca; } - [System.Security.SecurityCritical] // auto-generated [Conditional("_DEBUG")] private static void VerifyPseudoCustomAttribute(RuntimeType pca) { @@ -2135,7 +2083,6 @@ namespace System.Reflection #pragma warning restore 618 } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool includeSecCa, out int count) { Contract.Requires(type != null); @@ -2179,7 +2126,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeType type, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2204,7 +2150,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool includeSecCa, out int count) { Contract.Requires(method != null); @@ -2243,7 +2188,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2269,7 +2213,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, out int count) { Contract.Requires(parameter != null); @@ -2306,7 +2249,6 @@ namespace System.Reflection } return pcas; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2334,7 +2276,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType, bool includeSecCa, out int count) { count = 0; @@ -2369,7 +2310,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType) { int count; @@ -2386,7 +2326,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType, out int count) { Contract.Requires(field != null); @@ -2418,7 +2357,6 @@ namespace System.Reflection } return pcas; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); @@ -2441,7 +2379,6 @@ namespace System.Reflection return false; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType, bool includeSecCa, out int count) { count = 0; @@ -2467,7 +2404,6 @@ namespace System.Reflection count = pcas.Count; return pcas.ToArray(); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType) { bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs index 6484677..fb93249 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs @@ -22,59 +22,45 @@ namespace System.Reflection.Emit } #region QCalls - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern IntPtr CreateTypeNameBuilder(); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void ReleaseTypeNameBuilder(IntPtr pAQN); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void OpenGenericArguments(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void CloseGenericArguments(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void OpenGenericArgument(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void CloseGenericArgument(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddName(IntPtr tnb, string name); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddPointer(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddByRef(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddSzArray(IntPtr tnb); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddArray(IntPtr tnb, int rank); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddAssemblySpec(IntPtr tnb, string assemblySpec); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void ToString(IntPtr tnb, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void Clear(IntPtr tnb); @@ -83,7 +69,6 @@ namespace System.Reflection.Emit #region Static Members // TypeNameBuilder is NOT thread safe NOR reliable - [System.Security.SecuritySafeCritical] // auto-generated internal static string ToString(Type type, Format format) { if (format == Format.FullName || format == Format.AssemblyQualifiedName) @@ -107,12 +92,10 @@ namespace System.Reflection.Emit #region Constructor private TypeNameBuilder(IntPtr typeNameBuilder) { m_typeNameBuilder = typeNameBuilder; } - [System.Security.SecurityCritical] // auto-generated internal void Dispose() { ReleaseTypeNameBuilder(m_typeNameBuilder); } #endregion #region private Members - [System.Security.SecurityCritical] // auto-generated private void AddElementType(Type elementType) { if (elementType.HasElementType) @@ -131,7 +114,6 @@ namespace System.Reflection.Emit AddArray(elementType.GetArrayRank()); } - [System.Security.SecurityCritical] // auto-generated private void ConstructAssemblyQualifiedNameWorker(Type type, Format format) { Type rootType = type; @@ -179,29 +161,17 @@ namespace System.Reflection.Emit AddAssemblySpec(type.Module.Assembly.FullName); } - [System.Security.SecurityCritical] // auto-generated private void OpenGenericArguments() { OpenGenericArguments(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void CloseGenericArguments() { CloseGenericArguments(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void OpenGenericArgument() { OpenGenericArgument(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void CloseGenericArgument() { CloseGenericArgument(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void AddName(string name) { AddName(m_typeNameBuilder, name); } - [System.Security.SecurityCritical] // auto-generated private void AddPointer() { AddPointer(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void AddByRef() { AddByRef(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void AddSzArray() { AddSzArray(m_typeNameBuilder); } - [System.Security.SecurityCritical] // auto-generated private void AddArray(int rank) { AddArray(m_typeNameBuilder, rank); } - [System.Security.SecurityCritical] // auto-generated private void AddAssemblySpec(string assemblySpec) { AddAssemblySpec(m_typeNameBuilder, assemblySpec); } - [System.Security.SecuritySafeCritical] // auto-generated public override string ToString() { string ret = null; ToString(m_typeNameBuilder, JitHelpers.GetStringHandleOnStack(ref ret)); return ret; } - [System.Security.SecurityCritical] // auto-generated private void Clear() { Clear(m_typeNameBuilder); } #endregion } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs index 3d6d21a..bd3de8c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -98,17 +98,11 @@ namespace System.Reflection.Emit throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly")); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override FileStream GetFile(String name) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly")); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override FileStream[] GetFiles(bool getResourceModules) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly")); @@ -131,9 +125,6 @@ namespace System.Reflection.Emit public override String Location { -#if FEATURE_CORECLR - [SecurityCritical] -#endif // FEATURE_CORECLR get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly")); @@ -142,9 +133,6 @@ namespace System.Reflection.Emit public override String CodeBase { -#if FEATURE_CORECLR - [SecurityCritical] -#endif // FEATURE_CORECLR get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly")); @@ -175,22 +163,18 @@ namespace System.Reflection.Emit public sealed class AssemblyBuilder : Assembly, _AssemblyBuilder { #region FCALL - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern RuntimeModule GetInMemoryAssemblyModule(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated private Module nGetInMemoryAssemblyModule() { return AssemblyBuilder.GetInMemoryAssemblyModule(GetNativeHandle()); } #if !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern RuntimeModule GetOnDiskAssemblyModule(RuntimeAssembly assembly); - [System.Security.SecurityCritical] // auto-generated private ModuleBuilder GetOnDiskAssemblyModuleBuilder() { if (m_onDiskAssemblyModuleBuilder == null) @@ -271,7 +255,6 @@ namespace System.Reflection.Emit return InternalAssembly.GetNativeHandle(); } - [SecurityCritical] internal Version GetVersion() { return InternalAssembly.GetVersion(); @@ -289,7 +272,6 @@ namespace System.Reflection.Emit #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal AssemblyBuilder(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, @@ -427,7 +409,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private void InitManifestModule() { InternalModuleBuilder modBuilder = (InternalModuleBuilder)nGetInMemoryAssemblyModule(); @@ -456,7 +437,6 @@ namespace System.Reflection.Emit * to have a strong name and a hash will be computed when the assembly * is saved. **********************************************/ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -469,7 +449,6 @@ namespace System.Reflection.Emit null, null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static AssemblyBuilder DefineDynamicAssembly( AssemblyName name, @@ -487,7 +466,6 @@ namespace System.Reflection.Emit } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Assembly nCreateDynamicAssembly(AppDomain domain, AssemblyName name, @@ -504,7 +482,6 @@ namespace System.Reflection.Emit private class AssemblyBuilderLock { } - [System.Security.SecurityCritical] // auto-generated internal static AssemblyBuilder InternalDefineDynamicAssembly( AssemblyName name, AssemblyBuilderAccess access, @@ -543,7 +520,6 @@ namespace System.Reflection.Emit * a transient module. * **********************************************/ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public ModuleBuilder DefineDynamicModule( String name) @@ -554,7 +530,6 @@ namespace System.Reflection.Emit return DefineDynamicModuleInternal(name, false, ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public ModuleBuilder DefineDynamicModule( String name, @@ -566,7 +541,6 @@ namespace System.Reflection.Emit return DefineDynamicModuleInternal( name, emitSymbolInfo, ref stackMark ); } - [System.Security.SecurityCritical] // auto-generated private ModuleBuilder DefineDynamicModuleInternal( String name, bool emitSymbolInfo, // specify if emit symbol info or not @@ -578,7 +552,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private ModuleBuilder DefineDynamicModuleInternalNoLock( String name, bool emitSymbolInfo, // specify if emit symbol info or not @@ -794,7 +767,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] private void AddResourceFileNoLock( String name, String fileName, @@ -882,17 +854,11 @@ namespace System.Reflection.Emit return InternalAssembly.GetManifestResourceNames(); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override FileStream GetFile(String name) { return InternalAssembly.GetFile(name); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override FileStream[] GetFiles(bool getResourceModules) { return InternalAssembly.GetFiles(getResourceModules); @@ -915,9 +881,6 @@ namespace System.Reflection.Emit public override String Location { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif get { return InternalAssembly.Location; @@ -934,9 +897,6 @@ namespace System.Reflection.Emit public override String CodeBase { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif get { return InternalAssembly.CodeBase; @@ -959,9 +919,6 @@ namespace System.Reflection.Emit return InternalAssembly.GetExportedTypes(); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public override AssemblyName GetName(bool copiedName) { return InternalAssembly.GetName(copiedName); @@ -1147,7 +1104,6 @@ namespace System.Reflection.Emit Buffer.BlockCopy(resource, 0, m_assemblyData.m_resourceBytes, 0, resource.Length); } - [System.Security.SecuritySafeCritical] // auto-generated public void DefineUnmanagedResource(String resourceFileName) { if (resourceFileName == null) @@ -1160,7 +1116,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private void DefineUnmanagedResourceNoLock(String resourceFileName) { if (m_assemblyData.m_strResourceFileName != null || @@ -1234,17 +1189,11 @@ namespace System.Reflection.Emit * an exe. * **********************************************/ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void SetEntryPoint( MethodInfo entryMethod) { SetEntryPoint(entryMethod, PEFileKinds.ConsoleApplication); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void SetEntryPoint( MethodInfo entryMethod, // entry method for the assembly. We use this to determine the entry module PEFileKinds fileKind) // file kind for the assembly. @@ -1290,11 +1239,6 @@ namespace System.Reflection.Emit /********************************************** * Use this function if client decides to form the custom attribute blob themselves **********************************************/ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -1310,7 +1254,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private void SetCustomAttributeNoLock(ConstructorInfo con, byte[] binaryAttribute) { TypeBuilder.DefineCustomAttribute( @@ -1332,7 +1275,6 @@ namespace System.Reflection.Emit /********************************************** * Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder **********************************************/ - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) @@ -1347,7 +1289,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private void SetCustomAttributeNoLock(CustomAttributeBuilder customBuilder) { customBuilder.CreateCustomAttribute( @@ -1377,7 +1318,6 @@ namespace System.Reflection.Emit Save(assemblyFileName, System.Reflection.PortableExecutableKinds.ILOnly, System.Reflection.ImageFileMachine.I386); } - [System.Security.SecuritySafeCritical] // auto-generated public void Save(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) { @@ -1406,7 +1346,6 @@ namespace System.Reflection.Emit * Internal helper to walk the nested type hierachy * **********************************************/ - [System.Security.SecurityCritical] // auto-generated private int DefineNestedComType(Type type, int tkResolutionScope, int tkTypeDef) { Type enclosingType = type.DeclaringType; @@ -1421,7 +1360,6 @@ namespace System.Reflection.Emit return AddExportedTypeOnDisk(GetNativeHandle(), type.Name, tkResolutionScope, tkTypeDef, type.Attributes); } - [System.Security.SecurityCritical] // auto-generated internal int DefineExportedTypeInMemory(Type type, int tkResolutionScope, int tkTypeDef) { Type enclosingType = type.DeclaringType; @@ -1473,7 +1411,6 @@ namespace System.Reflection.Emit #endif // Create a new module in which to emit code. This module will not contain the manifest. - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void DefineDynamicModule(RuntimeAssembly containingAssembly, @@ -1486,7 +1423,6 @@ namespace System.Reflection.Emit bool fIsTransient, out int tkFile); - [System.Security.SecurityCritical] // auto-generated private static Module DefineDynamicModule(RuntimeAssembly containingAssembly, bool emitSymbolInfo, String name, @@ -1512,12 +1448,10 @@ namespace System.Reflection.Emit } // The following functions are native helpers for creating on-disk manifest - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void PrepareForSavingManifestToDisk(RuntimeAssembly assembly, RuntimeModule assemblyModule); // module to contain assembly information if assembly is embedded - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void SaveManifestToDisk(RuntimeAssembly assembly, @@ -1527,19 +1461,16 @@ namespace System.Reflection.Emit int portableExecutableKind, int ImageFileMachine); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern int AddFile(RuntimeAssembly assembly, String strFileName); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void SetFileHashValue(RuntimeAssembly assembly, int tkFile, String strFullFileName); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern int AddExportedTypeInMemory(RuntimeAssembly assembly, @@ -1548,7 +1479,6 @@ namespace System.Reflection.Emit int tkTypeDef, TypeAttributes flags); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern int AddExportedTypeOnDisk(RuntimeAssembly assembly, @@ -1558,7 +1488,6 @@ namespace System.Reflection.Emit TypeAttributes flags); // Add an entry to assembly's manifestResource table for a stand alone resource. - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void AddStandAloneResource(RuntimeAssembly assembly, @@ -1567,7 +1496,6 @@ namespace System.Reflection.Emit String strFullFileName, int attribute); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] #pragma warning disable 618 @@ -1575,7 +1503,6 @@ namespace System.Reflection.Emit #pragma warning restore 618 // Functions for defining unmanaged resources. - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static private extern void CreateVersionInfoResource(String filename, String title, String iconFilename, String description, diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs index b2e62d6..3d08dc0 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -29,7 +29,6 @@ namespace System.Reflection.Emit { // this class cannot be accessed from the EE. internal class AssemblyBuilderData { - [SecurityCritical] internal AssemblyBuilderData( InternalAssemblyBuilder assembly, String strAssemblyName, @@ -120,7 +119,6 @@ namespace System.Reflection.Emit { // If DefineUnmanagedVersionInfo is called, the parameter provided will override // the CA's value. // - [System.Security.SecurityCritical] // auto-generated internal void FillUnmanagedVersionInfo() { // Get the lcid set on the assembly name as default if available diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs index acdfc44..37faaf2 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs @@ -31,7 +31,6 @@ namespace System.Reflection.Emit { } - [System.Security.SecurityCritical] // auto-generated internal ConstructorBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers, ModuleBuilder mod, TypeBuilder type) { @@ -49,7 +48,6 @@ namespace System.Reflection.Emit token = m_methodBuilder.GetToken(); } - [System.Security.SecurityCritical] // auto-generated internal ConstructorBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, ModuleBuilder mod, TypeBuilder type) : this(name, attributes, callingConvention, parameterTypes, null, null, mod, type) @@ -205,9 +203,6 @@ namespace System.Reflection.Emit return m_methodBuilder.GetILGenerator(streamSize); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void SetMethodBody(byte[] il, int maxStack, byte[] localSignature, IEnumerable exceptionHandlers, IEnumerable tokenFixups) { if (m_isDefaultConstructor) @@ -252,9 +247,6 @@ namespace System.Reflection.Emit get { return m_methodBuilder.Signature; } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs index 3ef44a5..c7ae930 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs @@ -550,7 +550,6 @@ namespace System.Reflection.Emit { // return the byte interpretation of the custom attribute - [System.Security.SecurityCritical] // auto-generated internal void CreateCustomAttribute(ModuleBuilder mod, int tkOwner) { CreateCustomAttribute(mod, tkOwner, mod.GetConstructorToken(m_con).Token, false); @@ -563,7 +562,6 @@ namespace System.Reflection.Emit { // This function has to be called before we snap the in-memory module for on disk (i.e. Presave on // ModuleBuilder. //************************************************* - [System.Security.SecurityCritical] // auto-generated internal int PrepareCreateCustomAttributeToDisk(ModuleBuilder mod) { return mod.InternalGetConstructorToken(m_con, true).Token; @@ -572,7 +570,6 @@ namespace System.Reflection.Emit { //************************************************* // Call this function with toDisk=1, after on disk module has been snapped. //************************************************* - [System.Security.SecurityCritical] // auto-generated internal void CreateCustomAttribute(ModuleBuilder mod, int tkOwner, int tkAttrib, bool toDisk) { TypeBuilder.DefineCustomAttribute(mod, tkOwner, tkAttrib, m_blob, toDisk, diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs index 7a5c5a8..7d44fd9 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs @@ -35,7 +35,6 @@ namespace System.Reflection.Emit } - [System.Security.SecurityCritical] // auto-generated internal void GetCallableMethod(RuntimeModule module, DynamicMethod dm) { dm.m_methodHandle = ModuleHandle.GetDynamicMethod(dm, @@ -86,7 +85,6 @@ namespace System.Reflection.Emit // Token resolution calls // // - [System.Security.SecuritySafeCritical] // auto-generated public override void Emit(OpCode opcode, MethodInfo meth) { if (meth == null) @@ -227,7 +225,6 @@ namespace System.Reflection.Emit // Signature related calls (vararg, calli) // // - [System.Security.SecuritySafeCritical] // overrides SC public override void EmitCalli(OpCode opcode, CallingConventions callingConvention, Type returnType, @@ -306,7 +303,6 @@ namespace System.Reflection.Emit PutInteger4(token); } - [System.Security.SecuritySafeCritical] // auto-generated public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes) { if (methodInfo == null) @@ -481,7 +477,6 @@ namespace System.Reflection.Emit throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); } - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefToken(MethodBase methodInfo, Type[] optionalParameterTypes) { Type[] parameterTypes; @@ -518,7 +513,6 @@ namespace System.Reflection.Emit return GetTokenForVarArgMethod(dm, sig); } - [System.Security.SecurityCritical] // auto-generated internal override SignatureHelper GetMemberRefSignature( CallingConventions call, Type returnType, @@ -703,9 +697,6 @@ namespace System.Reflection.Emit m_method.m_resolver = this; } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif internal DynamicResolver(DynamicILInfo dynamicILInfo) { m_stackSize = dynamicILInfo.MaxStackSize; @@ -773,7 +764,6 @@ namespace System.Reflection.Emit { internal RuntimeMethodHandleInternal m_methodHandle; - [System.Security.SecuritySafeCritical] // auto-generated ~DestroyScout() { if (m_methodHandle.IsNullHandle()) @@ -886,7 +876,6 @@ namespace System.Reflection.Emit return m_exceptionHeader; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe void GetEHInfo(int excNumber, void* exc) { CORINFO_EH_CLAUSE* exception = (CORINFO_EH_CLAUSE*)exc; @@ -921,7 +910,6 @@ namespace System.Reflection.Emit } #endif // FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] internal override void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle) { typeHandle = new IntPtr(); @@ -1002,9 +990,6 @@ namespace System.Reflection.Emit } -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#endif [System.Runtime.InteropServices.ComVisible(true)] public class DynamicILInfo { @@ -1031,7 +1016,6 @@ namespace System.Reflection.Emit #endregion #region Internal Methods - [System.Security.SecurityCritical] // auto-generated internal void GetCallableMethod(RuntimeModule module, DynamicMethod dm) { dm.m_methodHandle = ModuleHandle.GetDynamicMethod(dm, @@ -1063,7 +1047,6 @@ namespace System.Reflection.Emit m_maxStackSize = maxStackSize; } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe void SetCode(byte* code, int codeSize, int maxStackSize) { @@ -1089,7 +1072,6 @@ namespace System.Reflection.Emit m_exceptions = (exceptions != null) ? (byte[])exceptions.Clone() : EmptyArray.Value; } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe void SetExceptions(byte* exceptions, int exceptionsSize) { @@ -1114,7 +1096,6 @@ namespace System.Reflection.Emit m_localSignature = (localSignature != null) ? (byte[])localSignature.Clone() : EmptyArray.Value; } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe void SetLocalSignature(byte* localSignature, int signatureSize) { @@ -1135,7 +1116,6 @@ namespace System.Reflection.Emit #endregion #region Public Scope Methods - [System.Security.SecuritySafeCritical] // auto-generated public int GetTokenFor(RuntimeMethodHandle method) { return DynamicScope.GetTokenFor(method); @@ -1221,7 +1201,6 @@ namespace System.Reflection.Emit #endregion #region Public Methods - [System.Security.SecuritySafeCritical] // auto-generated public int GetTokenFor(RuntimeMethodHandle method) { IRuntimeMethodInfo methodReal = method.GetMethodInfo(); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs index bb6af23..dbea8de 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs @@ -25,9 +25,6 @@ namespace System.Reflection.Emit internal IRuntimeMethodInfo m_methodHandle; private RuntimeType m_returnType; private DynamicILGenerator m_ilGenerator; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif private DynamicILInfo m_DynamicILInfo; private bool m_fInitLocals; private RuntimeModule m_module; @@ -72,7 +69,6 @@ namespace System.Reflection.Emit private DynamicMethod() { } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -92,7 +88,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -113,11 +108,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -137,11 +127,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -162,11 +147,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, MethodAttributes attributes, @@ -189,11 +169,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -213,11 +188,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, Type returnType, @@ -238,11 +208,6 @@ namespace System.Reflection.Emit ref stackMark); // transparentMethod } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public DynamicMethod(string name, MethodAttributes attributes, @@ -286,7 +251,6 @@ namespace System.Reflection.Emit // We create a transparent assembly to host DynamicMethods. Since the assembly does not have any // non-public fields (or any fields at all), it is a safe anonymous assembly to host DynamicMethods - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable private static RuntimeModule GetDynamicMethodsModule() { @@ -338,7 +302,6 @@ namespace System.Reflection.Emit return s_anonymouslyHostedDynamicMethodsModule; } - [System.Security.SecurityCritical] // auto-generated private unsafe void Init(String name, MethodAttributes attributes, CallingConventions callingConvention, @@ -435,7 +398,6 @@ namespace System.Reflection.Emit m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention); } - [System.Security.SecurityCritical] // auto-generated private void PerformSecurityCheck(Module m, ref StackCrawlMark stackMark, bool skipVisibility) { if (m == null) @@ -481,7 +443,6 @@ namespace System.Reflection.Emit #endif //!FEATURE_CORECLR } - [System.Security.SecurityCritical] // auto-generated private void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility) { if (owner == null) @@ -529,7 +490,6 @@ namespace System.Reflection.Emit // Delegate and method creation // - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public sealed override Delegate CreateDelegate(Type delegateType) { if (m_restrictedSkipVisibility) @@ -545,7 +505,6 @@ namespace System.Reflection.Emit return d; } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public sealed override Delegate CreateDelegate(Type delegateType, Object target) { if (m_restrictedSkipVisibility) @@ -578,7 +537,6 @@ namespace System.Reflection.Emit #endif // This is guaranteed to return a valid handle - [System.Security.SecurityCritical] // auto-generated internal unsafe RuntimeMethodHandle GetMethodDescriptor() { if (m_methodHandle == null) { lock (this) { @@ -639,7 +597,6 @@ namespace System.Reflection.Emit #if FEATURE_CORECLR get { return true; } #else - [SecuritySafeCritical] get { if (m_methodHandle != null) @@ -669,7 +626,6 @@ namespace System.Reflection.Emit #if FEATURE_CORECLR get { return false; } #else - [SecuritySafeCritical] get { if (m_methodHandle != null) @@ -699,7 +655,6 @@ namespace System.Reflection.Emit #if FEATURE_CORECLR get { return false; } #else - [SecuritySafeCritical] get { if (m_methodHandle != null) @@ -724,7 +679,6 @@ namespace System.Reflection.Emit #endif } - [System.Security.SecuritySafeCritical] // auto-generated public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) { if ((CallingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) throw new NotSupportedException(Environment.GetResourceString("NotSupported_CallToVarArg")); @@ -801,7 +755,6 @@ namespace System.Reflection.Emit return null; } - [System.Security.SecuritySafeCritical] // auto-generated public DynamicILInfo GetDynamicILInfo() { #pragma warning disable 618 @@ -814,7 +767,6 @@ namespace System.Reflection.Emit return GetDynamicILInfo(new DynamicScope()); } - [System.Security.SecurityCritical] // auto-generated internal DynamicILInfo GetDynamicILInfo(DynamicScope scope) { if (m_DynamicILInfo == null) @@ -831,7 +783,6 @@ namespace System.Reflection.Emit return GetILGenerator(64); } - [System.Security.SecuritySafeCritical] // auto-generated public ILGenerator GetILGenerator(int streamSize) { if (m_ilGenerator == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs index dfb0b15..53989ba 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs @@ -313,9 +313,6 @@ namespace System.Reflection.Emit { // Use this function if client decides to form the custom attribute blob themselves -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -398,7 +395,6 @@ namespace System.Reflection.Emit { // Constructs a EnumBuilder. // EnumBuilder can only be a top-level (not nested) enum type. - [System.Security.SecurityCritical] // auto-generated internal EnumBuilder( String name, // name of type Type underlyingType, // underlying type for an Enum diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs index 60289a1..b9ffaff 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs @@ -58,7 +58,6 @@ namespace System.Reflection.Emit { return m_evToken; } - [System.Security.SecurityCritical] // auto-generated private void SetMethodSemantics(MethodBuilder mdBuilder, MethodSemanticsAttributes semantics) { if (mdBuilder == null) @@ -75,25 +74,21 @@ namespace System.Reflection.Emit { mdBuilder.GetToken().Token); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetAddOnMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.AddOn); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetRemoveOnMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.RemoveOn); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetRaiseMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Fire); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddOtherMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Other); @@ -101,11 +96,6 @@ namespace System.Reflection.Emit { // Use this function if client decides to form the custom attribute blob themselves -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#else -[System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -125,7 +115,6 @@ namespace System.Reflection.Emit { } // Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs index 84449bd..965686c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs @@ -29,7 +29,6 @@ namespace System.Reflection.Emit #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { @@ -69,7 +68,6 @@ namespace System.Reflection.Emit #endregion #region Internal Members - [System.Security.SecurityCritical] // auto-generated internal void SetData(byte[] data, int size) { ModuleBuilder.SetFieldRVAContent(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), m_tkField.Token, data, size); @@ -181,11 +179,6 @@ namespace System.Reflection.Emit return m_tkField; } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif public void SetOffset(int iOffset) { m_typeBuilder.ThrowIfCreated(); @@ -193,7 +186,6 @@ namespace System.Reflection.Emit TypeBuilder.SetFieldLayoutOffset(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), GetToken().Token, iOffset); } - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")] public void SetMarshal(UnmanagedMarshal unmanagedMarshal) { @@ -208,7 +200,6 @@ namespace System.Reflection.Emit TypeBuilder.SetFieldMarshal(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), GetToken().Token, ubMarshal, ubMarshal.Length); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetConstant(Object defaultValue) { m_typeBuilder.ThrowIfCreated(); @@ -217,11 +208,6 @@ namespace System.Reflection.Emit } -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#else -[System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -240,7 +226,6 @@ namespace System.Reflection.Emit m_tkField.Token, module.GetConstructorToken(con).Token, binaryAttribute, false, false); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs index bcf70db..6987ea1 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs @@ -212,9 +212,6 @@ namespace System.Reflection.Emit #endregion #region Public Members - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { m_type.SetGenParamCustomAttribute(con, binaryAttribute); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs index 22f78df..396ffe8 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs @@ -209,20 +209,17 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private int GetMethodToken(MethodBase method, Type[] optionalParameterTypes, bool useMethodDef) { return ((ModuleBuilder)m_methodBuilder.Module).GetMethodTokenInternal(method, optionalParameterTypes, useMethodDef); } - [System.Security.SecurityCritical] // auto-generated internal virtual SignatureHelper GetMemberRefSignature(CallingConventions call, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes) { return GetMemberRefSignature(call, returnType, parameterTypes, optionalParameterTypes, 0); } - [System.Security.SecurityCritical] // auto-generated private SignatureHelper GetMemberRefSignature(CallingConventions call, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes, int cGenericParameters) { @@ -471,7 +468,6 @@ namespace System.Reflection.Emit PutInteger4(arg); } - [System.Security.SecuritySafeCritical] // auto-generated public virtual void Emit(OpCode opcode, MethodInfo meth) { if (meth == null) @@ -503,7 +499,6 @@ namespace System.Reflection.Emit } - [System.Security.SecuritySafeCritical] // auto-generated public virtual void EmitCalli(OpCode opcode, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes) { @@ -592,7 +587,6 @@ namespace System.Reflection.Emit PutInteger4(modBuilder.GetSignatureToken(sig).Token); } - [System.Security.SecuritySafeCritical] // auto-generated public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes) { if (methodInfo == null) @@ -665,7 +659,6 @@ namespace System.Reflection.Emit PutInteger4(tempVal); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public virtual void Emit(OpCode opcode, ConstructorInfo con) { @@ -709,7 +702,6 @@ namespace System.Reflection.Emit PutInteger4(tk); } - [System.Security.SecuritySafeCritical] // auto-generated public virtual void Emit(OpCode opcode, Type cls) { // Puts opcode onto the stream and then the metadata token represented @@ -749,7 +741,6 @@ namespace System.Reflection.Emit m_ILStream[m_length++] = (byte) (arg>>56); } - [System.Security.SecuritySafeCritical] // auto-generated unsafe public virtual void Emit(OpCode opcode, float arg) { EnsureCapacity(7); InternalEmit(opcode); @@ -760,7 +751,6 @@ namespace System.Reflection.Emit m_ILStream[m_length++] = (byte) (tempVal>>24); } - [System.Security.SecuritySafeCritical] // auto-generated unsafe public virtual void Emit(OpCode opcode, double arg) { EnsureCapacity(11); InternalEmit(opcode); @@ -1761,9 +1751,6 @@ namespace System.Reflection.Emit } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal void EmitScopeTree(ISymbolWriter symWriter) { int i; @@ -1873,9 +1860,6 @@ namespace System.Reflection.Emit } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal void EmitLineNumberInfo(ISymbolWriter symWriter) { for (int i = 0; i < m_DocumentCount; i++) @@ -1967,9 +1951,6 @@ namespace System.Reflection.Emit } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal void EmitLineNumberInfo(ISymbolWriter symWriter) { int[] iOffsetsTemp; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs index 00fdd00..425321c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs @@ -58,9 +58,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // Ctor //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal SymDocumentWriter(PunkSafeHandle pDocumentWriterSafeHandle) { m_pDocumentWriterSafeHandle = pDocumentWriterSafeHandle; @@ -72,9 +69,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // Returns the underlying ISymUnmanagedDocumentWriter* (as a safehandle.) //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal PunkSafeHandle GetUnmanaged() { return m_pDocumentWriterSafeHandle; @@ -97,9 +91,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // SetCheckSum() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] - #endif void ISymbolDocumentWriter.SetCheckSum(Guid algorithmId, byte [] checkSum) { int hr = m_vtable.SetCheckSum(m_pDocWriter, algorithmId, (uint)checkSum.Length, checkSum); @@ -109,7 +100,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] private delegate int DSetCheckSum(ISymUnmanagedDocumentWriter * pThis, Guid algorithmId, uint checkSumSize, [In] byte[] checkSum); //------------------------------------------------------------------------------ @@ -117,7 +107,6 @@ namespace System.Reflection.Emit // exactly. If a member is declared as an IntPtr rather than a delegate, it means // we don't call that particular member. //------------------------------------------------------------------------------ - [System.Security.SecurityCritical] [StructLayout(LayoutKind.Sequential)] private struct ISymUnmanagedDocumentWriterVTable { @@ -126,9 +115,6 @@ namespace System.Reflection.Emit internal IntPtr Release; internal IntPtr SetSource; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] - #endif internal DSetCheckSum SetCheckSum; } @@ -136,7 +122,6 @@ namespace System.Reflection.Emit // This layout must match the (start) of the unmanaged ISymUnmanagedDocumentWriter // COM object. //------------------------------------------------------------------------------ - [System.Security.SecurityCritical] [StructLayout(LayoutKind.Sequential)] private struct ISymUnmanagedDocumentWriter { @@ -146,19 +131,14 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // Stores underlying ISymUnmanagedDocumentWriter* pointer (wrapped in a safehandle.) //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif private PunkSafeHandle m_pDocumentWriterSafeHandle; - [SecurityCritical] private ISymUnmanagedDocumentWriter * m_pDocWriter; //------------------------------------------------------------------------------ // Stores the "managed vtable" (actually a structure full of delegates that // P/Invoke to the corresponding unmanaged COM methods.) //------------------------------------------------------------------------------ - [SecurityCritical] private ISymUnmanagedDocumentWriterVTable m_vtable; @@ -212,9 +192,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // DefineDocument() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif ISymbolDocumentWriter ISymbolWriter.DefineDocument(String url, Guid language, Guid languageVendor, @@ -237,9 +214,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // SetUserEntryPoint() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.SetUserEntryPoint(SymbolToken entryMethod) { int hr = m_vtable.SetUserEntryPoint(m_pWriter, entryMethod.GetToken()); @@ -252,9 +226,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // OpenMethod() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.OpenMethod(SymbolToken method) { int hr = m_vtable.OpenMethod(m_pWriter, method.GetToken()); @@ -267,9 +238,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // CloseMethod() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.CloseMethod() { int hr = m_vtable.CloseMethod(m_pWriter); @@ -282,9 +250,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // DefineSequencePoints() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.DefineSequencePoints(ISymbolDocumentWriter document, int[] offsets, int[] lines, @@ -344,9 +309,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // OpenScope() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif int ISymbolWriter.OpenScope(int startOffset) { int ret; @@ -361,9 +323,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // CloseScope() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.CloseScope(int endOffset) { int hr = m_vtable.CloseScope(m_pWriter, endOffset); @@ -388,9 +347,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // DefineLocalVariable() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.DefineLocalVariable(String name, FieldAttributes attributes, byte[] signature, @@ -476,9 +432,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // SetSymAttribute() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.SetSymAttribute(SymbolToken parent, String name, byte[] data) { int hr = m_vtable.SetSymAttribute(m_pWriter, parent.GetToken(), name, data.Length, data); @@ -515,9 +468,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // UsingNamespace() wrapper //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif void ISymbolWriter.UsingNamespace(String name) { int hr = m_vtable.UsingNamespace(m_pWriter, name); @@ -557,9 +507,6 @@ namespace System.Reflection.Emit // with the real ISymWrapper.dll, ISymWrapper performs *no* Release (or AddRef) on pointers // furnished through SetUnderlyingWriter. Lifetime management is entirely up to the caller. //------------------------------------------------------------------------------ - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal void InternalSetUnderlyingWriter(IntPtr ppUnderlyingWriter) { m_pWriter = *((ISymUnmanagedWriter**)ppUnderlyingWriter); @@ -569,7 +516,6 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // Define delegates for the unmanaged COM methods we invoke. //------------------------------------------------------------------------------ - [System.Security.SecurityCritical] private delegate int DInitialize(ISymUnmanagedWriter* pthis, IntPtr emitter, //IUnknown* [MarshalAs(UnmanagedType.LPWStr)] String filename, //WCHAR* @@ -577,7 +523,6 @@ namespace System.Reflection.Emit [MarshalAs(UnmanagedType.Bool)] bool fFullBuild ); - [System.Security.SecurityCritical] private delegate int DDefineDocument(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String url, [In] ref Guid language, @@ -586,14 +531,10 @@ namespace System.Reflection.Emit [Out] out PunkSafeHandle ppsymUnmanagedDocumentWriter ); - [System.Security.SecurityCritical] private delegate int DSetUserEntryPoint(ISymUnmanagedWriter* pthis, int entryMethod); - [System.Security.SecurityCritical] private delegate int DOpenMethod(ISymUnmanagedWriter* pthis, int entryMethod); - [System.Security.SecurityCritical] private delegate int DCloseMethod(ISymUnmanagedWriter* pthis); - [System.Security.SecurityCritical] private delegate int DDefineSequencePoints(ISymUnmanagedWriter* pthis, PunkSafeHandle document, int spCount, @@ -603,15 +544,11 @@ namespace System.Reflection.Emit [In] int[] endLines, [In] int[] endColumns); - [System.Security.SecurityCritical] private delegate int DOpenScope(ISymUnmanagedWriter* pthis, int startOffset, [Out] out int pretval); - [System.Security.SecurityCritical] private delegate int DCloseScope(ISymUnmanagedWriter* pthis, int endOffset); - [System.Security.SecurityCritical] private delegate int DSetScopeRange(ISymUnmanagedWriter* pthis, int scopeID, int startOffset, int endOffset); - [System.Security.SecurityCritical] private delegate int DDefineLocalVariable(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String name, int attributes, @@ -625,10 +562,8 @@ namespace System.Reflection.Emit int endOffset ); - [System.Security.SecurityCritical] private delegate int DClose(ISymUnmanagedWriter* pthis); - [System.Security.SecurityCritical] private delegate int DSetSymAttribute(ISymUnmanagedWriter* pthis, int parent, [MarshalAs(UnmanagedType.LPWStr)] String name, @@ -637,11 +572,8 @@ namespace System.Reflection.Emit ); - [System.Security.SecurityCritical] private delegate int DOpenNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String name); - [System.Security.SecurityCritical] private delegate int DCloseNamespace(ISymUnmanagedWriter* pthis); - [System.Security.SecurityCritical] private delegate int DUsingNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String name); @@ -658,77 +590,32 @@ namespace System.Reflection.Emit internal IntPtr AddRef; internal IntPtr Release; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DDefineDocument DefineDocument; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DSetUserEntryPoint SetUserEntryPoint; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DOpenMethod OpenMethod; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DCloseMethod CloseMethod; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DOpenScope OpenScope; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DCloseScope CloseScope; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DSetScopeRange SetScopeRange; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DDefineLocalVariable DefineLocalVariable; internal IntPtr DefineParameter; internal IntPtr DefineField; internal IntPtr DefineGlobalVariable; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DClose Close; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DSetSymAttribute SetSymAttribute; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DOpenNamespace OpenNamespace; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DCloseNamespace CloseNamespace; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DUsingNamespace UsingNamespace; internal IntPtr SetMethodSourceRange; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DInitialize Initialize; internal IntPtr GetDebugInfo; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal DDefineSequencePoints DefineSequencePoints; } @@ -749,7 +636,6 @@ namespace System.Reflection.Emit // As with the real ISymWrapper.dll, ISymWrapper performs *no* Release (or AddRef) on this pointer. // Managing lifetime is up to the caller (coreclr.dll). //------------------------------------------------------------------------------ - [SecurityCritical] private ISymUnmanagedWriter *m_pWriter; //------------------------------------------------------------------------------ @@ -778,20 +664,13 @@ namespace System.Reflection.Emit // // Had to make this a non-nested class since FCall's don't like to bind to nested classes. //-------------------------------------------------------------------------------------- - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif sealed class PunkSafeHandle : SafeHandle { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal PunkSafeHandle() : base((IntPtr)0, true) { } - [SecurityCritical] override protected bool ReleaseHandle() { m_Release(handle); @@ -800,7 +679,6 @@ namespace System.Reflection.Emit public override bool IsInvalid { - [SecurityCritical] get { return handle == ((IntPtr)0); } } @@ -810,9 +688,6 @@ namespace System.Reflection.Emit [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern IntPtr nGetDReleaseTarget(); // FCall gets us the native DRelease target (so we don't need named dllexport from coreclr.dll) - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif static PunkSafeHandle() { m_Release = (DRelease)(Marshal.GetDelegateForFunctionPointer(nGetDReleaseTarget(), typeof(DRelease))); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs index 3c45e50..226d71b 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs @@ -196,7 +196,6 @@ namespace System.Reflection.Emit m_module.CheckContext(types); } - [System.Security.SecurityCritical] // auto-generated internal void CreateMethodBodyHelper(ILGenerator il) { // Sets the IL of the method. An ILGenerator is passed as an argument and the method @@ -389,7 +388,6 @@ namespace System.Reflection.Emit return m_mdMethodFixups; } - [System.Security.SecurityCritical] // auto-generated internal SignatureHelper GetMethodSignature() { if (m_parameterTypes == null) @@ -480,7 +478,6 @@ namespace System.Reflection.Emit #endregion #region Object Overrides - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(Object obj) { if (!(obj is MethodBuilder)) { return false; @@ -505,7 +502,6 @@ namespace System.Reflection.Emit return this.m_strName.GetHashCode(); } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { StringBuilder sb = new StringBuilder(1000); @@ -733,7 +729,6 @@ namespace System.Reflection.Emit #endregion #region Public Members - [System.Security.SecuritySafeCritical] // auto-generated public MethodToken GetToken() { // We used to always "tokenize" a MethodBuilder when it is constructed. After change list 709498 @@ -785,7 +780,6 @@ namespace System.Reflection.Emit return currentToken; } - [System.Security.SecurityCritical] // auto-generated private MethodToken GetTokenNoLock() { Contract.Assert(m_tkMethod.Token == 0, "m_tkMethod should not have been initialized"); @@ -853,7 +847,6 @@ namespace System.Reflection.Emit } - [System.Security.SecuritySafeCritical] // auto-generated public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, String strParamName) { if (position < 0) @@ -870,7 +863,6 @@ namespace System.Reflection.Emit return new ParameterBuilder(this, position, attributes, strParamName); } - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")] public void SetMarshal(UnmanagedMarshal unmanagedMarshal) { @@ -927,9 +919,6 @@ namespace System.Reflection.Emit m_symCustomAttrs.Add(new SymCustomAttr(name, data)); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void SetMethodBody(byte[] il, int maxStack, byte[] localSignature, IEnumerable exceptionHandlers, IEnumerable tokenFixups) { if (il == null) @@ -1031,9 +1020,6 @@ namespace System.Reflection.Emit /// /// Obsolete. /// - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public void CreateMethodBody(byte[] il, int count) { ThrowIfGeneric(); @@ -1070,7 +1056,6 @@ namespace System.Reflection.Emit m_bIsBaked = true; } - [System.Security.SecuritySafeCritical] // auto-generated public void SetImplementationFlags(MethodImplAttributes attributes) { ThrowIfGeneric (); @@ -1133,7 +1118,6 @@ namespace System.Reflection.Emit public String Signature { - [System.Security.SecuritySafeCritical] // auto-generated get { return GetMethodSignature().ToString(); @@ -1141,11 +1125,6 @@ namespace System.Reflection.Emit } -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#else -[System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -1166,7 +1145,6 @@ namespace System.Reflection.Emit ParseCA(con, binaryAttribute); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) @@ -1341,9 +1319,6 @@ namespace System.Reflection.Emit checked { m_iNameSpaceCount++; } } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif internal virtual void EmitLocalSymInfo(ISymbolWriter symWriter) { int i; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs index 11d2668..8659c46 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -157,39 +157,32 @@ namespace System.Reflection.Emit } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetTypeRef(RuntimeModule module, String strFullName, RuntimeModule refedModule, String strRefedModuleFileName, int tkResolution); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetMemberRef(RuntimeModule module, RuntimeModule refedModule, int tr, int defToken); - [System.Security.SecurityCritical] // auto-generated private int GetMemberRef(Module refedModule, int tr, int defToken) { return GetMemberRef(GetNativeHandle(), GetRuntimeModuleFromModule(refedModule).GetNativeHandle(), tr, defToken); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetMemberRefFromSignature(RuntimeModule module, int tr, String methodName, byte[] signature, int length); - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefFromSignature(int tr, String methodName, byte[] signature, int length) { return GetMemberRefFromSignature(GetNativeHandle(), tr, methodName, signature, length); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetMemberRefOfMethodInfo(RuntimeModule module, int tr, IRuntimeMethodInfo method); - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefOfMethodInfo(int tr, RuntimeMethodInfo method) { Contract.Assert(method != null); @@ -205,7 +198,6 @@ namespace System.Reflection.Emit return GetMemberRefOfMethodInfo(GetNativeHandle(), tr, method); } - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefOfMethodInfo(int tr, RuntimeConstructorInfo method) { Contract.Assert(method != null); @@ -221,12 +213,10 @@ namespace System.Reflection.Emit return GetMemberRefOfMethodInfo(GetNativeHandle(), tr, method); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetMemberRefOfFieldInfo(RuntimeModule module, int tkType, RuntimeTypeHandle declaringType, int tkField); - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefOfFieldInfo(int tkType, RuntimeTypeHandle declaringType, RuntimeFieldInfo runtimeField) { Contract.Assert(runtimeField != null); @@ -243,38 +233,31 @@ namespace System.Reflection.Emit return GetMemberRefOfFieldInfo(GetNativeHandle(), tkType, declaringType, runtimeField.MetadataToken); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetTokenFromTypeSpec(RuntimeModule pModule, byte[] signature, int length); - [System.Security.SecurityCritical] // auto-generated private int GetTokenFromTypeSpec(byte[] signature, int length) { return GetTokenFromTypeSpec(GetNativeHandle(), signature, length); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetArrayMethodToken(RuntimeModule module, int tkTypeSpec, String methodName, byte[] signature, int sigLength); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetStringConstant(RuntimeModule module, String str, int length); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void PreSavePEFile(RuntimeModule module, int portableExecutableKind, int imageFileMachine); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void SavePEFile(RuntimeModule module, String fileName, int entryPoint, int isExe, bool isManifestFile); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void AddResource( @@ -282,17 +265,14 @@ namespace System.Reflection.Emit byte[] resBytes, int resByteCount, int tkFile, int attribute, int portableExecutableKind, int imageFileMachine); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void SetModuleName(RuntimeModule module, String strModuleName); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static void SetFieldRVAContent(RuntimeModule module, int fdToken, byte[] data, int length); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void DefineNativeResourceFile(RuntimeModule module, @@ -300,7 +280,6 @@ namespace System.Reflection.Emit int portableExecutableKind, int ImageFileMachine); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void DefineNativeResourceBytes(RuntimeModule module, @@ -308,7 +287,6 @@ namespace System.Reflection.Emit int portableExecutableKind, int imageFileMachine); - [System.Security.SecurityCritical] // auto-generated internal void DefineNativeResource(PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) { string strResourceFileName = m_moduleData.m_strResourceFileName; @@ -366,7 +344,6 @@ namespace System.Reflection.Emit #if !FEATURE_CORECLR // This is a helper called by AssemblyBuilder save to presave information for the persistable modules. // no need to lock here because we have already taken the lock in AssemblyBuilder.Save - [System.Security.SecurityCritical] // auto-generated internal void PreSave(String fileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) { @@ -407,7 +384,6 @@ namespace System.Reflection.Emit } // no need to lock here because we have already taken the lock in AssemblyBuilder.Save - [System.Security.SecurityCritical] // auto-generated internal void Save(String fileName, bool isAssemblyFile, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) { @@ -449,7 +425,6 @@ namespace System.Reflection.Emit } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated private int GetTypeRefNested(Type type, Module refedModule, String strRefedModuleFileName) { // This function will generate correct TypeRef token for top level type and nested type. @@ -481,7 +456,6 @@ namespace System.Reflection.Emit return GetTypeRef(GetNativeHandle(), typeName, GetRuntimeModuleFromModule(refedModule).GetNativeHandle(), strRefedModuleFileName, tkResolution); } - [System.Security.SecurityCritical] // auto-generated internal MethodToken InternalGetConstructorToken(ConstructorInfo con, bool usingRef) { // Helper to get constructor token. If usingRef is true, we will never use the def token @@ -556,7 +530,6 @@ namespace System.Reflection.Emit return new MethodToken( mr ); } - [System.Security.SecurityCritical] // auto-generated internal void Init(String strModuleName, String strFileName, int tkFile) { m_moduleData = new ModuleBuilderData(this, strModuleName, strFileName, tkFile); @@ -565,7 +538,6 @@ namespace System.Reflection.Emit // This is a method for changing module and file name of the manifest module (created by default for // each assembly). - [System.Security.SecurityCritical] // auto-generated internal void ModifyModuleName(string name) { // Reset the names in the managed ModuleBuilderData @@ -622,7 +594,6 @@ namespace System.Reflection.Emit return m as RuntimeModule; } - [System.Security.SecurityCritical] // auto-generated private int GetMemberRefToken(MethodBase method, IEnumerable optionalParameterTypes) { Type[] parameterTypes; @@ -728,7 +699,6 @@ namespace System.Reflection.Emit return GetMemberRefFromSignature(tkParent, method.Name, sigBytes, sigLength); } - [System.Security.SecurityCritical] // auto-generated internal SignatureHelper GetMemberRefSignature(CallingConventions call, Type returnType, Type[] parameterTypes, IEnumerable optionalParameterTypes, int cGenericParameters) { @@ -949,11 +919,6 @@ namespace System.Reflection.Emit public override String FullyQualifiedName { -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif get { String fullyQualifiedName = m_moduleData.m_strFileName; @@ -1090,7 +1055,6 @@ namespace System.Reflection.Emit #region Public Members #region Define Type - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineType(String name) { Contract.Ensures(Contract.Result() != null); @@ -1101,7 +1065,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineType(String name, TypeAttributes attr) { Contract.Ensures(Contract.Result() != null); @@ -1112,7 +1075,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineType(String name, TypeAttributes attr, Type parent) { Contract.Ensures(Contract.Result() != null); @@ -1126,11 +1088,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineType(String name, TypeAttributes attr, Type parent, int typesize) { Contract.Ensures(Contract.Result() != null); @@ -1141,11 +1098,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineType(String name, TypeAttributes attr, Type parent, PackingSize packingSize, int typesize) { Contract.Ensures(Contract.Result() != null); @@ -1156,7 +1108,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public TypeBuilder DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces) { @@ -1168,7 +1119,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private TypeBuilder DefineTypeNoLock(String name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packingSize, int typesize) { Contract.Ensures(Contract.Result() != null); @@ -1176,11 +1126,6 @@ namespace System.Reflection.Emit return new TypeBuilder(name, attr, parent, interfaces, this, packingSize, typesize, null); ; } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineType(String name, TypeAttributes attr, Type parent, PackingSize packsize) { Contract.Ensures(Contract.Result() != null); @@ -1191,7 +1136,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private TypeBuilder DefineTypeNoLock(String name, TypeAttributes attr, Type parent, PackingSize packsize) { Contract.Ensures(Contract.Result() != null); @@ -1205,7 +1149,6 @@ namespace System.Reflection.Emit // This API can only be used to construct a top-level (not nested) enum type. // Nested enum types can be defined manually using ModuleBuilder.DefineType. - [System.Security.SecuritySafeCritical] // auto-generated public EnumBuilder DefineEnum(String name, TypeAttributes visibility, Type underlyingType) { Contract.Ensures(Contract.Result() != null); @@ -1226,7 +1169,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private EnumBuilder DefineEnumNoLock(String name, TypeAttributes visibility, Type underlyingType) { Contract.Ensures(Contract.Result() != null); @@ -1357,7 +1299,6 @@ namespace System.Reflection.Emit Buffer.BlockCopy(resource, 0, m_moduleData.m_resourceBytes, 0, resource.Length); } - [System.Security.SecuritySafeCritical] public void DefineUnmanagedResource(String resourceFileName) { lock(SyncRoot) @@ -1366,7 +1307,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated internal void DefineUnmanagedResourceFileInternalNoLock(String resourceFileName) { if (resourceFileName == null) @@ -1457,9 +1397,6 @@ namespace System.Reflection.Emit parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public MethodBuilder DefinePInvokeMethod(String name, String dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) @@ -1469,9 +1406,6 @@ namespace System.Reflection.Emit return DefinePInvokeMethod(name, dllName, name, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) @@ -1485,9 +1419,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private MethodBuilder DefinePInvokeMethodNoLock(String name, String dllName, String entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) @@ -1530,9 +1461,6 @@ namespace System.Reflection.Emit #region Define Data -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public FieldBuilder DefineInitializedData(String name, byte[] data, FieldAttributes attributes) { // This method will define an initialized Data in .sdata. @@ -1546,9 +1474,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private FieldBuilder DefineInitializedDataNoLock(String name, byte[] data, FieldAttributes attributes) { // This method will define an initialized Data in .sdata. @@ -1565,9 +1490,6 @@ namespace System.Reflection.Emit return m_moduleData.m_globalTypeBuilder.DefineInitializedData(name, data, attributes); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif public FieldBuilder DefineUninitializedData(String name, int size, FieldAttributes attributes) { Contract.Ensures(Contract.Result() != null); @@ -1578,9 +1500,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private FieldBuilder DefineUninitializedDataNoLock(String name, int size, FieldAttributes attributes) { // This method will define an uninitialized Data in .sdata. @@ -1605,13 +1524,11 @@ namespace System.Reflection.Emit // 1. GetTypeToken // 2. ldtoken (see ILGenerator) // For all other occasions we should return the generic type instantiated on its formal parameters. - [System.Security.SecurityCritical] // auto-generated internal TypeToken GetTypeTokenInternal(Type type) { return GetTypeTokenInternal(type, false); } - [System.Security.SecurityCritical] // auto-generated private TypeToken GetTypeTokenInternal(Type type, bool getGenericDefinition) { lock(SyncRoot) @@ -1620,13 +1537,11 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated public TypeToken GetTypeToken(Type type) { return GetTypeTokenInternal(type, true); } - [System.Security.SecurityCritical] // auto-generated private TypeToken GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition) { if (type == null) @@ -1735,7 +1650,6 @@ namespace System.Reflection.Emit return GetTypeToken(InternalModule.GetType(name, false, true)); } - [System.Security.SecuritySafeCritical] // auto-generated public MethodToken GetMethodToken(MethodInfo method) { lock(SyncRoot) @@ -1744,7 +1658,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated internal MethodToken GetMethodTokenInternal(MethodInfo method) { lock(SyncRoot) @@ -1757,7 +1670,6 @@ namespace System.Reflection.Emit // 1. GetMethodToken // 2. ldtoken (see ILGenerator) // For all other occasions we should return the method on the generic type instantiated on the formal parameters. - [System.Security.SecurityCritical] // auto-generated private MethodToken GetMethodTokenNoLock(MethodInfo method, bool getGenericTypeDefinition) { // Return a MemberRef token if MethodInfo is not defined in this module. Or @@ -1867,7 +1779,6 @@ namespace System.Reflection.Emit return new MethodToken(mr); } - [System.Security.SecuritySafeCritical] // auto-generated public MethodToken GetConstructorToken(ConstructorInfo constructor, IEnumerable optionalParameterTypes) { if (constructor == null) @@ -1882,7 +1793,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated public MethodToken GetMethodToken(MethodInfo method, IEnumerable optionalParameterTypes) { if (method == null) @@ -1904,7 +1814,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated internal int GetMethodTokenInternal(MethodBase method, IEnumerable optionalParameterTypes, bool useMethodDef) { int tk = 0; @@ -1971,7 +1880,6 @@ namespace System.Reflection.Emit return tk; } - [System.Security.SecuritySafeCritical] // auto-generated public MethodToken GetArrayMethodToken(Type arrayClass, String methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { @@ -1981,7 +1889,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private MethodToken GetArrayMethodTokenNoLock(Type arrayClass, String methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { @@ -2017,7 +1924,6 @@ namespace System.Reflection.Emit typeSpec.Token, methodName, sigBytes, length)); } - [System.Security.SecuritySafeCritical] // auto-generated public MethodInfo GetArrayMethod(Type arrayClass, String methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { @@ -2034,7 +1940,6 @@ namespace System.Reflection.Emit return new SymbolMethod(this, token, arrayClass, methodName, callingConvention, returnType, parameterTypes); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public MethodToken GetConstructorToken(ConstructorInfo con) { @@ -2042,7 +1947,6 @@ namespace System.Reflection.Emit return InternalGetConstructorToken(con, false); } - [System.Security.SecuritySafeCritical] // auto-generated public FieldToken GetFieldToken(FieldInfo field) { lock(SyncRoot) @@ -2051,7 +1955,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private FieldToken GetFieldTokenNoLock(FieldInfo field) { if (field == null) { @@ -2140,7 +2043,6 @@ namespace System.Reflection.Emit return new FieldToken(mr, field.GetType()); } - [System.Security.SecuritySafeCritical] // auto-generated public StringToken GetStringConstant(String str) { if (str == null) @@ -2154,7 +2056,6 @@ namespace System.Reflection.Emit return new StringToken(GetStringConstant(GetNativeHandle(), str, str.Length)); } - [System.Security.SecuritySafeCritical] // auto-generated public SignatureToken GetSignatureToken(SignatureHelper sigHelper) { // Define signature token given a signature helper. This will define a metadata @@ -2173,7 +2074,6 @@ namespace System.Reflection.Emit sigBytes = sigHelper.InternalGetSignature(out sigLength); return new SignatureToken(TypeBuilder.GetTokenFromSig(GetNativeHandle(), sigBytes, sigLength), this); } - [System.Security.SecuritySafeCritical] // auto-generated public SignatureToken GetSignatureToken(byte[] sigBytes, int sigLength) { if (sigBytes == null) @@ -2190,11 +2090,6 @@ namespace System.Reflection.Emit #region Other -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -2212,7 +2107,6 @@ namespace System.Reflection.Emit false, false); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) @@ -2258,9 +2152,6 @@ namespace System.Reflection.Emit return m_iSymWriter; } -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] -#endif public ISymbolDocumentWriter DefineDocument(String url, Guid language, Guid languageVendor, Guid documentType) { // url cannot be null but can be an empty string @@ -2274,9 +2165,6 @@ namespace System.Reflection.Emit } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif private ISymbolDocumentWriter DefineDocumentNoLock(String url, Guid language, Guid languageVendor, Guid documentType) { if (m_iSymWriter == null) @@ -2288,11 +2176,6 @@ namespace System.Reflection.Emit return m_iSymWriter.DefineDocument(url, language, languageVendor, documentType); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public void SetUserEntryPoint(MethodInfo entryPoint) { lock(SyncRoot) @@ -2301,7 +2184,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecurityCritical] // auto-generated private void SetUserEntryPointNoLock(MethodInfo entryPoint) { // Set the user entry point. Compiler may generate startup stub before calling user main. diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs index 2bec04a..9ab1f2c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs @@ -21,7 +21,6 @@ namespace System.Reflection.Emit [Serializable] internal class ModuleBuilderData { - [System.Security.SecurityCritical] // auto-generated internal ModuleBuilderData(ModuleBuilder module, String strModuleName, String strFileName, int tkFile) { m_globalTypeBuilder = new TypeBuilder(module); @@ -32,7 +31,6 @@ namespace System.Reflection.Emit } // Initialize module and file names. - [System.Security.SecurityCritical] // auto-generated private void InitNames(String strModuleName, String strFileName) { m_strModuleName = strModuleName; @@ -55,7 +53,6 @@ namespace System.Reflection.Emit // This is a method for changing module and file name of the manifest module (created by default for // each assembly). - [System.Security.SecurityCritical] // auto-generated internal virtual void ModifyModuleName(String strModuleName) { Contract.Assert(m_strModuleName == AssemblyBuilder.MANIFEST_MODULE_NAME, "Changing names for non-manifest module"); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs index 615cbb8..88d7a5c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs @@ -25,7 +25,6 @@ namespace System.Reflection.Emit { public class ParameterBuilder : _ParameterBuilder { // set ParamMarshal - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")] public virtual void SetMarshal(UnmanagedMarshal unmanagedMarshal) { @@ -44,7 +43,6 @@ namespace System.Reflection.Emit { } // Set the default value of the parameter - [System.Security.SecuritySafeCritical] // auto-generated public virtual void SetConstant(Object defaultValue) { TypeBuilder.SetConstantValue( @@ -56,7 +54,6 @@ namespace System.Reflection.Emit { // Use this function if client decides to form the custom attribute blob themselves - [System.Security.SecuritySafeCritical] [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -75,7 +72,6 @@ namespace System.Reflection.Emit { } // Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) @@ -92,7 +88,6 @@ namespace System.Reflection.Emit { private ParameterBuilder() {} - [System.Security.SecurityCritical] // auto-generated internal ParameterBuilder( MethodBuilder methodBuilder, int sequence, diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs index 4b8e40f..26ed450 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs @@ -67,7 +67,6 @@ namespace System.Reflection.Emit { //************************************************ // Set the default value of the Property //************************************************ - [System.Security.SecuritySafeCritical] // auto-generated public void SetConstant(Object defaultValue) { m_containingType.ThrowIfCreated(); @@ -103,7 +102,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private void SetMethodSemantics(MethodBuilder mdBuilder, MethodSemanticsAttributes semantics) { if (mdBuilder == null) @@ -119,21 +117,18 @@ namespace System.Reflection.Emit { mdBuilder.GetToken().Token); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetGetMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Getter); m_getMethod = mdBuilder; } - [System.Security.SecuritySafeCritical] // auto-generated public void SetSetMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Setter); m_setMethod = mdBuilder; } - [System.Security.SecuritySafeCritical] // auto-generated public void AddOtherMethod(MethodBuilder mdBuilder) { SetMethodSemantics(mdBuilder, MethodSemanticsAttributes.Other); @@ -141,11 +136,6 @@ namespace System.Reflection.Emit { // Use this function if client decides to form the custom attribute blob themselves -#if FEATURE_CORECLR -[System.Security.SecurityCritical] // auto-generated -#else -[System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -164,7 +154,6 @@ namespace System.Reflection.Emit { } // Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs index b2a3493..f5a1ec3 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs @@ -25,19 +25,16 @@ namespace System.Reflection.Emit #endregion #region Static Members - [System.Security.SecuritySafeCritical] // auto-generated public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes) { return GetMethodSigHelper(mod, CallingConventions.Standard, returnType, null, null, parameterTypes, null, null); } - [System.Security.SecurityCritical] // auto-generated internal static SignatureHelper GetMethodSigHelper(Module mod, CallingConventions callingConvention, Type returnType, int cGenericParam) { return GetMethodSigHelper(mod, callingConvention, cGenericParam, returnType, null, null, null, null, null); } - [System.Security.SecuritySafeCritical] // auto-generated public static SignatureHelper GetMethodSigHelper(Module mod, CallingConventions callingConvention, Type returnType) { return GetMethodSigHelper(mod, callingConvention, returnType, null, null, null, null, null); @@ -52,7 +49,6 @@ namespace System.Reflection.Emit return sigHelp; } - [System.Security.SecurityCritical] // auto-generated internal static SignatureHelper GetMethodSigHelper( Module scope, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, @@ -62,7 +58,6 @@ namespace System.Reflection.Emit optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); } - [System.Security.SecurityCritical] // auto-generated internal static SignatureHelper GetMethodSigHelper( Module scope, CallingConventions callingConvention, int cGenericParam, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, @@ -96,7 +91,6 @@ namespace System.Reflection.Emit return sigHelp; } - [System.Security.SecuritySafeCritical] // auto-generated public static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType) { SignatureHelper sigHelp; @@ -168,7 +162,6 @@ namespace System.Reflection.Emit return GetPropertySigHelper(mod, (CallingConventions)0, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); } - [System.Security.SecuritySafeCritical] // auto-generated public static SignatureHelper GetPropertySigHelper(Module mod, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers) @@ -192,7 +185,6 @@ namespace System.Reflection.Emit return sigHelp; } - [System.Security.SecurityCritical] // auto-generated internal static SignatureHelper GetTypeSigToken(Module mod, Type type) { if (mod == null) @@ -221,7 +213,6 @@ namespace System.Reflection.Emit Init(mod, callingConvention); } - [System.Security.SecurityCritical] // auto-generated private SignatureHelper(Module mod, MdSigCallingConvention callingConvention, int cGenericParameters, Type returnType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers) { @@ -234,14 +225,12 @@ namespace System.Reflection.Emit AddOneArgTypeHelper(returnType, requiredCustomModifiers, optionalCustomModifiers); } - [System.Security.SecurityCritical] // auto-generated private SignatureHelper(Module mod, MdSigCallingConvention callingConvention, Type returnType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers) : this(mod, callingConvention, 0, returnType, requiredCustomModifiers, optionalCustomModifiers) { } - [System.Security.SecurityCritical] // auto-generated private SignatureHelper(Module mod, Type type) { Init(mod); @@ -290,7 +279,6 @@ namespace System.Reflection.Emit #endregion #region Private Members - [System.Security.SecurityCritical] // auto-generated private void AddOneArgTypeHelper(Type argument, bool pinned) { if (pinned) @@ -299,7 +287,6 @@ namespace System.Reflection.Emit AddOneArgTypeHelper(argument); } - [System.Security.SecurityCritical] // auto-generated private void AddOneArgTypeHelper(Type clsArgument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers) { // This function will not increase the argument count. It only fills in bytes @@ -357,9 +344,7 @@ namespace System.Reflection.Emit AddOneArgTypeHelper(clsArgument); } - [System.Security.SecurityCritical] // auto-generated private void AddOneArgTypeHelper(Type clsArgument) { AddOneArgTypeHelperWorker(clsArgument, false); } - [System.Security.SecurityCritical] // auto-generated private void AddOneArgTypeHelperWorker(Type clsArgument, bool lastWasGenericInst) { if (clsArgument.IsGenericParameter) @@ -613,7 +598,6 @@ namespace System.Reflection.Emit AddToken(clsToken.Token); } - [System.Security.SecurityCritical] // auto-generated private unsafe void InternalAddRuntimeType(Type type) { // Add a runtime type into the signature. @@ -822,7 +806,6 @@ namespace System.Reflection.Emit AddArgument(clsArgument, null, null); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddArgument(Type argument, bool pinned) { if (argument == null) @@ -851,7 +834,6 @@ namespace System.Reflection.Emit } } - [System.Security.SecuritySafeCritical] // auto-generated public void AddArgument(Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers) { if (m_sigDone) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs index 62780f4..6b47770 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs @@ -26,7 +26,6 @@ namespace System.Reflection.Emit #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal SymbolMethod(ModuleBuilder mod, MethodToken token, Type arrayClass, String methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs index cee2db4..3a4b359 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs @@ -75,7 +75,6 @@ namespace System.Reflection.Emit { m_customBuilder = customBuilder; } - [System.Security.SecurityCritical] // auto-generated public void Bake(ModuleBuilder module, int token) { if (m_customBuilder == null) @@ -174,36 +173,30 @@ namespace System.Reflection.Emit { #endregion #region Private Static FCalls - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void SetParentType(RuntimeModule module, int tdTypeDef, int tkParent); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void AddInterfaceImpl(RuntimeModule module, int tdTypeDef, int tkInterface); #endregion #region Internal Static FCalls - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int DefineMethod(RuntimeModule module, int tkParent, String name, byte[] signature, int sigLength, MethodAttributes attributes); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int DefineMethodSpec(RuntimeModule module, int tkParent, byte[] signature, int sigLength); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int DefineField(RuntimeModule module, int tkParent, String name, byte[] signature, int sigLength, FieldAttributes attributes); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void SetMethodIL(RuntimeModule module, int tk, bool isInitLocals, @@ -213,13 +206,11 @@ namespace System.Reflection.Emit { ExceptionHandler[] exceptions, int numExceptions, int [] tokenFixups, int numTokenFixups); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void DefineCustomAttribute(RuntimeModule module, int tkAssociate, int tkConstructor, byte[] attr, int attrLength, bool toDisk, bool updateCompilerFlags); - [System.Security.SecurityCritical] // auto-generated internal static void DefineCustomAttribute(ModuleBuilder module, int tkAssociate, int tkConstructor, byte[] attr, bool toDisk, bool updateCompilerFlags) { @@ -235,65 +226,53 @@ namespace System.Reflection.Emit { localAttr, (localAttr != null) ? localAttr.Length : 0, toDisk, updateCompilerFlags); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void SetPInvokeData(RuntimeModule module, String DllName, String name, int token, int linkFlags); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int DefineProperty(RuntimeModule module, int tkParent, String name, PropertyAttributes attributes, byte[] signature, int sigLength); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int DefineEvent(RuntimeModule module, int tkParent, String name, EventAttributes attributes, int tkEventType); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void DefineMethodSemantics(RuntimeModule module, int tkAssociation, MethodSemanticsAttributes semantics, int tkMethod); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void DefineMethodImpl(RuntimeModule module, int tkType, int tkBody, int tkDecl); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void SetMethodImpl(RuntimeModule module, int tkMethod, MethodImplAttributes MethodImplAttributes); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int SetParamInfo(RuntimeModule module, int tkMethod, int iSequence, ParameterAttributes iParamAttributes, String strParamName); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern int GetTokenFromSig(RuntimeModule module, byte[] signature, int sigLength); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void SetFieldLayoutOffset(RuntimeModule module, int fdToken, int iOffset); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void SetClassLayout(RuntimeModule module, int tk, PackingSize iPackingSize, int iTypeSize); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void SetFieldMarshal(RuntimeModule module, int tk, byte[] ubMarshal, int ubSize); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern unsafe void SetConstantValue(RuntimeModule module, int tk, int corType, void* pValue); @@ -374,7 +353,6 @@ namespace System.Reflection.Emit { return false; } - [System.Security.SecurityCritical] // auto-generated internal static unsafe void SetConstantValue(ModuleBuilder module, int tk, Type destType, Object value) { // This is a helper function that is used by ParameterBuilder, PropertyBuilder, @@ -569,7 +547,6 @@ namespace System.Reflection.Emit { m_typeInterfaces = new List(); } - [System.Security.SecurityCritical] // auto-generated internal TypeBuilder( String name, TypeAttributes attr, @@ -583,7 +560,6 @@ namespace System.Reflection.Emit { Init(name, attr, parent, interfaces, module, iPackingSize, iTypeSize, enclosingType); } - [System.Security.SecurityCritical] // auto-generated private void Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, PackingSize iPackingSize, int iTypeSize, TypeBuilder enclosingType) { @@ -703,7 +679,6 @@ namespace System.Reflection.Emit { #endregion #region Private Members - [System.Security.SecurityCritical] // auto-generated private MethodBuilder DefinePInvokeMethodHelper( String name, String dllName, String importName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, @@ -726,7 +701,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private MethodBuilder DefinePInvokeMethodHelperNoLock( String name, String dllName, String importName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, @@ -824,7 +798,6 @@ namespace System.Reflection.Emit { return method; } - [System.Security.SecurityCritical] // auto-generated private FieldBuilder DefineDataHelper(String name, byte[] data, int size, FieldAttributes attributes) { String strValueClassName; @@ -909,19 +882,16 @@ namespace System.Reflection.Emit { #endregion #region FCalls - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int DefineType(RuntimeModule module, String fullname, int tkParent, TypeAttributes attributes, int tkEnclosingType, int[] interfaceTokens); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int DefineGenericParam(RuntimeModule module, String name, int tkParent, GenericParameterAttributes attributes, int position, int[] constraints); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void TermCreateClass(RuntimeModule module, int tk, ObjectHandleOnStack type); @@ -1484,7 +1454,6 @@ namespace System.Reflection.Emit { #endregion #region ICustomAttributeProvider Implementation - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(bool inherit) { if (!IsCreated()) @@ -1494,7 +1463,6 @@ namespace System.Reflection.Emit { return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, typeof(object) as RuntimeType, inherit); } - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { if (!IsCreated()) @@ -1512,7 +1480,6 @@ namespace System.Reflection.Emit { return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, attributeRuntimeType, inherit); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (!IsCreated()) @@ -1594,7 +1561,6 @@ namespace System.Reflection.Emit { #endregion #region Define Method - [System.Security.SecuritySafeCritical] // auto-generated public void DefineMethodOverride(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) { lock(SyncRoot) @@ -1603,7 +1569,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private void DefineMethodOverrideNoLock(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) { if (methodInfoBody == null) @@ -1730,7 +1695,6 @@ namespace System.Reflection.Emit { #endregion #region Define Constructor - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public ConstructorBuilder DefineTypeInitializer() { @@ -1740,7 +1704,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private ConstructorBuilder DefineTypeInitializerNoLock() { ThrowIfCreated(); @@ -1828,7 +1791,6 @@ namespace System.Reflection.Emit { return DefineConstructor(attributes, callingConvention, parameterTypes, null, null); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public ConstructorBuilder DefineConstructor(MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers) @@ -1844,7 +1806,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private ConstructorBuilder DefineConstructorNoLock(MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers) { @@ -1879,11 +1840,6 @@ namespace System.Reflection.Emit { #endregion #region Define PInvoke -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public MethodBuilder DefinePInvokeMethod(String name, String dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) @@ -1894,11 +1850,6 @@ namespace System.Reflection.Emit { return method; } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) @@ -1909,11 +1860,6 @@ namespace System.Reflection.Emit { return method; } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, @@ -1929,7 +1875,6 @@ namespace System.Reflection.Emit { #endregion #region Define Nested Type - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineNestedType(String name) { lock(SyncRoot) @@ -1938,7 +1883,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public TypeBuilder DefineNestedType(String name, TypeAttributes attr, Type parent, Type[] interfaces) { @@ -1952,7 +1896,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineNestedType(String name, TypeAttributes attr, Type parent) { lock(SyncRoot) @@ -1961,7 +1904,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecuritySafeCritical] // auto-generated public TypeBuilder DefineNestedType(String name, TypeAttributes attr) { lock(SyncRoot) @@ -1970,11 +1912,6 @@ namespace System.Reflection.Emit { } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineNestedType(String name, TypeAttributes attr, Type parent, int typeSize) { lock(SyncRoot) @@ -1983,11 +1920,6 @@ namespace System.Reflection.Emit { } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineNestedType(String name, TypeAttributes attr, Type parent, PackingSize packSize) { lock(SyncRoot) @@ -1996,11 +1928,6 @@ namespace System.Reflection.Emit { } } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public TypeBuilder DefineNestedType(String name, TypeAttributes attr, Type parent, PackingSize packSize, int typeSize) { lock (SyncRoot) @@ -2009,7 +1936,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private TypeBuilder DefineNestedTypeNoLock(String name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packSize, int typeSize) { return new TypeBuilder(name, attr, parent, interfaces, m_module, packSize, typeSize, this); @@ -2023,7 +1949,6 @@ namespace System.Reflection.Emit { return DefineField(fieldName, type, null, null, attributes); } - [System.Security.SecuritySafeCritical] // auto-generated public FieldBuilder DefineField(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { @@ -2033,7 +1958,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private FieldBuilder DefineFieldNoLock(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { @@ -2053,11 +1977,6 @@ namespace System.Reflection.Emit { return new FieldBuilder(this, fieldName, type, requiredCustomModifiers, optionalCustomModifiers, attributes); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public FieldBuilder DefineInitializedData(String name, byte[] data, FieldAttributes attributes) { lock(SyncRoot) @@ -2066,7 +1985,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private FieldBuilder DefineInitializedDataNoLock(String name, byte[] data, FieldAttributes attributes) { if (data == null) @@ -2080,11 +1998,6 @@ namespace System.Reflection.Emit { return DefineDataHelper(name, data, data.Length, attributes); } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif public FieldBuilder DefineUninitializedData(String name, int size, FieldAttributes attributes) { lock(SyncRoot) @@ -2093,7 +2006,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private FieldBuilder DefineUninitializedDataNoLock(String name, int size, FieldAttributes attributes) { // This method will define an uninitialized Data in .sdata. @@ -2126,7 +2038,6 @@ namespace System.Reflection.Emit { parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers); } - [System.Security.SecuritySafeCritical] // auto-generated public PropertyBuilder DefineProperty(String name, PropertyAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers) @@ -2138,7 +2049,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private PropertyBuilder DefinePropertyNoLock(String name, PropertyAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers) @@ -2188,7 +2098,6 @@ namespace System.Reflection.Emit { this); } - [System.Security.SecuritySafeCritical] // auto-generated public EventBuilder DefineEvent(String name, EventAttributes attributes, Type eventtype) { lock(SyncRoot) @@ -2197,7 +2106,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecurityCritical] // auto-generated private EventBuilder DefineEventNoLock(String name, EventAttributes attributes, Type eventtype) { if (name == null) @@ -2239,7 +2147,6 @@ namespace System.Reflection.Emit { #region Create Type - [System.Security.SecuritySafeCritical] // auto-generated public TypeInfo CreateTypeInfo() { lock (SyncRoot) @@ -2248,7 +2155,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecuritySafeCritical] // auto-generated public Type CreateType() { lock (SyncRoot) @@ -2266,7 +2172,6 @@ namespace System.Reflection.Emit { m_module.CheckContext(types); } - [System.Security.SecurityCritical] // auto-generated private TypeInfo CreateTypeNoLock() { if (IsCreated()) @@ -2491,7 +2396,6 @@ namespace System.Reflection.Emit { } } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public void AddInterfaceImplementation(Type interfaceType) { @@ -2523,11 +2427,6 @@ public TypeToken TypeToken } -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { @@ -2542,7 +2441,6 @@ public TypeToken TypeToken binaryAttribute, false, false); } - [System.Security.SecuritySafeCritical] // auto-generated public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (customBuilder == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs index 509b16b..6064aea 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs @@ -19,9 +19,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_EventInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class EventInfo : MemberInfo, _EventInfo { @@ -228,7 +225,6 @@ namespace System.Reflection private int m_token; private EventAttributes m_flags; private string m_name; - [System.Security.SecurityCritical] private void* m_utf8name; private RuntimeTypeCache m_reflectedTypeCache; private RuntimeMethodInfo m_addMethod; @@ -244,7 +240,6 @@ namespace System.Reflection { // Used for dummy head node during population } - [System.Security.SecurityCritical] // auto-generated internal RuntimeEventInfo(int tkEvent, RuntimeType declaredType, RuntimeTypeCache reflectedTypeCache, out bool isPrivate) { Contract.Requires(declaredType != null); @@ -316,7 +311,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) @@ -341,7 +335,6 @@ namespace System.Reflection public override MemberTypes MemberType { get { return MemberTypes.Event; } } public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -373,7 +366,6 @@ namespace System.Reflection #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated_required public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs index ed4d296..97a4815 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs @@ -23,9 +23,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_FieldInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class FieldInfo : MemberInfo, _FieldInfo { @@ -303,7 +300,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) @@ -329,7 +325,6 @@ namespace System.Reflection #endregion #region ISerializable Implementation - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -349,7 +344,6 @@ namespace System.Reflection internal unsafe sealed class RtFieldInfo : RuntimeFieldInfo, IRuntimeFieldInfo { #region FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static private extern void PerformVisibilityCheckOnField(IntPtr field, Object target, RuntimeType declaringType, FieldAttributes attr, uint invocationFlags); #endregion @@ -447,7 +441,6 @@ namespace System.Reflection private RuntimeAssembly GetRuntimeAssembly() { return m_declaringType.GetRuntimeAssembly(); } #region Constructor - [System.Security.SecurityCritical] // auto-generated internal RtFieldInfo( RuntimeFieldHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags) : base(reflectedTypeCache, declaringType, bindingFlags) @@ -460,7 +453,6 @@ namespace System.Reflection #region Private Members RuntimeFieldHandleInternal IRuntimeFieldInfo.Value { - [System.Security.SecuritySafeCritical] get { return new RuntimeFieldHandleInternal(m_fieldHandle); @@ -502,7 +494,6 @@ namespace System.Reflection return m.m_fieldHandle == m_fieldHandle; } - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark) @@ -559,7 +550,6 @@ namespace System.Reflection // InternalSetValue() instead. When the caller needs to perform // consistency checks they should call CheckConsistency() before // calling this method. - [System.Security.SecurityCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal void UnsafeSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) @@ -581,7 +571,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal Object InternalGetValue(Object obj, ref StackCrawlMark stackMark) @@ -624,7 +613,6 @@ namespace System.Reflection // InternalGetValue() instead. When the caller needs to perform // consistency checks they should call CheckConsistency() before // calling this method. - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal Object UnsafeGetValue(Object obj) @@ -652,7 +640,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -672,11 +659,9 @@ namespace System.Reflection public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeFieldHandle.GetToken(this); } } - [System.Security.SecuritySafeCritical] // auto-generated internal override RuntimeModule GetRuntimeModule() { return RuntimeTypeHandle.GetModule(RuntimeFieldHandle.GetApproxDeclaringType(this)); @@ -693,7 +678,6 @@ namespace System.Reflection public override object GetRawConstantValue() { throw new InvalidOperationException(); } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override Object GetValueDirect(TypedReference obj) @@ -709,7 +693,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) @@ -718,7 +701,6 @@ namespace System.Reflection InternalSetValue(obj, value, invokeAttr, binder, culture, ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] public override void SetValueDirect(TypedReference obj, Object value) @@ -760,7 +742,6 @@ namespace System.Reflection public override Type FieldType { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_fieldType == null) @@ -770,13 +751,11 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetRequiredCustomModifiers() { return new Signature(this, m_declaringType).GetCustomModifiers(1, true); } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetOptionalCustomModifiers() { return new Signature(this, m_declaringType).GetCustomModifiers(1, false); @@ -824,7 +803,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -869,7 +847,6 @@ namespace System.Reflection public unsafe override Object GetRawConstantValue() { return GetValue(true); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe Object GetValue(bool raw) { // Cannot cache these because they could be user defined non-agile enumerations @@ -891,7 +868,6 @@ namespace System.Reflection public override Type FieldType { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_fieldType == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/LoaderAllocator.cs b/src/coreclr/src/mscorlib/src/System/Reflection/LoaderAllocator.cs index a8b4b0c..7c6c6bd 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/LoaderAllocator.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/LoaderAllocator.cs @@ -34,11 +34,9 @@ namespace System.Reflection internal IntPtr m_nativeLoaderAllocator; [SuppressUnmanagedCodeSecurity] - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern bool Destroy(IntPtr nativeLoaderAllocator); - [SecuritySafeCritical] ~LoaderAllocatorScout() { if (m_nativeLoaderAllocator.IsNull()) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MdConstant.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MdConstant.cs index 1941736..e59244f 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MdConstant.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MdConstant.cs @@ -10,7 +10,6 @@ namespace System.Reflection internal static class MdConstant { - [System.Security.SecurityCritical] // auto-generated public static unsafe Object GetValue(MetadataImport scope, int token, RuntimeTypeHandle fieldTypeHandle, bool raw) { CorElementType corElementType = 0; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MdImport.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MdImport.cs index 3bf8edd..bbdf948 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MdImport.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MdImport.cs @@ -174,7 +174,6 @@ namespace System.Reflection public int Length { get { return m_length; } } public byte this[int index] { - [System.Security.SecuritySafeCritical] // auto-generated get { if (index < 0 || index >= m_length) @@ -269,7 +268,6 @@ namespace System.Reflection public int this[int index] { - [System.Security.SecurityCritical] get { Contract.Requires(0 <= index && index < Length); @@ -312,12 +310,10 @@ namespace System.Reflection #endregion #region Static Members - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetMarshalAs(IntPtr pNativeType, int cNativeType, out int unmanagedType, out int safeArraySubType, out string safeArrayUserDefinedSubType, out int arraySubType, out int sizeParamIndex, out int sizeConst, out string marshalType, out string marshalCookie, out int iidParamIndex); - [System.Security.SecurityCritical] // auto-generated internal static void GetMarshalAs(ConstArray nativeType, out UnmanagedType unmanagedType, out VarEnum safeArraySubType, out string safeArrayUserDefinedSubType, out UnmanagedType arraySubType, out int sizeParamIndex, out int sizeConst, out string marshalType, out string marshalCookie, @@ -351,56 +347,46 @@ namespace System.Reflection #endregion #region FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private unsafe static extern void _Enum(IntPtr scope, int type, int parent, out MetadataEnumResult result); - [System.Security.SecurityCritical] // auto-generated public unsafe void Enum(MetadataTokenType type, int parent, out MetadataEnumResult result) { _Enum(m_metadataImport2, (int)type, parent, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumNestedTypes(int mdTypeDef, out MetadataEnumResult result) { Enum(MetadataTokenType.TypeDef, mdTypeDef, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumCustomAttributes(int mdToken, out MetadataEnumResult result) { Enum(MetadataTokenType.CustomAttribute, mdToken, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumParams(int mdMethodDef, out MetadataEnumResult result) { Enum(MetadataTokenType.ParamDef, mdMethodDef, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumFields(int mdTypeDef, out MetadataEnumResult result) { Enum(MetadataTokenType.FieldDef, mdTypeDef, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumProperties(int mdTypeDef, out MetadataEnumResult result) { Enum(MetadataTokenType.Property, mdTypeDef, out result); } - [System.Security.SecurityCritical] // auto-generated public unsafe void EnumEvents(int mdTypeDef, out MetadataEnumResult result) { Enum(MetadataTokenType.Event, mdTypeDef, out result); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static extern String _GetDefaultValue(IntPtr scope, int mdToken, out long value, out int length, out int corElementType); - [System.Security.SecurityCritical] // auto-generated public String GetDefaultValue(int mdToken, out long value, out int length, out CorElementType corElementType) { int _corElementType; @@ -410,10 +396,8 @@ namespace System.Reflection return stringVal; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static unsafe extern void _GetUserString(IntPtr scope, int mdToken, void** name, out int length); - [System.Security.SecurityCritical] // auto-generated public unsafe String GetUserString(int mdToken) { void* name; @@ -436,10 +420,8 @@ namespace System.Reflection return new String(c); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static unsafe extern void _GetName(IntPtr scope, int mdToken, void** name); - [System.Security.SecurityCritical] // auto-generated public unsafe Utf8String GetName(int mdToken) { void* name; @@ -448,10 +430,8 @@ namespace System.Reflection return new Utf8String(name); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static unsafe extern void _GetNamespace(IntPtr scope, int mdToken, void** namesp); - [System.Security.SecurityCritical] // auto-generated public unsafe Utf8String GetNamespace(int mdToken) { void* namesp; @@ -460,10 +440,8 @@ namespace System.Reflection return new Utf8String(namesp); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private unsafe static extern void _GetEventProps(IntPtr scope, int mdToken, void** name, out int eventAttributes); - [System.Security.SecurityCritical] // auto-generated public unsafe void GetEventProps(int mdToken, out void* name, out EventAttributes eventAttributes) { int _eventAttributes; @@ -473,10 +451,8 @@ namespace System.Reflection eventAttributes = (EventAttributes)_eventAttributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static extern void _GetFieldDefProps(IntPtr scope, int mdToken, out int fieldAttributes); - [System.Security.SecurityCritical] // auto-generated public void GetFieldDefProps(int mdToken, out FieldAttributes fieldAttributes) { int _fieldAttributes; @@ -484,11 +460,9 @@ namespace System.Reflection fieldAttributes = (FieldAttributes)_fieldAttributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private unsafe static extern void _GetPropertyProps(IntPtr scope, int mdToken, void** name, out int propertyAttributes, out ConstArray signature); - [System.Security.SecurityCritical] // auto-generated public unsafe void GetPropertyProps(int mdToken, out void* name, out PropertyAttributes propertyAttributes, out ConstArray signature) { int _propertyAttributes; @@ -498,11 +472,9 @@ namespace System.Reflection propertyAttributes = (PropertyAttributes)_propertyAttributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute (MethodImplOptions.InternalCall)] private static extern void _GetParentToken(IntPtr scope, int mdToken, out int tkParent); - [System.Security.SecurityCritical] // auto-generated public int GetParentToken(int tkToken) { int tkParent; @@ -510,11 +482,9 @@ namespace System.Reflection return tkParent; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetParamDefProps(IntPtr scope, int parameterToken, out int sequence, out int attributes); - [System.Security.SecurityCritical] // auto-generated public void GetParamDefProps(int parameterToken, out int sequence, out ParameterAttributes attributes) { int _attributes; @@ -524,13 +494,11 @@ namespace System.Reflection attributes = (ParameterAttributes)_attributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetGenericParamProps(IntPtr scope, int genericParameter, out int flags); - [System.Security.SecurityCritical] // auto-generated public void GetGenericParamProps( int genericParameter, out GenericParameterAttributes attributes) @@ -540,12 +508,10 @@ namespace System.Reflection attributes = (GenericParameterAttributes)_attributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetScopeProps(IntPtr scope, out Guid mvid); - [System.Security.SecurityCritical] // auto-generated public void GetScopeProps( out Guid mvid) { @@ -553,7 +519,6 @@ namespace System.Reflection } - [System.Security.SecurityCritical] // auto-generated public ConstArray GetMethodSignature(MetadataToken token) { if (token.IsMemberRef) @@ -562,13 +527,11 @@ namespace System.Reflection return GetSigOfMethodDef(token); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetSigOfMethodDef(IntPtr scope, int methodToken, ref ConstArray signature); - [System.Security.SecurityCritical] // auto-generated public ConstArray GetSigOfMethodDef(int methodToken) { ConstArray signature = new ConstArray(); @@ -578,13 +541,11 @@ namespace System.Reflection return signature; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetSignatureFromToken(IntPtr scope, int methodToken, ref ConstArray signature); - [System.Security.SecurityCritical] // auto-generated public ConstArray GetSignatureFromToken(int token) { ConstArray signature = new ConstArray(); @@ -594,13 +555,11 @@ namespace System.Reflection return signature; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetMemberRefProps(IntPtr scope, int memberTokenRef, out ConstArray signature); - [System.Security.SecurityCritical] // auto-generated public ConstArray GetMemberRefProps(int memberTokenRef) { ConstArray signature = new ConstArray(); @@ -610,14 +569,12 @@ namespace System.Reflection return signature; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetCustomAttributeProps(IntPtr scope, int customAttributeToken, out int constructorToken, out ConstArray signature); - [System.Security.SecurityCritical] // auto-generated public void GetCustomAttributeProps( int customAttributeToken, out int constructorToken, @@ -627,11 +584,9 @@ namespace System.Reflection out constructorToken, out signature); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetClassLayout(IntPtr scope, int typeTokenDef, out int packSize, out int classSize); - [System.Security.SecurityCritical] // auto-generated public void GetClassLayout( int typeTokenDef, out int packSize, @@ -640,11 +595,9 @@ namespace System.Reflection _GetClassLayout(m_metadataImport2, typeTokenDef, out packSize, out classSize); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool _GetFieldOffset(IntPtr scope, int typeTokenDef, int fieldTokenDef, out int offset); - [System.Security.SecurityCritical] // auto-generated public bool GetFieldOffset( int typeTokenDef, int fieldTokenDef, @@ -653,13 +606,11 @@ namespace System.Reflection return _GetFieldOffset(m_metadataImport2, typeTokenDef, fieldTokenDef, out offset); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetSigOfFieldDef(IntPtr scope, int fieldToken, ref ConstArray fieldMarshal); - [System.Security.SecurityCritical] // auto-generated public ConstArray GetSigOfFieldDef(int fieldToken) { ConstArray fieldMarshal = new ConstArray(); @@ -669,13 +620,11 @@ namespace System.Reflection return fieldMarshal; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetFieldMarshal(IntPtr scope, int fieldToken, ref ConstArray fieldMarshal); - [System.Security.SecurityCritical] // auto-generated public ConstArray GetFieldMarshal(int fieldToken) { ConstArray fieldMarshal = new ConstArray(); @@ -685,7 +634,6 @@ namespace System.Reflection return fieldMarshal; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe static extern void _GetPInvokeMap(IntPtr scope, int token, @@ -693,7 +641,6 @@ namespace System.Reflection void** importName, void** importDll); - [System.Security.SecurityCritical] // auto-generated public unsafe void GetPInvokeMap( int token, out PInvokeAttributes attributes, @@ -709,10 +656,8 @@ namespace System.Reflection attributes = (PInvokeAttributes)_attributes; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool _IsValidToken(IntPtr scope, int token); - [System.Security.SecurityCritical] // auto-generated public bool IsValidToken(int token) { return _IsValidToken(m_metadataImport2, token); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs index 248c78b..26621cf 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs @@ -16,9 +16,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_MemberInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class MemberInfo : ICustomAttributeProvider, _MemberInfo { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs index ac524bd..20ff376 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs @@ -86,7 +86,6 @@ namespace System.Reflection #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Method)); @@ -94,7 +93,6 @@ namespace System.Reflection #endregion #region IObjectReference - [System.Security.SecurityCritical] // auto-generated public virtual Object GetRealObject(StreamingContext context) { if (m_memberName == null || m_reflectedType == null || m_memberType == 0) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs index 7df9529..388e4f4 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs @@ -11,7 +11,6 @@ namespace System.Reflection.Metadata public static class AssemblyExtensions { [DllImport(JitHelpers.QCall)] - [SecurityCritical] // unsafe method [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private unsafe static extern bool InternalTryGetRawMetadata(RuntimeAssembly assembly, ref byte* blob, ref int length); @@ -24,7 +23,6 @@ namespace System.Reflection.Metadata // associated, is alive. The caller is responsible for keeping the assembly object alive while accessing the // metadata blob. [CLSCompliant(false)] // out byte* blob - [SecurityCritical] // unsafe method public unsafe static bool TryGetRawMetadata(this Assembly assembly, out byte* blob, out int length) { if (assembly == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs index 6a9778b..4ffa135 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs @@ -50,9 +50,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_MethodBase))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class MethodBase : MemberInfo, _MethodBase { @@ -131,7 +128,6 @@ namespace System.Reflection #region Internal Members // used by EE - [System.Security.SecurityCritical] private IntPtr GetMethodDesc() { return MethodHandle.Value; } #if FEATURE_APPX @@ -243,7 +239,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] #pragma warning disable 618 [ReflectionPermissionAttribute(SecurityAction.Demand, Flags=ReflectionPermissionFlag.MemberAccess)] #pragma warning restore 618 @@ -329,7 +324,6 @@ namespace System.Reflection return parameterTypes; } - [System.Security.SecuritySafeCritical] internal Object[] CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs index 2e59b3d..2f86b29 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs @@ -26,9 +26,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_MethodInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class MethodInfo : MethodBase, _MethodInfo { @@ -177,7 +174,6 @@ namespace System.Reflection internal INVOCATION_FLAGS InvocationFlags { - [System.Security.SecuritySafeCritical] get { if ((m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) == 0) @@ -240,7 +236,6 @@ namespace System.Reflection #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal RuntimeMethodInfo( RuntimeMethodHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, BindingFlags bindingFlags, object keepalive) @@ -262,7 +257,6 @@ namespace System.Reflection #region Private Methods RuntimeMethodHandleInternal IRuntimeMethodInfo.Value { - [System.Security.SecuritySafeCritical] get { return new RuntimeMethodHandleInternal(m_handle); @@ -277,7 +271,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated private ParameterInfo[] FetchNonReturnParameters() { if (m_parameters == null) @@ -286,7 +279,6 @@ namespace System.Reflection return m_parameters; } - [System.Security.SecurityCritical] // auto-generated private ParameterInfo FetchReturnParameter() { if (m_returnParameter == null) @@ -346,7 +338,6 @@ namespace System.Reflection return new RuntimeMethodHandle(this); } - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeMethodInfo GetParentDefinition() { if (!IsVirtual || m_declaringType.IsInterface) @@ -391,7 +382,6 @@ namespace System.Reflection return base.GetHashCode(); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(object obj) { if (!IsGenericMethod) @@ -436,13 +426,11 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType as RuntimeType, inherit); } - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) @@ -480,7 +468,6 @@ namespace System.Reflection #region MemberInfo Overrides public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -515,7 +502,6 @@ namespace System.Reflection public override MemberTypes MemberType { get { return MemberTypes.Method; } } public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeMethodHandle.GetMethodDef(this); } } public override Module Module { get { return GetRuntimeModule(); } } @@ -550,7 +536,6 @@ namespace System.Reflection #endregion #region MethodBase Overrides - [System.Security.SecuritySafeCritical] // auto-generated internal override ParameterInfo[] GetParametersNoCopy() { FetchNonReturnParameters(); @@ -558,7 +543,6 @@ namespace System.Reflection return m_parameters; } - [System.Security.SecuritySafeCritical] // auto-generated [System.Diagnostics.Contracts.Pure] public override ParameterInfo[] GetParameters() { @@ -608,7 +592,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // overrides SafeCritical member #if !FEATURE_CORECLR #pragma warning disable 618 [ReflectionPermissionAttribute(SecurityAction.Demand, Flags = ReflectionPermissionFlag.MemberAccess)] @@ -639,7 +622,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] private void ThrowNoInvokeException() { // method is ReflectionOnly @@ -677,7 +659,6 @@ namespace System.Reflection throw new TargetException(); } - [System.Security.SecuritySafeCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable @@ -713,7 +694,6 @@ namespace System.Reflection return UnsafeInvokeInternal(obj, parameters, arguments); } - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal object UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) @@ -723,7 +703,6 @@ namespace System.Reflection return UnsafeInvokeInternal(obj, parameters, arguments); } - [System.Security.SecurityCritical] [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] private object UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) @@ -787,7 +766,6 @@ namespace System.Reflection public override ParameterInfo ReturnParameter { - [System.Security.SecuritySafeCritical] // auto-generated get { Contract.Ensures(m_returnParameter != null); @@ -797,7 +775,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override MethodInfo GetBaseDefinition() { if (!IsVirtual || IsStatic || m_declaringType == null || m_declaringType.IsInterface) @@ -823,7 +800,6 @@ namespace System.Reflection return(MethodInfo)RuntimeType.GetMethodBase(baseDeclaringType, baseMethodHandle); } - [System.Security.SecuritySafeCritical] public override Delegate CreateDelegate(Type delegateType) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; @@ -843,7 +819,6 @@ namespace System.Reflection ref stackMark); } - [System.Security.SecuritySafeCritical] public override Delegate CreateDelegate(Type delegateType, Object target) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; @@ -860,7 +835,6 @@ namespace System.Reflection ref stackMark); } - [System.Security.SecurityCritical] private Delegate CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags, ref StackCrawlMark stackMark) { // Validate the parameters. @@ -887,7 +861,6 @@ namespace System.Reflection #endregion #region Generics - [System.Security.SecuritySafeCritical] // auto-generated public override MethodInfo MakeGenericMethod(params Type[] methodInstantiation) { if (methodInstantiation == null) @@ -999,7 +972,6 @@ namespace System.Reflection #endregion #region ISerializable Implementation - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Missing.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Missing.cs index 8d93e1e..24bf77b 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Missing.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Missing.cs @@ -24,7 +24,6 @@ namespace System.Reflection #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Module.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Module.cs index 2ccaa00..b6be38e 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Module.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Module.cs @@ -59,9 +59,6 @@ namespace System.Reflection [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_Module))] [System.Runtime.InteropServices.ComVisible(true)] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 public abstract class Module : _Module, ISerializable, ICustomAttributeProvider { #region Static Constructor @@ -274,7 +271,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated_required public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotImplementedException(); @@ -299,9 +295,6 @@ namespace System.Reflection public virtual String FullyQualifiedName { -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif get { throw new NotImplementedException(); @@ -552,37 +545,30 @@ namespace System.Reflection internal RuntimeModule() { throw new NotSupportedException(); } #region FCalls - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetType(RuntimeModule module, String className, bool ignoreCase, bool throwOnError, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall)] [SuppressUnmanagedCodeSecurity] private static extern bool nIsTransientInternal(RuntimeModule module); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetScopeName(RuntimeModule module, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetFullyQualifiedName(RuntimeModule module, StringHandleOnStack retString); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static RuntimeType[] GetTypes(RuntimeModule module); - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeType[] GetDefinedTypes() { return GetTypes(GetNativeHandle()); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static bool IsResource(RuntimeModule module); #endregion @@ -610,7 +596,6 @@ namespace System.Reflection return typeHandleArgs; } - [System.Security.SecuritySafeCritical] // auto-generated public override byte[] ResolveSignature(int metadataToken) { MetadataToken tk = new MetadataToken(metadataToken); @@ -637,7 +622,6 @@ namespace System.Reflection return sig; } - [System.Security.SecuritySafeCritical] // auto-generated public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { MetadataToken tk = new MetadataToken(metadataToken); @@ -688,7 +672,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated private FieldInfo ResolveLiteralField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { MetadataToken tk = new MetadataToken(metadataToken); @@ -720,7 +703,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { MetadataToken tk = new MetadataToken(metadataToken); @@ -775,7 +757,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { MetadataToken tk = new MetadataToken(metadataToken); @@ -808,7 +789,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { MetadataToken tk = new MetadataToken(metadataToken); @@ -853,7 +833,6 @@ namespace System.Reflection nameof(metadataToken)); } - [System.Security.SecuritySafeCritical] // auto-generated public override string ResolveString(int metadataToken) { MetadataToken tk = new MetadataToken(metadataToken); @@ -881,7 +860,6 @@ namespace System.Reflection public override int MDStreamVersion { - [System.Security.SecuritySafeCritical] // auto-generated get { return ModuleHandle.GetMDStreamVersion(GetNativeHandle()); @@ -937,7 +915,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] internal bool IsTransientInternal() { return RuntimeModule.nIsTransientInternal(this.GetNativeHandle()); @@ -945,7 +922,6 @@ namespace System.Reflection internal MetadataImport MetadataImport { - [System.Security.SecurityCritical] // auto-generated get { unsafe @@ -976,7 +952,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) @@ -998,7 +973,6 @@ namespace System.Reflection #endregion #region Public Virtuals - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -1009,7 +983,6 @@ namespace System.Reflection UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly()); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public override Type GetType(String className, bool throwOnError, bool ignoreCase) { @@ -1024,7 +997,6 @@ namespace System.Reflection return retType; } - [System.Security.SecurityCritical] // auto-generated internal string GetFullyQualifiedName() { String fullyQualifiedName = null; @@ -1034,11 +1006,6 @@ namespace System.Reflection public override String FullyQualifiedName { -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#else - [System.Security.SecuritySafeCritical] -#endif get { String fullyQualifiedName = GetFullyQualifiedName(); @@ -1060,7 +1027,6 @@ namespace System.Reflection } } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetTypes() { return GetTypes(GetNativeHandle()); @@ -1072,7 +1038,6 @@ namespace System.Reflection public override Guid ModuleVersionId { - [System.Security.SecuritySafeCritical] // auto-generated get { unsafe @@ -1086,7 +1051,6 @@ namespace System.Reflection public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return ModuleHandle.GetToken(GetNativeHandle()); @@ -1127,7 +1091,6 @@ namespace System.Reflection public override String ScopeName { - [System.Security.SecuritySafeCritical] // auto-generated get { string scopeName = null; @@ -1138,7 +1101,6 @@ namespace System.Reflection public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { String s = GetFullyQualifiedName(); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs index 682db15..d095b04 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs @@ -205,7 +205,6 @@ namespace System.Reflection // In V4 RuntimeParameterInfo is introduced. // To support deserializing ParameterInfo instances serialized in earlier versions // we need to implement IObjectReference. - [System.Security.SecurityCritical] public object GetRealObject(StreamingContext context) { Contract.Ensures(Contract.Result() != null); @@ -258,7 +257,6 @@ namespace System.Reflection internal unsafe sealed class RuntimeParameterInfo : ParameterInfo, ISerializable { #region Static Members - [System.Security.SecurityCritical] // auto-generated internal unsafe static ParameterInfo[] GetParameters(IRuntimeMethodInfo method, MemberInfo member, Signature sig) { Contract.Assert(method is RuntimeMethodInfo || method is RuntimeConstructorInfo); @@ -267,7 +265,6 @@ namespace System.Reflection return GetParameters(method, member, sig, out dummy, false); } - [System.Security.SecurityCritical] // auto-generated internal unsafe static ParameterInfo GetReturnParameter(IRuntimeMethodInfo method, MemberInfo member, Signature sig) { Contract.Assert(method is RuntimeMethodInfo || method is RuntimeConstructorInfo); @@ -277,7 +274,6 @@ namespace System.Reflection return returnParameter; } - [System.Security.SecurityCritical] // auto-generated internal unsafe static ParameterInfo[] GetParameters( IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, out ParameterInfo returnParameter, bool fetchReturnParameter) { @@ -396,7 +392,6 @@ namespace System.Reflection #endregion #region VTS magic to serialize/deserialized to/from pre-Whidbey endpoints. - [System.Security.SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -521,7 +516,6 @@ namespace System.Reflection public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (!m_nameIsCached) @@ -585,7 +579,6 @@ namespace System.Reflection } // returns DBNull.Value if the parameter doesn't have a default value - [System.Security.SecuritySafeCritical] private Object GetDefaultValueInternal(bool raw) { Contract.Assert(!m_noMetadata); @@ -739,7 +732,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Pointer.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Pointer.cs index f0127ef..95025b2 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Pointer.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Pointer.cs @@ -22,13 +22,11 @@ namespace System.Reflection { [System.Runtime.InteropServices.ComVisible(true)] public sealed class Pointer : ISerializable { - [SecurityCritical] unsafe private void* _ptr; private RuntimeType _ptrType; private Pointer() {} - [System.Security.SecurityCritical] // auto-generated private unsafe Pointer(SerializationInfo info, StreamingContext context) { _ptr = ((IntPtr)(info.GetValue("_ptr", typeof(IntPtr)))).ToPointer(); @@ -38,7 +36,6 @@ namespace System.Reflection { // This method will box an pointer. We save both the // value and the type so we can access it from the native code // during an Invoke. - [System.Security.SecurityCritical] // auto-generated public static unsafe Object Box(void *ptr,Type type) { if (type == null) throw new ArgumentNullException(nameof(type)); @@ -57,7 +54,6 @@ namespace System.Reflection { } // Returned the stored pointer. - [System.Security.SecurityCritical] // auto-generated public static unsafe void* Unbox(Object ptr) { if (!(ptr is Pointer)) throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"),nameof(ptr)); @@ -68,12 +64,10 @@ namespace System.Reflection { return _ptrType; } - [System.Security.SecurityCritical] // auto-generated internal unsafe Object GetPointerValue() { return (IntPtr)_ptr; } - [System.Security.SecurityCritical] unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("_ptr", new IntPtr(_ptr)); info.AddValue("_ptrType", _ptrType); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs index 88de1ed..ffeb5f5 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs @@ -22,9 +22,6 @@ namespace System.Reflection [Serializable] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_PropertyInfo))] -#pragma warning disable 618 - [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")] -#pragma warning restore 618 [System.Runtime.InteropServices.ComVisible(true)] public abstract class PropertyInfo : MemberInfo, _PropertyInfo { @@ -190,7 +187,6 @@ namespace System.Reflection #region Private Data Members private int m_token; private string m_name; - [System.Security.SecurityCritical] private void* m_utf8name; private PropertyAttributes m_flags; private RuntimeTypeCache m_reflectedTypeCache; @@ -204,7 +200,6 @@ namespace System.Reflection #endregion #region Constructor - [System.Security.SecurityCritical] // auto-generated internal RuntimePropertyInfo( int tkProperty, RuntimeType declaredType, RuntimeTypeCache reflectedTypeCache, out bool isPrivate) { @@ -245,7 +240,6 @@ namespace System.Reflection internal Signature Signature { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_signature == null) @@ -343,7 +337,6 @@ namespace System.Reflection return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) @@ -368,7 +361,6 @@ namespace System.Reflection public override MemberTypes MemberType { get { return MemberTypes.Property; } } public override String Name { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_name == null) @@ -421,7 +413,6 @@ namespace System.Reflection return Signature.GetCustomModifiers(0, false); } - [System.Security.SecuritySafeCritical] // auto-generated internal object GetConstantValue(bool raw) { Object defaultValue = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_token, PropertyType.GetTypeHandleInternal(), raw); @@ -630,7 +621,6 @@ namespace System.Reflection #endregion #region ISerializable Implementation - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs index 37c93eb..7068113 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs @@ -65,7 +65,6 @@ namespace System.Reflection { get {return _exceptions;} } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs b/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs index 1a38faf..4b8ca82 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs @@ -40,10 +40,6 @@ namespace System.Reflection private byte[] _publicKey; // Build key pair from file. - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public StrongNameKeyPair(FileStream keyPairFile) { if (keyPairFile == null) @@ -58,10 +54,6 @@ namespace System.Reflection } // Build key pair from byte array in memory. - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public StrongNameKeyPair(byte[] keyPairArray) { if (keyPairArray == null) @@ -74,10 +66,6 @@ namespace System.Reflection _keyPairExported = true; } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 protected StrongNameKeyPair (SerializationInfo info, StreamingContext context) { _keyPairExported = (bool) info.GetValue("_keyPairExported", typeof(bool)); _keyPairArray = (byte[]) info.GetValue("_keyPairArray", typeof(byte[])); @@ -87,10 +75,6 @@ namespace System.Reflection #if! FEATURE_CORECLR // Reference key pair in named key container. - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public StrongNameKeyPair(String keyPairContainer) { if (keyPairContainer == null) @@ -105,7 +89,6 @@ namespace System.Reflection // Get the public portion of the key pair. public byte[] PublicKey { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_publicKey == null) @@ -120,7 +103,6 @@ namespace System.Reflection } } - [System.Security.SecurityCritical] // auto-generated private unsafe byte[] ComputePublicKey() { byte[] publicKey = null; @@ -184,7 +166,6 @@ namespace System.Reflection #endif// FEATURE_CORECLR /// - [System.Security.SecurityCritical] void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue("_keyPairExported", _keyPairExported); info.AddValue("_keyPairArray", _keyPairArray); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/TypeDelegator.cs b/src/coreclr/src/mscorlib/src/System/Reflection/TypeDelegator.cs index e94cfa2..d715df8 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/TypeDelegator.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/TypeDelegator.cs @@ -24,9 +24,6 @@ namespace System.Reflection { protected Type typeImpl; - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - #endif protected TypeDelegator() {} public TypeDelegator(Type delegatingType) { diff --git a/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs b/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs index efd949f..6ea5590 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs @@ -38,7 +38,6 @@ namespace System.Resources { // Consider modifying IResourceGroveler interface (hence this method signature) when we figure out // serialization compat story for moving ResourceManager members to either file-based or // manifest-based classes. Want to continue tightening the design to get rid of unused params. - [System.Security.SecuritySafeCritical] // auto-generated public ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark) { Contract.Assert(culture != null, "culture shouldn't be null; check caller"); @@ -145,7 +144,6 @@ namespace System.Resources { // Constructs a new ResourceSet for a given file name. The logic in // here avoids a ReflectionPermission check for our RuntimeResourceSet // for perf and working set reasons. - [System.Security.SecurityCritical] private ResourceSet CreateResourceSet(String file) { Contract.Assert(file != null, "file shouldn't be null; check caller"); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs b/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs index 5fd0daa..07b7271 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs @@ -55,7 +55,6 @@ namespace System.Resources { _mediator = mediator; } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable public ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark) { @@ -217,7 +216,6 @@ namespace System.Resources { } - [System.Security.SecurityCritical] internal static CultureInfo GetNeutralResourcesLanguage(Assembly a, ref UltimateResourceFallbackLocation fallbackLocation) { Contract.Assert(a != null, "assembly != null"); @@ -267,7 +265,6 @@ namespace System.Resources { // Use the assembly to resolve assembly manifest resource references. // Note that is can be null, but probably shouldn't be. // This method could use some refactoring. One thing at a time. - [System.Security.SecurityCritical] internal ResourceSet CreateResourceSet(Stream store, Assembly assembly) { Contract.Assert(store != null, "I need a Stream!"); @@ -413,7 +410,6 @@ namespace System.Resources { } } - [System.Security.SecurityCritical] private Stream GetManifestResourceStream(RuntimeAssembly satellite, String fileName, ref StackCrawlMark stackMark) { Contract.Requires(satellite != null, "satellite shouldn't be null; check caller"); @@ -437,7 +433,6 @@ namespace System.Resources { // case-insensitive lookup rules. Yes, this is slow. The metadata // dev lead refuses to make all assembly manifest resource lookups case-insensitive, // even optionally case-insensitive. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, String name) { @@ -516,7 +511,6 @@ namespace System.Resources { return s; } - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable private RuntimeAssembly GetSatelliteAssembly(CultureInfo lookForCulture, ref StackCrawlMark stackMark) { @@ -609,7 +603,6 @@ namespace System.Resources { return true; } - [System.Security.SecurityCritical] private String GetSatelliteAssemblyName() { String satAssemblyName = _mediator.MainAssembly.GetSimpleName(); @@ -617,7 +610,6 @@ namespace System.Resources { return satAssemblyName; } - [System.Security.SecurityCritical] private void HandleSatelliteMissing() { String satAssemName = _mediator.MainAssembly.GetSimpleName() + ".resources.dll"; @@ -646,7 +638,6 @@ namespace System.Resources { throw new MissingSatelliteAssemblyException(Environment.GetResourceString("MissingSatelliteAssembly_Culture_Name", _mediator.NeutralResourcesCulture, satAssemName), missingCultureName); } - [System.Security.SecurityCritical] // auto-generated private void HandleResourceStreamMissing(String fileName) { // Keep people from bothering me about resources problems @@ -669,7 +660,6 @@ namespace System.Resources { } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [System.Security.SecurityCritical] // Our security team doesn't yet allow safe-critical P/Invoke methods. [System.Security.SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool GetNeutralResourcesLanguageAttribute(RuntimeAssembly assemblyHandle, StringHandleOnStack cultureName, out short fallbackLocation); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs index def7836..30d50d9 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs @@ -190,7 +190,6 @@ namespace System.Resources // Note: May return null. - [System.Security.SecuritySafeCritical] // auto-generated private static String[] GetResourceFallbackArray() { // AppCompat note: We've added this feature for desktop V4 but we ripped it out diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs index 9de91a0..85086b7 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs @@ -45,21 +45,16 @@ namespace System.Resources { // Also using interface or abstract class will not play nice with FriendAccessAllowed. // [FriendAccessAllowed] - [SecurityCritical] internal class WindowsRuntimeResourceManagerBase { - [SecurityCritical] public virtual bool Initialize(string libpath, string reswFilename, out PRIExceptionInfo exceptionInfo){exceptionInfo = null; return false;} - [SecurityCritical] public virtual String GetString(String stringName, String startingCulture, String neutralResourcesCulture){return null;} public virtual CultureInfo GlobalResourceContextBestFitCultureInfo { - [SecurityCritical] get { return null; } } - [SecurityCritical] public virtual bool SetGlobalResourceContextDefaultCulture(CultureInfo ci) { return false; } } @@ -434,7 +429,6 @@ namespace System.Resources { this._lastUsedResourceCache = null; } - [System.Security.SecuritySafeCritical] [OnDeserialized] private void OnDeserialized(StreamingContext ctx) { @@ -479,7 +473,6 @@ namespace System.Resources { // Trying to unify code as much as possible, even though having to do a // security check in each constructor prevents it. - [System.Security.SecuritySafeCritical] private void CommonAssemblyInit() { if (_bUsingModernResourceManagement == false) @@ -677,7 +670,6 @@ namespace System.Resources { // if it hasn't yet been loaded and if parent CultureInfos should be // loaded as well for resource inheritance. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable public virtual ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { if (null==culture) @@ -721,7 +713,6 @@ namespace System.Resources { // for getting a resource set lives. Access to it is controlled by // threadsafe methods such as GetResourceSet, GetString, & GetObject. // This will take a minimal number of locks. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable protected virtual ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { @@ -735,7 +726,6 @@ namespace System.Resources { // for getting a resource set lives. Access to it is controlled by // threadsafe methods such as GetResourceSet, GetString, & GetObject. // This will take a minimal number of locks. - [System.Security.SecurityCritical] private ResourceSet InternalGetResourceSet(CultureInfo requestedCulture, bool createIfNotExists, bool tryParents, ref StackCrawlMark stackMark) { Dictionary localResourceSets = _resourceSets; @@ -894,7 +884,6 @@ namespace System.Resources { #endif } - [System.Security.SecuritySafeCritical] // auto-generated protected static CultureInfo GetNeutralResourcesLanguage(Assembly a) { // This method should be obsolete - replace it with the one below. @@ -961,8 +950,6 @@ namespace System.Resources { } #if FEATURE_APPX - [SecuritySafeCritical] - // Throws WinRT hresults private string GetStringFromPRI(String stringName, String startingCulture, String neutralResourcesCulture) { Contract.Assert(_bUsingModernResourceManagement); Contract.Assert(_WinRTResourceManager != null); @@ -987,7 +974,6 @@ namespace System.Resources { // Since we can't directly reference System.Runtime.WindowsRuntime from mscorlib, we have to get the type via reflection. // It would be better if we could just implement WindowsRuntimeResourceManager in mscorlib, but we can't, because // we can do very little with WinRT in mscorlib. - [SecurityCritical] internal static WindowsRuntimeResourceManagerBase GetWinRTResourceManager() { Type WinRTResourceManagerType = Type.GetType("System.Resources.WindowsRuntimeResourceManager, " + AssemblyRef.SystemRuntimeWindowsRuntime, true); @@ -1000,7 +986,6 @@ namespace System.Resources { #if FEATURE_APPX [NonSerialized] - [SecurityCritical] private WindowsRuntimeResourceManagerBase _WinRTResourceManager; // Written only by SetAppXConfiguration [NonSerialized] @@ -1029,7 +1014,6 @@ namespace System.Resources { // // b) For any other non-FX assembly, we will use the modern resource manager with the premise that app package // contains the PRI resources. - [SecuritySafeCritical] private bool ShouldUseSatelliteAssemblyResourceLookupUnderAppX(RuntimeAssembly resourcesAssembly) { bool fUseSatelliteAssemblyResourceLookupUnderAppX = resourcesAssembly.IsFrameworkAssembly(); @@ -1060,7 +1044,6 @@ namespace System.Resources { } - [SecuritySafeCritical] #endif // FEATURE_APPX // Only call SetAppXConfiguration from ResourceManager constructors, and nowhere else. // Throws MissingManifestResourceException and WinRT HResults @@ -1442,7 +1425,6 @@ namespace System.Resources { #if RESOURCE_SATELLITE_CONFIG // Internal helper method - gives an end user the ability to prevent // satellite assembly probes for certain cultures via a config file. - [System.Security.SecurityCritical] // auto-generated private bool TryLookingForSatellite(CultureInfo lookForCulture) { if (!_checkedConfigFile) { @@ -1470,7 +1452,6 @@ namespace System.Resources { // Note: There is one config file per appdomain. This is not // per-process nor per-assembly. - [System.Security.SecurityCritical] // auto-generated private Hashtable GetSatelliteAssembliesFromConfig() { return null; @@ -1566,7 +1547,6 @@ namespace System.Resources { #if RESOURCE_SATELLITE_CONFIG - [System.Security.SecurityCritical] // auto-generated internal bool TryLookingForSatellite(CultureInfo lookForCulture) { return _rm.TryLookingForSatellite(lookForCulture); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceReader.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceReader.cs index 64b0f0b..b2c3719 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceReader.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceReader.cs @@ -94,10 +94,8 @@ namespace System.Resources { // of the assembly. The pointers here are pointers into that block of // memory controlled by the OS's loader. private int[] _nameHashes; // hash values for all names. - [SecurityCritical] private unsafe int* _nameHashesPtr; // In case we're using UnmanagedMemoryStream private int[] _namePositions; // relative locations of names - [SecurityCritical] private unsafe int* _namePositionsPtr; // If we're using UnmanagedMemoryStream private RuntimeType[] _typeTable; // Lazy array of Types for resource values. private int[] _typeNamePositions; // To delay initialize type table @@ -152,11 +150,6 @@ namespace System.Resources { }; #endif // FEATURE_SERIALIZATION - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif public ResourceReader(String fileName) { _resCache = new Dictionary(FastResourceComparer.Default); @@ -172,7 +165,6 @@ namespace System.Resources { } } - [System.Security.SecurityCritical] // auto-generated_required public ResourceReader(Stream stream) { if (stream==null) @@ -194,7 +186,6 @@ namespace System.Resources { // passing in the stream to read from and the RuntimeResourceSet's // internal hash table (hash table of names with file offsets // and values, coupled to this ResourceReader). - [System.Security.SecurityCritical] // auto-generated internal ResourceReader(Stream stream, Dictionary resCache) { Contract.Requires(stream != null, "Need a stream!"); @@ -221,7 +212,6 @@ namespace System.Resources { Close(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe void Dispose(bool disposing) { if (_store != null) { @@ -243,7 +233,6 @@ namespace System.Resources { } } - [System.Security.SecurityCritical] // auto-generated internal static unsafe int ReadUnalignedI4(int* p) { byte* buffer = (byte*)p; @@ -264,7 +253,6 @@ namespace System.Resources { _store.BaseStream.Seek(stringLength, SeekOrigin.Current); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe int GetNameHash(int index) { Contract.Assert(index >=0 && index < _numResources, "Bad index into hash array. index: "+index); @@ -276,7 +264,6 @@ namespace System.Resources { return ReadUnalignedI4(&_nameHashesPtr[index]); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe int GetNamePosition(int index) { Contract.Assert(index >=0 && index < _numResources, "Bad index into name position array. index: "+index); @@ -395,7 +382,6 @@ namespace System.Resources { // with the string you pass in. // Whoever calls this method should make sure that they take a lock // so no one else can cause us to seek in the stream. - [System.Security.SecuritySafeCritical] // auto-generated private unsafe bool CompareStringEqualsName(String name) { Contract.Assert(_store != null, "ResourceReader is closed!"); @@ -433,7 +419,6 @@ namespace System.Resources { // This is used in the enumerator. The enumerator iterates from 0 to n // of our resources and this returns the resource name for a particular // index. The parameter is NOT a virtual offset. - [System.Security.SecurityCritical] // auto-generated private unsafe String AllocateStringForNameIndex(int index, out int dataOffset) { Contract.Assert(_store != null, "ResourceReader is closed!"); @@ -595,7 +580,6 @@ namespace System.Resources { } #if FEATURE_SERIALIZATION - [SecuritySafeCritical] #endif private Object _LoadObjectV1(int pos) { _store.BaseStream.Seek(_dataSectionOffset+pos, SeekOrigin.Begin); @@ -670,7 +654,6 @@ namespace System.Resources { } } - [System.Security.SecuritySafeCritical] // auto-generated private Object _LoadObjectV2(int pos, out ResourceTypeCode typeCode) { _store.BaseStream.Seek(_dataSectionOffset+pos, SeekOrigin.Begin); typeCode = (ResourceTypeCode) _store.Read7BitEncodedInt(); @@ -801,7 +784,6 @@ namespace System.Resources { // deserialization binder to simulate a type-limiting deserializer. // This method handles types that are safe to deserialize, as well as // ensuring we only get back what we expect. - [System.Security.SecurityCritical] // auto-generated private Object DeserializeObject(int typeIndex) { RuntimeType type = FindType(typeIndex); @@ -843,7 +825,6 @@ namespace System.Resources { // Reads in the header information for a .resources file. Verifies some // of the assumptions about this resource set, and builds the class table // for the default resource file format. - [System.Security.SecurityCritical] // auto-generated private void ReadResources() { Contract.Assert(_store != null, "ResourceReader is closed!"); @@ -867,7 +848,6 @@ namespace System.Resources { } } - [System.Security.SecurityCritical] // auto-generated private void _ReadResources() { // Read ResourceManager header @@ -1093,7 +1073,6 @@ namespace System.Resources { } #if FEATURE_SERIALIZATION - [System.Security.SecurityCritical] // auto-generated private void InitSafeToDeserializeArray() { _safeToDeserialize = new bool[_typeTable.Length]; @@ -1277,7 +1256,6 @@ namespace System.Resources { _typeToDeserialize = type; } - [System.Security.SecuritySafeCritical] // overrides transparent public member public override Type BindToType(string assemblyName, string typeName) { // BinaryObjectReader::Bind tries us first, then its own code. @@ -1343,7 +1321,6 @@ namespace System.Resources { } public Object Key { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_currentName == ENUM_DONE) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded)); if (!_currentIsValid) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); @@ -1367,7 +1344,6 @@ namespace System.Resources { } public DictionaryEntry Entry { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_currentName == ENUM_DONE) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded)); if (!_currentIsValid) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs index 314cb8d..2285abf 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs @@ -65,9 +65,6 @@ namespace System.Resources { // implementation. Use this constructor to open & read from a file // on disk. // - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public ResourceSet(String fileName) { Reader = new ResourceReader(fileName); @@ -89,7 +86,6 @@ namespace System.Resources { // implementation. Use this constructor to read from an open stream // of data. // - [System.Security.SecurityCritical] // auto-generated_required public ResourceSet(Stream stream) { Reader = new ResourceReader(stream); @@ -98,7 +94,6 @@ namespace System.Resources { } #if LOOSELY_LINKED_RESOURCE_REFERENCE - [System.Security.SecurityCritical] // auto_generated_required public ResourceSet(Stream stream, Assembly assembly) { Reader = new ResourceReader(stream); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs b/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs index 7c7414c..9033f76 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs @@ -184,7 +184,6 @@ namespace System.Resources { // the resources once, adding them into the table. private bool _haveReadFromReader; - [System.Security.SecurityCritical] // auto-generated internal RuntimeResourceSet(String fileName) : base(false) { BCLDebug.Log("RESMGRFILEFORMAT", "RuntimeResourceSet .ctor(String)"); @@ -204,7 +203,6 @@ namespace System.Resources { Assembly = assembly; } #else - [System.Security.SecurityCritical] // auto-generated internal RuntimeResourceSet(Stream stream) : base(false) { BCLDebug.Log("RESMGRFILEFORMAT", "RuntimeResourceSet .ctor(Stream)"); diff --git a/src/coreclr/src/mscorlib/src/System/Resources/__FastResourceComparer.cs b/src/coreclr/src/mscorlib/src/System/Resources/__FastResourceComparer.cs index 5bc7333..f84a616 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/__FastResourceComparer.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/__FastResourceComparer.cs @@ -78,7 +78,6 @@ namespace System.Resources { // Input is one string to compare with, and a byte[] containing chars in // little endian unicode. Pass in the number of valid chars. - [System.Security.SecurityCritical] // auto-generated public unsafe static int CompareOrdinal(String a, byte[] bytes, int bCharLength) { Contract.Assert(a != null && bytes != null, "FastResourceComparer::CompareOrdinal must have non-null params"); @@ -107,7 +106,6 @@ namespace System.Resources { return a.Length - bCharLength; } - [System.Security.SecurityCritical] // auto-generated public static int CompareOrdinal(byte[] bytes, int aCharLength, String b) { return -CompareOrdinal(b, bytes, aCharLength); @@ -115,7 +113,6 @@ namespace System.Resources { // This method is to handle potentially misaligned data accesses. // The byte* must point to little endian Unicode characters. - [System.Security.SecurityCritical] // auto-generated internal unsafe static int CompareOrdinal(byte* a, int byteLen, String b) { Contract.Assert((byteLen & 1) == 0, "CompareOrdinal is expecting a UTF-16 string length, which must be even!"); diff --git a/src/coreclr/src/mscorlib/src/System/RtType.cs b/src/coreclr/src/mscorlib/src/System/RtType.cs index 711945d..af9b00d 100644 --- a/src/coreclr/src/mscorlib/src/System/RtType.cs +++ b/src/coreclr/src/mscorlib/src/System/RtType.cs @@ -197,7 +197,6 @@ namespace System private MemberListType m_listType; private uint m_nameHash; - [System.Security.SecurityCritical] // auto-generated public unsafe Filter(byte* pUtf8Name, int cUtf8Name, MemberListType listType) { this.m_name = new Utf8String((void*) pUtf8Name, cUtf8Name); @@ -266,7 +265,6 @@ namespace System #region Constructor #if MDA_SUPPORTED - [System.Security.SecuritySafeCritical] // auto-generated #endif internal MemberInfoCache(RuntimeTypeCache runtimeTypeCache) { @@ -276,7 +274,6 @@ namespace System m_runtimeTypeCache = runtimeTypeCache; } - [System.Security.SecuritySafeCritical] // auto-generated internal MethodBase AddMethod(RuntimeType declaringType, RuntimeMethodHandleInternal method, CacheType cacheType) { T[] list = null; @@ -304,7 +301,6 @@ namespace System return (MethodBase)(object)list[0]; } - [System.Security.SecuritySafeCritical] // auto-generated internal FieldInfo AddField(RuntimeFieldHandleInternal field) { // create the runtime field info @@ -327,7 +323,6 @@ namespace System return (FieldInfo)(object)list[0]; } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe T[] Populate(string name, MemberListType listType, CacheType cacheType) { T[] list = null; @@ -366,7 +361,6 @@ namespace System return list; } - [System.Security.SecurityCritical] // auto-generated private unsafe T[] GetListByName(char* pName, int cNameLen, byte* pUtf8Name, int cUtf8Name, MemberListType listType, CacheType cacheType) { if (cNameLen != 0) @@ -409,7 +403,6 @@ namespace System // May replace the list with a new one if certain cache // lookups succeed. Also, may modify the contents of the list // after merging these new data structures with cached ones. - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal void Insert(ref T[] list, string name, MemberListType listType) { @@ -566,7 +559,6 @@ namespace System #region Population Logic - [System.Security.SecuritySafeCritical] // auto-generated private unsafe RuntimeMethodInfo[] PopulateMethods(Filter filter) { ListBuilder list = new ListBuilder(); @@ -736,7 +728,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private RuntimeConstructorInfo[] PopulateConstructors(Filter filter) { if (ReflectedType.IsGenericParameter) @@ -793,7 +784,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe RuntimeFieldInfo[] PopulateFields(Filter filter) { ListBuilder list = new ListBuilder(); @@ -845,7 +835,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe void PopulateRtFields(Filter filter, RuntimeType declaringType, ref ListBuilder list) { IntPtr* pResult = stackalloc IntPtr[64]; @@ -865,7 +854,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated private unsafe void PopulateRtFields(Filter filter, IntPtr* ppFieldHandles, int count, RuntimeType declaringType, ref ListBuilder list) { @@ -919,7 +907,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe void PopulateLiteralFields(Filter filter, RuntimeType declaringType, ref ListBuilder list) { Contract.Requires(declaringType != null); @@ -1024,7 +1011,6 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated private RuntimeType[] PopulateInterfaces(Filter filter) { ListBuilder list = new ListBuilder(); @@ -1114,7 +1100,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe RuntimeType[] PopulateNestedClasses(Filter filter) { RuntimeType declaringType = ReflectedType; @@ -1165,7 +1150,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe RuntimeEventInfo[] PopulateEvents(Filter filter) { Contract.Requires(ReflectedType != null); @@ -1198,7 +1182,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe void PopulateEvents( Filter filter, RuntimeType declaringType, Dictionary csEventInfos, ref ListBuilder list) { @@ -1259,7 +1242,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe RuntimePropertyInfo[] PopulateProperties(Filter filter) { Contract.Requires(ReflectedType != null); @@ -1300,7 +1282,6 @@ namespace System return list.ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe void PopulateProperties( Filter filter, RuntimeType declaringType, @@ -1608,7 +1589,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] internal unsafe string GetNameSpace() { // @Optimization - Use ConstructName to populate m_namespace @@ -1632,7 +1612,6 @@ namespace System set { m_typeCode = value; } } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe RuntimeType GetEnclosingType() { if (m_enclosingType == null) @@ -1713,7 +1692,6 @@ namespace System #endregion #region Caches Accessors - [System.Security.SecurityCritical] // auto-generated internal MethodInfo GetGenericMethodInfo(RuntimeMethodHandleInternal genericMethod) { LoaderAllocator la = RuntimeMethodHandle.GetLoaderAllocator(genericMethod); @@ -1850,7 +1828,6 @@ namespace System return GetMethodBase(null, methodHandle); } - [System.Security.SecuritySafeCritical] internal static MethodBase GetMethodBase(RuntimeType reflectedType, IRuntimeMethodInfo methodHandle) { MethodBase retval = RuntimeType.GetMethodBase(reflectedType, methodHandle.Value); @@ -1858,7 +1835,6 @@ namespace System return retval; } - [System.Security.SecurityCritical] // auto-generated internal unsafe static MethodBase GetMethodBase(RuntimeType reflectedType, RuntimeMethodHandleInternal methodHandle) { Contract.Assert(!methodHandle.IsNullHandle()); @@ -2001,13 +1977,11 @@ namespace System set { Cache.DomainInitialized = value; } } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static FieldInfo GetFieldInfo(IRuntimeFieldInfo fieldHandle) { return GetFieldInfo(RuntimeFieldHandle.GetApproxDeclaringType(fieldHandle), fieldHandle); } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static FieldInfo GetFieldInfo(RuntimeType reflectedType, IRuntimeFieldInfo field) { RuntimeFieldHandleInternal fieldHandle = field.Value; @@ -2083,7 +2057,6 @@ namespace System Environment.GetResourceString("Argument_NotEnoughGenArguments", genericArguments.Length, genericParamters.Length)); } - [System.Security.SecuritySafeCritical] // auto-generated internal static void ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e) { RuntimeType[] typeContext = null; @@ -2596,7 +2569,6 @@ namespace System private RuntimeTypeCache Cache { - [System.Security.SecuritySafeCritical] // auto-generated get { if (m_cache.IsNull()) @@ -2832,7 +2804,6 @@ namespace System return GetFieldCandidates(null, bindingAttr, false).ToArray(); } - [System.Security.SecuritySafeCritical] // auto-generated public override Type[] GetInterfaces() { RuntimeType[] candidates = this.Cache.GetInterfaceList(MemberListType.All, null); @@ -2878,7 +2849,6 @@ namespace System return members; } - [System.Security.SecuritySafeCritical] // auto-generated public override InterfaceMapping GetInterfaceMap(Type ifaceType) { if (IsGenericParameter) @@ -3312,13 +3282,11 @@ namespace System return new RuntimeTypeHandle(this); } - [System.Security.SecuritySafeCritical] internal bool IsCollectible() { return RuntimeTypeHandle.IsCollectible(GetTypeHandleInternal()); } - [System.Security.SecuritySafeCritical] // auto-generated protected override TypeCode GetTypeCodeImpl() { TypeCode typeCode = Cache.TypeCode; @@ -3399,7 +3367,6 @@ namespace System #endregion #region Hierarchy - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsInstanceOfType(Object o) { return RuntimeTypeHandle.IsInstanceOfType(this, o); @@ -3600,7 +3567,6 @@ namespace System #endregion #region Attributes - [System.Security.SecuritySafeCritical] // auto-generated protected override TypeAttributes GetAttributeFlagsImpl() { return RuntimeTypeHandle.GetAttributes(this); @@ -3608,7 +3574,6 @@ namespace System public override Guid GUID { - [System.Security.SecuritySafeCritical] // auto-generated get { Guid result = new Guid (); @@ -3617,11 +3582,9 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void GetGUID(ref Guid result); - [System.Security.SecuritySafeCritical] // auto-generated protected override bool IsContextfulImpl() { return false; @@ -3642,36 +3605,30 @@ namespace System return RuntimeTypeHandle.IsPointer(this); } - [System.Security.SecuritySafeCritical] // auto-generated protected override bool IsCOMObjectImpl() { return RuntimeTypeHandle.IsComObject(this, false); } #if FEATURE_COMINTEROP - [SecuritySafeCritical] internal override bool IsWindowsRuntimeObjectImpl() { return IsWindowsRuntimeObjectType(this); } - [SecuritySafeCritical] internal override bool IsExportedToWindowsRuntimeImpl() { return IsTypeExportedToWindowsRuntime(this); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecurityCritical] private static extern bool IsWindowsRuntimeObjectType(RuntimeType type); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecurityCritical] private static extern bool IsTypeExportedToWindowsRuntime(RuntimeType type); #endif // FEATURE_COMINTEROP - [System.Security.SecuritySafeCritical] // auto-generated internal override bool HasProxyAttributeImpl() { return RuntimeTypeHandle.HasProxyAttribute(this); @@ -3710,7 +3667,6 @@ namespace System public override GenericParameterAttributes GenericParameterAttributes { - [System.Security.SecuritySafeCritical] // auto-generated get { if (!IsGenericParameter) @@ -3753,7 +3709,6 @@ namespace System return RuntimeTypeHandle.IsArray(this); } - [System.Security.SecuritySafeCritical] // auto-generated public override int GetArrayRank() { if (!IsArrayImpl()) @@ -3785,7 +3740,6 @@ namespace System return retVal; } - [SecuritySafeCritical] public override Array GetEnumValues() { if (!IsEnum) @@ -3896,7 +3850,6 @@ namespace System return types; } - [System.Security.SecuritySafeCritical] // auto-generated public override Type MakeGenericType(Type[] instantiation) { if (instantiation == null) @@ -4012,7 +3965,6 @@ namespace System #endregion #region Misc - [System.Security.SecuritySafeCritical] // auto-generated public override Type MakePointerType() { return new RuntimeTypeHandle(this).MakePointer(); } public override Type MakeByRefType() { return new RuntimeTypeHandle(this).MakeByRef(); } public override Type MakeArrayType() { return new RuntimeTypeHandle(this).MakeSZArray(); } @@ -4026,7 +3978,6 @@ namespace System } public override StructLayoutAttribute StructLayoutAttribute { - [System.Security.SecuritySafeCritical] // overrides transparent public member get { return (StructLayoutAttribute)StructLayoutAttribute.GetCustomAttribute(this); @@ -4048,15 +3999,12 @@ namespace System BindingFlags.PutDispProperty | BindingFlags.PutRefDispProperty; private static RuntimeType s_typedRef = (RuntimeType)typeof(TypedReference); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static private extern bool CanValueSpecialCast(RuntimeType valueType, RuntimeType targetType); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static private extern Object AllocateValueType(RuntimeType type, object value, bool fForceTypeChange); - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe Object CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) { // this method is used by invocation in reflection to check whether a value can be assigned to type. @@ -4126,7 +4074,6 @@ namespace System } // Factored out of CheckValue to reduce code complexity. - [System.Security.SecurityCritical] private Object TryChangeType(Object value, Binder binder, CultureInfo culture, bool needsSpecialCast) { if (binder != null && binder != Type.DefaultBinder) @@ -4185,7 +4132,6 @@ namespace System } #if FEATURE_COMINTEROP - [System.Security.SecuritySafeCritical] // auto-generated #endif [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] @@ -4681,7 +4627,6 @@ namespace System #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) @@ -4693,13 +4638,11 @@ namespace System #endregion #region ICustomAttributeProvider - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, RuntimeType.ObjectType, inherit); } - [System.Security.SecuritySafeCritical] // auto-generated public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { if ((object)attributeType == null) @@ -4714,7 +4657,6 @@ namespace System return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit); } - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsDefined(Type attributeType, bool inherit) { if ((object)attributeType == null) @@ -4816,7 +4758,6 @@ namespace System public override int MetadataToken { - [System.Security.SecuritySafeCritical] // auto-generated get { return RuntimeTypeHandle.GetToken(this); @@ -4844,7 +4785,6 @@ namespace System throw new NotSupportedException(Environment.GetResourceString("Acc_CreateVoid")); } - [System.Security.SecurityCritical] // auto-generated internal Object CreateInstanceImpl( BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, ref StackCrawlMark stackMark) { @@ -4979,7 +4919,6 @@ namespace System // Lazy initialization was performed internal volatile bool m_bFullyInitialized; - [System.Security.SecurityCritical] internal ActivatorCacheEntry(RuntimeType t, RuntimeMethodHandleInternal rmh, bool bNeedSecurityCheck) { m_type = t; @@ -5013,7 +4952,6 @@ namespace System delegateCtorInfo = ctorInfo; // this assignment should be last } - [System.Security.SecuritySafeCritical] // auto-generated private void InitializeCacheEntry(ActivatorCacheEntry ace) { if (!ace.m_type.IsValueType) @@ -5060,7 +4998,6 @@ namespace System private static volatile ActivatorCache s_ActivatorCache; // the slow path of CreateInstanceDefaultCtor - [System.Security.SecuritySafeCritical] // auto-generated internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark) { RuntimeMethodHandleInternal runtime_ctor = default(RuntimeMethodHandleInternal); @@ -5114,7 +5051,6 @@ namespace System // Helper to invoke the default (parameterless) ctor. // fillCache is set in the SL2/3 compat mode or when called from Marshal.PtrToStructure. - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal Object CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark) @@ -5172,7 +5108,6 @@ namespace System Cache.InvalidateCachedNestedType(); } - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsGenericCOMObjectImpl() { return RuntimeTypeHandle.IsComObject(this, true); @@ -5180,27 +5115,22 @@ namespace System #endregion #region Legacy Static Internal - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Object _CreateEnum(RuntimeType enumType, long value); - [System.Security.SecuritySafeCritical] // auto-generated internal static Object CreateEnum(RuntimeType enumType, long value) { return _CreateEnum(enumType, value); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Object InvokeDispMethod( String name, BindingFlags invokeAttr, Object target, Object[] args, bool[] byrefModifiers, int culture, String[] namedParameters); #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Type GetTypeFromProgIDImpl(String progID, String server, bool throwOnError); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Type GetTypeFromCLSIDImpl(Guid clsid, String server, bool throwOnError); #else // FEATURE_COMINTEROP_UNMANAGED_ACTIVATION @@ -5249,21 +5179,17 @@ namespace System #region Library internal unsafe struct Utf8String { - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern unsafe bool EqualsCaseSensitive(void* szLhs, void* szRhs, int cSz); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern unsafe bool EqualsCaseInsensitive(void* szLhs, void* szRhs, int cSz); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern unsafe uint HashCaseInsensitive(void* sz, int cSz); - [System.Security.SecurityCritical] // auto-generated private static int GetUtf8StringByteLength(void* pUtf8String) { int len = 0; @@ -5282,11 +5208,9 @@ namespace System return len; } - [SecurityCritical] private void* m_pStringHeap; // This is the raw UTF8 string. private int m_StringHeapByteLength; - [System.Security.SecurityCritical] // auto-generated internal Utf8String(void* pStringHeap) { m_pStringHeap = pStringHeap; @@ -5300,14 +5224,12 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated internal unsafe Utf8String(void* pUtf8String, int cUtf8String) { m_pStringHeap = pUtf8String; m_StringHeapByteLength = cUtf8String; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe bool Equals(Utf8String s) { if (m_pStringHeap == null) @@ -5321,7 +5243,6 @@ namespace System return false; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe bool EqualsCaseInsensitive(Utf8String s) { if (m_pStringHeap == null) @@ -5335,13 +5256,11 @@ namespace System return false; } - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe uint HashCaseInsensitive() { return Utf8String.HashCaseInsensitive(m_pStringHeap, m_StringHeapByteLength); } - [System.Security.SecuritySafeCritical] // auto-generated public override string ToString() { unsafe diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs index 11f5327..ce1c07a 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs @@ -59,7 +59,6 @@ namespace System.Runtime.CompilerServices /// Specifies the type of the state machine. /// The state machine instance, passed by reference. /// The argument was null (Nothing in Visual Basic). - [SecuritySafeCritical] [DebuggerStepThrough] public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { @@ -149,7 +148,6 @@ namespace System.Runtime.CompilerServices /// Specifies the type of the state machine. /// The awaiter. /// The state machine. - [SecuritySafeCritical] public void AwaitUnsafeOnCompleted( ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion @@ -294,7 +292,6 @@ namespace System.Runtime.CompilerServices /// Initiates the builder's execution with the associated state machine. /// Specifies the type of the state machine. /// The state machine instance, passed by reference. - [SecuritySafeCritical] [DebuggerStepThrough] public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { @@ -450,7 +447,6 @@ namespace System.Runtime.CompilerServices /// Initiates the builder's execution with the associated state machine. /// Specifies the type of the state machine. /// The state machine instance, passed by reference. - [SecuritySafeCritical] [DebuggerStepThrough] public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { @@ -534,7 +530,6 @@ namespace System.Runtime.CompilerServices /// Specifies the type of the state machine. /// The awaiter. /// The state machine. - [SecuritySafeCritical] public void AwaitUnsafeOnCompleted( ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion @@ -713,7 +708,6 @@ namespace System.Runtime.CompilerServices /// /// The result for which we need a task. /// The completed task containing the result. - [SecuritySafeCritical] // for JitHelpers.UnsafeCast private Task GetTaskForResult(TResult result) { Contract.Ensures( @@ -854,7 +848,6 @@ namespace System.Runtime.CompilerServices /// Specifies the type of the state machine. /// The state machine instance, passed by reference. /// The argument is null (Nothing in Visual Basic). - [SecuritySafeCritical] [DebuggerStepThrough] internal static void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine @@ -902,7 +895,6 @@ namespace System.Runtime.CompilerServices /// The builder. /// The state machine. /// An Action to provide to the awaiter. - [SecuritySafeCritical] internal Action GetCompletionAction(Task taskForTracing, ref MoveNextRunner runnerToInitialize) { Contract.Assert(m_defaultContextAction == null || m_stateMachine != null, @@ -1045,14 +1037,12 @@ namespace System.Runtime.CompilerServices /// Initializes the runner. /// The context with which to run MoveNext. - [SecurityCritical] // Run needs to be SSC to map to Action delegate, so to prevent misuse, we only allow construction through SC internal MoveNextRunnerWithContext(ExecutionContext context, IAsyncStateMachine stateMachine) : base(stateMachine) { m_context = context; } /// Invokes MoveNext under the provided context. - [SecuritySafeCritical] internal void RunWithCapturedContext() { Contract.Assert(m_stateMachine != null, "The state machine must have been set before calling Run."); @@ -1080,14 +1070,12 @@ namespace System.Runtime.CompilerServices internal IAsyncStateMachine m_stateMachine; /// Initializes the runner. - [SecurityCritical] // Run needs to be SSC to map to Action delegate, so to prevent misuse, we only allow construction through SC internal MoveNextRunner(IAsyncStateMachine stateMachine) { m_stateMachine = stateMachine; } /// Invokes MoveNext under the default context. - [SecuritySafeCritical] internal void RunWithDefaultContext() { Contract.Assert(m_stateMachine != null, "The state machine must have been set before calling Run."); @@ -1097,17 +1085,14 @@ namespace System.Runtime.CompilerServices /// Gets a delegate to the InvokeMoveNext method. protected static ContextCallback InvokeMoveNextCallback { - [SecuritySafeCritical] get { return s_invokeMoveNext ?? (s_invokeMoveNext = InvokeMoveNext); } } /// Cached delegate used with ExecutionContext.Run. - [SecurityCritical] private static ContextCallback s_invokeMoveNext; // lazily-initialized due to SecurityCritical attribution /// Invokes the MoveNext method on the supplied IAsyncStateMachine. /// The IAsyncStateMachine machine instance. - [SecurityCritical] // necessary for ContextCallback in CoreCLR private static void InvokeMoveNext(object stateMachine) { ((IAsyncStateMachine)stateMachine).MoveNext(); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs index 872a79b..aba0a06 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs @@ -34,7 +34,6 @@ namespace System.Runtime.CompilerServices /// The action to invoke when the operation completes. /// The argument is null (Nothing in Visual Basic). /// Unlike OnCompleted, UnsafeOnCompleted need not propagate ExecutionContext information. - [SecurityCritical] void UnsafeOnCompleted(Action continuation); } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 507593b..f2f1ba2 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -34,7 +34,6 @@ namespace System.Runtime.CompilerServices { } #endif // FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void InitializeArray(Array array,RuntimeFieldHandle fldHandle); @@ -51,7 +50,6 @@ namespace System.Runtime.CompilerServices { // cloned when you pass them around, and are always passed by value. // Of course, reference types are not cloned. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object GetObjectValue(Object obj); @@ -63,7 +61,6 @@ namespace System.Runtime.CompilerServices { // This call will generate an exception if the specified class constructor threw an // exception when it ran. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _RunClassConstructor(RuntimeType type); @@ -80,7 +77,6 @@ namespace System.Runtime.CompilerServices { // This call will generate an exception if the specified module constructor threw an // exception when it ran. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _RunModuleConstructor(System.Reflection.RuntimeModule module); @@ -90,7 +86,6 @@ namespace System.Runtime.CompilerServices { } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] internal static extern void _CompileMethod(IRuntimeMethodInfo method); @@ -110,12 +105,10 @@ namespace System.Runtime.CompilerServices { #else - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static unsafe extern void _PrepareMethod(IRuntimeMethodInfo method, IntPtr* pInstantiation, int cInstantiation); // Simple (instantiation not required) method. - [System.Security.SecurityCritical] // auto-generated_required public static void PrepareMethod(RuntimeMethodHandle method) { unsafe @@ -125,7 +118,6 @@ namespace System.Runtime.CompilerServices { } // Generic method or method with generic class with specific instantiation. - [System.Security.SecurityCritical] // auto-generated_required public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) { unsafe @@ -148,7 +140,6 @@ namespace System.Runtime.CompilerServices { // then the result is fully prepared. But if a client calls Combine himself and then // then adds that combination to e.g. AppDomain.DomainUnload, then the client is responsible // for his own preparation. - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void PrepareDelegate(Delegate d); @@ -162,15 +153,12 @@ namespace System.Runtime.CompilerServices { // // NOTE: that for the NGen case you can sidestep the required ReliabilityContract // by using the [PrePrepareMethod] attribute. - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void PrepareContractedDelegate(Delegate d); #endif - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetHashCode(Object o); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public new static extern bool Equals(Object o1, Object o2); @@ -199,7 +187,6 @@ namespace System.Runtime.CompilerServices { // If there is not enough stack, then it throws System.InsufficientExecutionStackException. // Note: this method is not part of the CER support, and is not to be confused with ProbeForSufficientStack // below. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern void EnsureSufficientExecutionStack(); @@ -208,7 +195,6 @@ namespace System.Runtime.CompilerServices { // If there is not enough stack, then it return false. // Note: this method is not part of the CER support, and is not to be confused with ProbeForSufficientStack // below. - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern bool TryEnsureSufficientExecutionStack(); @@ -218,7 +204,6 @@ namespace System.Runtime.CompilerServices { { } #else - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static extern void ProbeForSufficientStack(); @@ -226,7 +211,6 @@ namespace System.Runtime.CompilerServices { // This method is a marker placed immediately before a try clause to mark the corresponding catch and finally blocks as // constrained. There's no code here other than the probe because most of the work is done at JIT time when we spot a call to this routine. - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static void PrepareConstrainedRegions() { @@ -235,29 +219,18 @@ namespace System.Runtime.CompilerServices { // When we detect a CER with no calls, we can point the JIT to this non-probing version instead // as we don't need to probe. - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static void PrepareConstrainedRegionsNoOP() { } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public delegate void TryCode(Object userData); - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public delegate void CleanupCode(Object userData, bool exceptionThrown); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData); -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif [PrePrepareMethod] internal static void ExecuteBackoutCodeHelper(Object backoutCode, Object userData, bool exceptionThrown) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs index 8eb7435..d2691df 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs @@ -33,7 +33,6 @@ namespace System.Runtime.CompilerServices { private Object m_wrappedException; - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs index 874895f..f077487 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs @@ -84,7 +84,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecuritySafeCritical] public void OnCompleted(Action continuation) { OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:true); @@ -95,7 +94,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:false); @@ -202,7 +200,6 @@ namespace System.Runtime.CompilerServices /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable - [SecurityCritical] internal static void OnCompletedInternal(Task task, Action continuation, bool continueOnCapturedContext, bool flowExecutionContext) { if (continuation == null) throw new ArgumentNullException(nameof(continuation)); @@ -321,7 +318,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecuritySafeCritical] public void OnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:true); @@ -332,7 +328,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:false); @@ -411,7 +406,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecuritySafeCritical] public void OnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:true); @@ -422,7 +416,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:false); @@ -499,7 +492,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecuritySafeCritical] public void OnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:true); @@ -510,7 +502,6 @@ namespace System.Runtime.CompilerServices /// The argument is null (Nothing in Visual Basic). /// The awaiter was not properly initialized. /// This method is intended for compiler user rather than use directly in code. - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:false); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs index 034dad1..d9e067b 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs @@ -26,7 +26,6 @@ namespace System.Runtime.CompilerServices } } - [System.Security.SecurityCritical] internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly) { Type[] types = null; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs index dec3388..5881b64 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs @@ -58,7 +58,6 @@ namespace System.Runtime.CompilerServices /// Posts the back to the current context. /// The action to invoke asynchronously. /// The argument is null (Nothing in Visual Basic). - [SecuritySafeCritical] public void OnCompleted(Action continuation) { QueueContinuation(continuation, flowContext: true); @@ -67,7 +66,6 @@ namespace System.Runtime.CompilerServices /// Posts the back to the current context. /// The action to invoke asynchronously. /// The argument is null (Nothing in Visual Basic). - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { QueueContinuation(continuation, flowContext: false); @@ -77,7 +75,6 @@ namespace System.Runtime.CompilerServices /// The action to invoke asynchronously. /// true to flow ExecutionContext; false if flowing is not required. /// The argument is null (Nothing in Visual Basic). - [SecurityCritical] private static void QueueContinuation(Action continuation, bool flowContext) { // Validate arguments diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs index a4c67aa..6c0f97d 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs @@ -74,7 +74,6 @@ namespace System.Runtime.CompilerServices { // Wraps object variable into a handle. Used to return managed strings from QCalls. // s has to be a local variable on the stack. - [SecurityCritical] static internal StringHandleOnStack GetStringHandleOnStack(ref string s) { return new StringHandleOnStack(UnsafeCastToStackPointer(ref s)); @@ -82,7 +81,6 @@ namespace System.Runtime.CompilerServices { // Wraps object variable into a handle. Used to pass managed object references in and out of QCalls. // o has to be a local variable on the stack. - [SecurityCritical] static internal ObjectHandleOnStack GetObjectHandleOnStack(ref T o) where T : class { return new ObjectHandleOnStack(UnsafeCastToStackPointer(ref o)); @@ -90,14 +88,12 @@ namespace System.Runtime.CompilerServices { // Wraps StackCrawlMark into a handle. Used to pass StackCrawlMark to QCalls. // stackMark has to be a local variable on the stack. - [SecurityCritical] static internal StackCrawlMarkHandle GetStackCrawlMarkHandle(ref StackCrawlMark stackMark) { return new StackCrawlMarkHandle(UnsafeCastToStackPointer(ref stackMark)); } #if _DEBUG - [SecurityCritical] [FriendAccessAllowed] static internal T UnsafeCast(Object o) where T : class { @@ -108,7 +104,6 @@ namespace System.Runtime.CompilerServices { // The IL body of this method is not critical, but its body will be replaced with unsafe code, so // this method is effectively critical - [SecurityCritical] static private T UnsafeCastInternal(Object o) where T : class { // The body of this function will be replaced by the EE with unsafe code that just returns o!!! @@ -154,7 +149,6 @@ namespace System.Runtime.CompilerServices { // Internal method for getting a raw pointer for handles in JitHelpers. // The reference has to point into a local stack variable in order so it can not be moved by the GC. - [SecurityCritical] static internal IntPtr UnsafeCastToStackPointer(ref T val) { IntPtr p = UnsafeCastToStackPointerInternal(ref val); @@ -162,7 +156,6 @@ namespace System.Runtime.CompilerServices { return p; } - [SecurityCritical] static private IntPtr UnsafeCastToStackPointerInternal(ref T val) { // The body of this function will be replaced by the EE with unsafe code that just returns val!!! @@ -172,7 +165,6 @@ namespace System.Runtime.CompilerServices { #else // _DEBUG // The IL body of this method is not critical, but its body will be replaced with unsafe code, so // this method is effectively critical - [SecurityCritical] [FriendAccessAllowed] static internal T UnsafeCast(Object o) where T : class { @@ -195,7 +187,6 @@ namespace System.Runtime.CompilerServices { throw new InvalidOperationException(); } - [SecurityCritical] static internal IntPtr UnsafeCastToStackPointer(ref T val) { // The body of this function will be replaced by the EE with unsafe code that just returns o!!! @@ -205,12 +196,10 @@ namespace System.Runtime.CompilerServices { #endif // _DEBUG // Set the given element in the array without any type or range checks - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static internal void UnsafeSetArrayElement(Object[] target, int index, Object element); // Used for unsafe pinning of arbitrary objects. - [System.Security.SecurityCritical] // auto-generated static internal PinningHelper GetPinningHelper(Object o) { // This cast is really unsafe - call the private version that does not assert in debug @@ -222,7 +211,6 @@ namespace System.Runtime.CompilerServices { } #if _DEBUG - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static bool IsAddressInStack(IntPtr ptr); #endif diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/GcSettings.cs b/src/coreclr/src/mscorlib/src/System/Runtime/GcSettings.cs index 5b4be27..fc70183 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/GcSettings.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/GcSettings.cs @@ -40,7 +40,6 @@ namespace System.Runtime { public static GCLatencyMode LatencyMode { - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] get { @@ -48,7 +47,6 @@ namespace System.Runtime { } // We don't want to allow this API when hosted. - [System.Security.SecurityCritical] // auto-generated_required [HostProtection(MayLeakOnAbort = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] set @@ -66,7 +64,6 @@ namespace System.Runtime { public static GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] get { @@ -74,7 +71,6 @@ namespace System.Runtime { } // We don't want to allow this API when hosted. - [System.Security.SecurityCritical] // auto-generated_required [HostProtection(MayLeakOnAbort = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] set @@ -92,7 +88,6 @@ namespace System.Runtime { public static bool IsServerGC { - [System.Security.SecuritySafeCritical] // auto-generated get { return GC.IsServerGC(); } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs index 83eae1c..77db3a7 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs @@ -17,7 +17,6 @@ namespace System.Runtime.InteropServices { // throw new Exception(); //} - [System.Security.SecuritySafeCritical] // auto-generated public ArrayWithOffset(Object array, int offset) { m_array = array; @@ -64,7 +63,6 @@ namespace System.Runtime.InteropServices { return !(a == b); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern int CalculateCount(); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs index 06c963a..08d3694 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs @@ -525,31 +525,26 @@ namespace System.Runtime.InteropServices{ [System.Runtime.InteropServices.ComVisible(true)] public unsafe sealed class MarshalAsAttribute : Attribute { - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter) { return GetCustomAttribute(parameter.MetadataToken, parameter.GetRuntimeModule()); } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeParameterInfo parameter) { return GetCustomAttribute(parameter) != null; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeFieldInfo field) { return GetCustomAttribute(field.MetadataToken, field.GetRuntimeModule()); ; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field) { return GetCustomAttribute(field) != null; } - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(int token, RuntimeModule scope) { UnmanagedType unmanagedType, arraySubType; @@ -772,7 +767,6 @@ namespace System.Runtime.InteropServices{ [System.Runtime.InteropServices.ComVisible(true)] public unsafe sealed class DllImportAttribute : Attribute { - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeMethodInfo method) { if ((method.Attributes & MethodAttributes.PinvokeImpl) == 0) @@ -869,7 +863,6 @@ namespace System.Runtime.InteropServices{ { private const int DEFAULT_PACKING_SIZE = 8; - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeType type) { if (!IsDefined(type)) @@ -940,7 +933,6 @@ namespace System.Runtime.InteropServices{ [System.Runtime.InteropServices.ComVisible(true)] public unsafe sealed class FieldOffsetAttribute : Attribute { - [System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeFieldInfo field) { int fieldOffset; @@ -952,7 +944,6 @@ namespace System.Runtime.InteropServices{ return null; } - [System.Security.SecurityCritical] // auto-generated internal static bool IsDefined(RuntimeFieldInfo field) { return GetCustomAttribute(field) != null; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs index 58e93a8..1673c91 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs @@ -21,19 +21,11 @@ namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(true)] public sealed class BStrWrapper { - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand,Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public BStrWrapper(String value) { m_WrappedObject = value; } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public BStrWrapper(Object value) { m_WrappedObject = (String)value; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs index 95b925c..fd500fd 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs @@ -46,7 +46,6 @@ namespace System.Runtime.InteropServices { SetErrorCode(errorCode); } - [SecuritySafeCritical] internal COMException(int hresult) : base(Win32Native.GetMessage(hresult)) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs index 4230428..82692c1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs @@ -115,7 +115,6 @@ namespace System.Runtime.InteropServices { /// identifier of the source interface used by COM object to fire events /// dispatch identifier of the method on the source interface /// delegate to invoke when specifed COM event is fired - [System.Security.SecurityCritical] public static void Combine(object rcw, Guid iid, int dispid, System.Delegate d) { rcw = UnwrapIfTransparentProxy(rcw); @@ -146,7 +145,6 @@ namespace System.Runtime.InteropServices { /// dispatch identifier of the method on the source interface /// delegate to remove from the invocation list /// - [System.Security.SecurityCritical] public static Delegate Remove(object rcw, Guid iid, int dispid, System.Delegate d) { rcw = UnwrapIfTransparentProxy(rcw); @@ -183,7 +181,6 @@ namespace System.Runtime.InteropServices { } } - [System.Security.SecurityCritical] internal static object UnwrapIfTransparentProxy(object rcw) { return rcw; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs index 6feb524..2456ba3 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs @@ -17,7 +17,6 @@ namespace System.Runtime.InteropServices { using ComTypes = System.Runtime.InteropServices.ComTypes; // see code:ComEventsHelper#ComEventsArchitecture - [System.Security.SecurityCritical] internal class ComEventsInfo { @@ -35,7 +34,6 @@ namespace System.Runtime.InteropServices { _rcw = rcw; } - [System.Security.SecuritySafeCritical] ~ComEventsInfo() { // see code:ComEventsHelper#ComEventsFinalization _sinks = ComEventsSink.RemoveAll(_sinks); @@ -46,13 +44,11 @@ namespace System.Runtime.InteropServices { #region static methods - [System.Security.SecurityCritical] internal static ComEventsInfo Find(object rcw) { return (ComEventsInfo)Marshal.GetComObjectData(rcw, typeof(ComEventsInfo)); } // it is caller's responsibility to call this method under lock(rcw) - [System.Security.SecurityCritical] internal static ComEventsInfo FromObject(object rcw) { ComEventsInfo eventsInfo = Find(rcw); if (eventsInfo == null) { @@ -80,7 +76,6 @@ namespace System.Runtime.InteropServices { } // it is caller's responsibility to call this method under lock(rcw) - [System.Security.SecurityCritical] internal ComEventsSink RemoveSink(ComEventsSink sink) { _sinks = ComEventsSink.Remove(_sinks, sink); return _sinks; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs index a414eff..05978a6 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs @@ -16,7 +16,6 @@ namespace System.Runtime.InteropServices { using System.Diagnostics; // see code:ComEventsHelper#ComEventsArchitecture - [System.Security.SecurityCritical] internal class ComEventsSink : NativeMethods.IDispatch, ICustomQueryInterface { #region private fields @@ -57,7 +56,6 @@ namespace System.Runtime.InteropServices { return sink; } - [System.Security.SecurityCritical] internal static ComEventsSink RemoveAll(ComEventsSink sinks) { while (sinks != null) { sinks.Unadvise(); @@ -67,7 +65,6 @@ namespace System.Runtime.InteropServices { return null; } - [System.Security.SecurityCritical] internal static ComEventsSink Remove(ComEventsSink sinks, ComEventsSink sink) { BCLDebug.Assert(sinks != null, "removing event sink from empty sinks collection"); BCLDebug.Assert(sink != null, "specify event sink is null"); @@ -114,17 +111,14 @@ namespace System.Runtime.InteropServices { #region IDispatch Members - [System.Security.SecurityCritical] void NativeMethods.IDispatch.GetTypeInfoCount(out uint pctinfo) { pctinfo = 0; } - [System.Security.SecurityCritical] void NativeMethods.IDispatch.GetTypeInfo(uint iTInfo, int lcid, out IntPtr info) { throw new NotImplementedException(); } - [System.Security.SecurityCritical] void NativeMethods.IDispatch.GetIDsOfNames(ref Guid iid, string[] names, uint cNames, int lcid, int[] rgDispId) { throw new NotImplementedException(); } @@ -149,7 +143,6 @@ namespace System.Runtime.InteropServices { return pSrc; } - [System.Security.SecurityCritical] unsafe void NativeMethods.IDispatch.Invoke( int dispid, ref Guid riid, @@ -233,7 +226,6 @@ namespace System.Runtime.InteropServices { static Guid IID_IManagedObject = new Guid("{C3FCC19E-A970-11D2-8B5A-00A0C9B7C9C4}"); - [System.Security.SecurityCritical] CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out IntPtr ppv) { ppv = IntPtr.Zero; if (iid == this._iidSourceItf || iid == typeof(NativeMethods.IDispatch).GUID) { @@ -265,7 +257,6 @@ namespace System.Runtime.InteropServices { _connectionPoint = cp; } - [System.Security.SecurityCritical] private void Unadvise() { BCLDebug.Assert(_connectionPoint != null, "can not unadvise from empty connection point"); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs index 54fd6b0..10d7996 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs @@ -139,9 +139,7 @@ namespace System.Runtime.InteropServices // we'll do this to ensure we've cut off all attack vectors. Similarly, all // methods have a link demand to ensure untrusted code cannot directly edit // or alter a handle. -[System.Security.SecurityCritical] // auto-generated_required #if !FEATURE_CORECLR -[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] #endif public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable { @@ -173,14 +171,12 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable private CriticalHandle(){} #endif - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] ~CriticalHandle() { Dispose(false); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private void Cleanup() { @@ -229,20 +225,17 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable get; } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void Close() { Dispose(true); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void Dispose() { Dispose(true); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] protected virtual void Dispose(bool disposing) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs index 1fc72f7..47b7542 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs @@ -21,10 +21,6 @@ namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(true)] public sealed class DispatchWrapper { - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand,Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public DispatchWrapper(Object obj) { if (obj != null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs index aebc858..a9fa58f 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs @@ -32,10 +32,6 @@ namespace System.Runtime.InteropServices { m_ErrorCode = (int)errorCode; } - [System.Security.SecuritySafeCritical] // auto-generated -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public ErrorWrapper(Exception e) { m_ErrorCode = Marshal.GetHRForException(e); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs index 62718de..a12a38e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs @@ -34,7 +34,6 @@ namespace System.Runtime.InteropServices { // class for which the callbacks will be made. // It is not legal to register this callback from a class that has any // parents that have already registered a callback. - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void RegisterObjectCreationCallback(ObjectCreationDelegate callback); } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs index f1a8804..5530819 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs @@ -47,7 +47,6 @@ namespace System.Runtime.InteropServices private const GCHandleType MaxHandleType = GCHandleType.Pinned; #if MDA_SUPPORTED - [System.Security.SecuritySafeCritical] // auto-generated static GCHandle() { s_probeIsActive = Mda.IsInvalidGCHandleCookieProbeEnabled(); @@ -57,7 +56,6 @@ namespace System.Runtime.InteropServices #endif // Allocate a handle storing the object and the type. - [System.Security.SecurityCritical] // auto-generated internal GCHandle(Object value, GCHandleType type) { // Make sure the type parameter is within the valid range for the enum. @@ -73,7 +71,6 @@ namespace System.Runtime.InteropServices } // Used in the conversion functions below. - [System.Security.SecurityCritical] // auto-generated internal GCHandle(IntPtr handle) { InternalCheckDomain(handle); @@ -86,13 +83,11 @@ namespace System.Runtime.InteropServices // type - The type of GC handle to create. // // returns a new GC handle that protects the object. - [System.Security.SecurityCritical] // auto-generated_required public static GCHandle Alloc(Object value) { return new GCHandle(value, GCHandleType.Normal); } - [System.Security.SecurityCritical] // auto-generated_required public static GCHandle Alloc(Object value, GCHandleType type) { return new GCHandle(value, type); @@ -100,7 +95,6 @@ namespace System.Runtime.InteropServices // Frees a GC handle. - [System.Security.SecurityCritical] // auto-generated_required public void Free() { // Copy the handle instance member to a local variable. This is required to prevent @@ -134,7 +128,6 @@ namespace System.Runtime.InteropServices // Target property - allows getting / updating of the handle's referent. public Object Target { - [System.Security.SecurityCritical] // auto-generated_required get { // Check if the handle was never initialized or was freed. @@ -144,7 +137,6 @@ namespace System.Runtime.InteropServices return InternalGet(GetHandleValue()); } - [System.Security.SecurityCritical] // auto-generated_required set { // Check if the handle was never initialized or was freed. @@ -157,7 +149,6 @@ namespace System.Runtime.InteropServices // Retrieve the address of an object in a Pinned handle. This throws // an exception if the handle is any type other than Pinned. - [System.Security.SecurityCritical] // auto-generated_required public IntPtr AddrOfPinnedObject() { // Check if the handle was not a pinned handle. @@ -186,13 +177,11 @@ namespace System.Runtime.InteropServices // Used to create a GCHandle from an int. This is intended to // be used with the reverse conversion. - [System.Security.SecurityCritical] // auto-generated_required public static explicit operator GCHandle(IntPtr value) { return FromIntPtr(value); } - [System.Security.SecurityCritical] // auto-generated_required public static GCHandle FromIntPtr(IntPtr value) { if (value == IntPtr.Zero) @@ -293,28 +282,20 @@ namespace System.Runtime.InteropServices } // Internal native calls that this implementation uses. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern IntPtr InternalAlloc(Object value, GCHandleType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InternalFree(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object InternalGet(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InternalSet(IntPtr handle, Object value, bool isPinned); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object InternalCompareExchange(IntPtr handle, Object value, Object oldValue, bool isPinned); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern IntPtr InternalAddrOfPinnedObject(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InternalCheckDomain(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern GCHandleType InternalGetHandleType(IntPtr handle); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs index 61688b9..c7d7937 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs @@ -33,7 +33,6 @@ namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(false)] public interface ICustomQueryInterface { - [System.Security.SecurityCritical] CustomQueryInterfaceResult GetInterface([In]ref Guid iid, out IntPtr ppv); } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs index 2da0a56..9d5b239 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs @@ -51,16 +51,9 @@ namespace System.Runtime.InteropServices { } String Source { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif get; - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif set; } - [System.Security.SecurityCritical] // auto-generated_required void GetObjectData(SerializationInfo info, StreamingContext context); #endif diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs index ae330e8..f2f7c61 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs @@ -31,24 +31,18 @@ namespace System.Runtime.InteropServices { [System.Runtime.InteropServices.ComVisible(true)] public interface IRegistrationServices { - [System.Security.SecurityCritical] // auto-generated_required bool RegisterAssembly(Assembly assembly, AssemblyRegistrationFlags flags); - [System.Security.SecurityCritical] // auto-generated_required bool UnregisterAssembly(Assembly assembly); - [System.Security.SecurityCritical] // auto-generated_required Type[] GetRegistrableTypesInAssembly(Assembly assembly); - [System.Security.SecurityCritical] // auto-generated_required String GetProgIdForType(Type type); - [System.Security.SecurityCritical] // auto-generated_required void RegisterTypeForComClients(Type type, ref Guid g); Guid GetManagedCategoryGuid(); - [System.Security.SecurityCritical] // auto-generated_required bool TypeRequiresRegistration(Type type); bool TypeRepresentsComType(Type type); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs index 6e8f2bc..d89fd3f 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs @@ -45,9 +45,6 @@ namespace System.Runtime.InteropServices // declaration on the class. //======================================================================== - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif public static partial class Marshal { //==================================================================== @@ -117,7 +114,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int GetSystemMaxDBCSCharSize(); - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringAnsi(IntPtr ptr) { if (IntPtr.Zero == ptr) { @@ -137,7 +133,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringAnsi(IntPtr ptr, int len) { if (ptr == IntPtr.Zero) @@ -148,7 +143,6 @@ namespace System.Runtime.InteropServices return new String((sbyte *)ptr, 0, len); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringUni(IntPtr ptr, int len) { if (ptr == IntPtr.Zero) @@ -159,14 +153,12 @@ namespace System.Runtime.InteropServices return new String((char *)ptr, 0, len); } - [System.Security.SecurityCritical] // auto-generated_required public static String PtrToStringAuto(IntPtr ptr, int len) { // Ansi platforms are no longer supported return PtrToStringUni(ptr, len); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringUni(IntPtr ptr) { if (IntPtr.Zero == ptr) { @@ -180,21 +172,18 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static String PtrToStringAuto(IntPtr ptr) { // Ansi platforms are no longer supported return PtrToStringUni(ptr); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringUTF8(IntPtr ptr) { int nbBytes = System.StubHelpers.StubHelpers.strlen((sbyte*)ptr.ToPointer()); return PtrToStringUTF8(ptr, nbBytes); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static String PtrToStringUTF8(IntPtr ptr,int byteLen) { if (byteLen < 0) @@ -291,7 +280,6 @@ namespace System.Runtime.InteropServices private static extern uint AlignedSizeOfType(Type type); #if !FEATURE_CORECLR // Marshal is critical in CoreCLR, so SafeCritical members trigger Annotator violations - [System.Security.SecuritySafeCritical] #endif // !FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int SizeOfHelper(Type t, bool throwIfNotMarshalable); @@ -330,11 +318,9 @@ namespace System.Runtime.InteropServices // an array that is not pinned or in the fixed heap can cause // unexpected results ! //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr UnsafeAddrOfPinnedArrayElement(Array arr, int index); - [System.Security.SecurityCritical] public static IntPtr UnsafeAddrOfPinnedArrayElement(T[] arr, int index) { return UnsafeAddrOfPinnedArrayElement((Array)arr, index); @@ -343,42 +329,34 @@ namespace System.Runtime.InteropServices //==================================================================== // Copy blocks from CLR arrays to native memory. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(int[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(char[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(short[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(long[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(float[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(double[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(byte[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr[] source, int startIndex, IntPtr destination, int length) { CopyToNative(source, startIndex, destination, length); @@ -389,42 +367,34 @@ namespace System.Runtime.InteropServices //==================================================================== // Copy blocks from native memory to CLR arrays //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, int[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, char[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, short[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, long[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, float[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, double[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, byte[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); } - [System.Security.SecurityCritical] // auto-generated_required public static void Copy(IntPtr source, IntPtr[] destination, int startIndex, int length) { CopyToManaged(source, destination, startIndex, length); @@ -435,7 +405,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Read from memory //==================================================================== - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_RU1")] [SuppressUnmanagedCodeSecurity] @@ -447,7 +416,6 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static unsafe byte ReadByte(IntPtr ptr, int ofs) { try @@ -462,13 +430,11 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static byte ReadByte(IntPtr ptr) { return ReadByte(ptr,0); } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_RI2")] [SuppressUnmanagedCodeSecurity] @@ -480,7 +446,6 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static unsafe short ReadInt16(IntPtr ptr, int ofs) { try @@ -508,13 +473,11 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static short ReadInt16(IntPtr ptr) { return ReadInt16(ptr, 0); } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_RI4"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [SuppressUnmanagedCodeSecurity] @@ -526,7 +489,6 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static unsafe int ReadInt32(IntPtr ptr, int ofs) { @@ -557,14 +519,12 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int ReadInt32(IntPtr ptr) { return ReadInt32(ptr,0); } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static IntPtr ReadIntPtr([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs) { @@ -575,7 +535,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static IntPtr ReadIntPtr(IntPtr ptr, int ofs) { @@ -586,7 +545,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static IntPtr ReadIntPtr(IntPtr ptr) { @@ -597,7 +555,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_RI8"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [SuppressUnmanagedCodeSecurity] @@ -609,7 +566,6 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static unsafe long ReadInt64(IntPtr ptr, int ofs) { try @@ -643,7 +599,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static long ReadInt64(IntPtr ptr) { @@ -654,7 +609,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Write to memory //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static unsafe void WriteByte(IntPtr ptr, int ofs, byte val) { try @@ -669,7 +623,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_WU1")] [SuppressUnmanagedCodeSecurity] @@ -681,13 +634,11 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static void WriteByte(IntPtr ptr, byte val) { WriteByte(ptr, 0, val); } - [System.Security.SecurityCritical] // auto-generated_required public static unsafe void WriteInt16(IntPtr ptr, int ofs, short val) { try @@ -713,7 +664,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_WI2")] [SuppressUnmanagedCodeSecurity] @@ -725,31 +675,26 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt16(IntPtr ptr, short val) { WriteInt16(ptr, 0, val); } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt16(IntPtr ptr, int ofs, char val) { WriteInt16(ptr, ofs, (short)val); } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt16([In,Out]Object ptr, int ofs, char val) { WriteInt16(ptr, ofs, (short)val); } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt16(IntPtr ptr, char val) { WriteInt16(ptr, 0, (short)val); } - [System.Security.SecurityCritical] // auto-generated_required public static unsafe void WriteInt32(IntPtr ptr, int ofs, int val) { try @@ -777,7 +722,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_WI4")] [SuppressUnmanagedCodeSecurity] @@ -789,13 +733,11 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt32(IntPtr ptr, int val) { WriteInt32(ptr,0,val); } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteIntPtr(IntPtr ptr, int ofs, IntPtr val) { #if BIT64 @@ -805,7 +747,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteIntPtr([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, IntPtr val) { #if BIT64 @@ -815,7 +756,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required public static void WriteIntPtr(IntPtr ptr, IntPtr val) { #if BIT64 @@ -825,7 +765,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required public static unsafe void WriteInt64(IntPtr ptr, int ofs, long val) { try @@ -857,7 +796,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated #if !FEATURE_CORECLR [DllImport(Win32Native.SHIM, EntryPoint="ND_WI8")] [SuppressUnmanagedCodeSecurity] @@ -869,7 +807,6 @@ namespace System.Runtime.InteropServices } #endif // !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated_required public static void WriteInt64(IntPtr ptr, long val) { WriteInt64(ptr, 0, val); @@ -879,7 +816,6 @@ namespace System.Runtime.InteropServices //==================================================================== // GetLastWin32Error //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern int GetLastWin32Error(); @@ -896,7 +832,6 @@ namespace System.Runtime.InteropServices //==================================================================== // GetHRForLastWin32Error //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int GetHRForLastWin32Error() { @@ -911,7 +846,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Prelink //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static void Prelink(MethodInfo m) { if (m == null) @@ -927,10 +861,8 @@ namespace System.Runtime.InteropServices } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] - [SecurityCritical] private static extern void InternalPrelink(IRuntimeMethodInfo m); - [System.Security.SecurityCritical] // auto-generated_required public static void PrelinkAll(Type c) { if (c == null) @@ -950,7 +882,6 @@ namespace System.Runtime.InteropServices //==================================================================== // NumParamBytes //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static int NumParamBytes(MethodInfo m) { if (m == null) @@ -965,7 +896,6 @@ namespace System.Runtime.InteropServices } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] - [SecurityCritical] private static extern int InternalNumParamBytes(IRuntimeMethodInfo m); //==================================================================== @@ -973,12 +903,10 @@ namespace System.Runtime.InteropServices // These are mostly interesting for Structured exception handling, // but need to be exposed for all exceptions (not just SEHException). //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [System.Runtime.InteropServices.ComVisible(true)] public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers(); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetExceptionCode(); @@ -988,12 +916,10 @@ namespace System.Runtime.InteropServices // If the structure contains pointers to allocated blocks and // "fDeleteOld" is true, this routine will call DestroyStructure() first. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [System.Runtime.InteropServices.ComVisible(true)] public static extern void StructureToPtr(Object structure, IntPtr ptr, bool fDeleteOld); - [System.Security.SecurityCritical] public static void StructureToPtr(T structure, IntPtr ptr, bool fDeleteOld) { StructureToPtr((object)structure, ptr, fDeleteOld); @@ -1002,14 +928,12 @@ namespace System.Runtime.InteropServices //==================================================================== // Marshals data from a native memory block to a preallocated structure class. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [System.Runtime.InteropServices.ComVisible(true)] public static void PtrToStructure(IntPtr ptr, Object structure) { PtrToStructureHelper(ptr, structure, false); } - [System.Security.SecurityCritical] public static void PtrToStructure(IntPtr ptr, T structure) { PtrToStructure(ptr, (object)structure); @@ -1019,7 +943,6 @@ namespace System.Runtime.InteropServices // Creates a new instance of "structuretype" and marshals data from a // native memory block to it. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [System.Runtime.InteropServices.ComVisible(true)] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static Object PtrToStructure(IntPtr ptr, Type structureType) @@ -1044,7 +967,6 @@ namespace System.Runtime.InteropServices return structure; } - [System.Security.SecurityCritical] public static T PtrToStructure(IntPtr ptr) { return (T)PtrToStructure(ptr, typeof(T)); @@ -1061,12 +983,10 @@ namespace System.Runtime.InteropServices // Freeds all substructures pointed to by the native memory block. // "structureclass" is used to provide layout information. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [System.Runtime.InteropServices.ComVisible(true)] public static extern void DestroyStructure(IntPtr ptr, Type structuretype); - [System.Security.SecurityCritical] public static void DestroyStructure(IntPtr ptr) { DestroyStructure(ptr, typeof(T)); @@ -1078,7 +998,6 @@ namespace System.Runtime.InteropServices // doesn't have an HInstance. In Memory (Dynamic) Modules won't have // an HInstance. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr GetHINSTANCE(Module m) { if (m == null) @@ -1099,7 +1018,6 @@ namespace System.Runtime.InteropServices return GetHINSTANCE(rtModule.GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated_required [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private extern static IntPtr GetHINSTANCE(RuntimeModule m); @@ -1108,13 +1026,11 @@ namespace System.Runtime.InteropServices //==================================================================== // Throws a CLR exception based on the HRESULT. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static void ThrowExceptionForHR(int errorCode) { if (errorCode < 0) ThrowExceptionForHRInternal(errorCode, IntPtr.Zero); } - [System.Security.SecurityCritical] // auto-generated_required public static void ThrowExceptionForHR(int errorCode, IntPtr errorInfo) { if (errorCode < 0) @@ -1128,7 +1044,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Converts the HRESULT to a CLR exception. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Exception GetExceptionForHR(int errorCode) { if (errorCode < 0) @@ -1136,7 +1051,6 @@ namespace System.Runtime.InteropServices else return null; } - [System.Security.SecurityCritical] // auto-generated_required public static Exception GetExceptionForHR(int errorCode, IntPtr errorInfo) { if (errorCode < 0) @@ -1153,7 +1067,6 @@ namespace System.Runtime.InteropServices // This method is intended for compiler code generators rather // than applications. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [ObsoleteAttribute("The GetUnmanagedThunkForManagedMethodPtr method has been deprecated and will be removed in a future release.", false)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr GetUnmanagedThunkForManagedMethodPtr(IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature); @@ -1162,7 +1075,6 @@ namespace System.Runtime.InteropServices // This method is intended for compiler code generators rather // than applications. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [ObsoleteAttribute("The GetManagedThunkForUnmanagedMethodPtr method has been deprecated and will be removed in a future release.", false)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr GetManagedThunkForUnmanagedMethodPtr(IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature); @@ -1173,7 +1085,6 @@ namespace System.Runtime.InteropServices // activity. A fiber cookie can be redeemed for its managed Thread // object by calling the following service. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [ObsoleteAttribute("The GetThreadFromFiberCookie method has been deprecated. Use the hosting API to perform this operation.", false)] public static Thread GetThreadFromFiberCookie(int cookie) { @@ -1191,7 +1102,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Memory allocation and deallocation. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static IntPtr AllocHGlobal(IntPtr cb) { @@ -1216,14 +1126,12 @@ namespace System.Runtime.InteropServices return pNewMem; } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static IntPtr AllocHGlobal(int cb) { return AllocHGlobal((IntPtr)cb); } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static void FreeHGlobal(IntPtr hglobal) { @@ -1234,7 +1142,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb) { IntPtr pNewMem = Win32Native.LocalReAlloc(pv, cb, LMEM_MOVEABLE); @@ -1248,7 +1155,6 @@ namespace System.Runtime.InteropServices //==================================================================== // String convertions. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required unsafe public static IntPtr StringToHGlobalAnsi(String s) { if (s == null) @@ -1278,7 +1184,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static IntPtr StringToHGlobalUni(String s) { if (s == null) @@ -1311,7 +1216,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr StringToHGlobalAuto(String s) { // Ansi platforms are no longer supported @@ -1324,7 +1228,6 @@ namespace System.Runtime.InteropServices // Converts the CLR exception to an HRESULT. This function also sets // up an IErrorInfo for the exception. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetHRForException(Exception e); @@ -1334,7 +1237,6 @@ namespace System.Runtime.InteropServices // This function is only used in WinRT and converts ObjectDisposedException // to RO_E_CLOSED //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetHRForException_WinRT(Exception e); @@ -1343,7 +1245,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps a UCOMITypeLib, return its name //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibName(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)] public static String GetTypeLibName(UCOMITypeLib pTLB) { @@ -1354,7 +1255,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps an ITypeLib, return its name //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static String GetTypeLibName(ITypeLib typelib) { if (typelib == null) @@ -1375,7 +1275,6 @@ namespace System.Runtime.InteropServices // Internal version of GetTypeLibName // Support GUID_ManagedName which aligns with TlbImp //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required internal static String GetTypeLibNameInternal(ITypeLib typelib) { if (typelib == null) @@ -1417,7 +1316,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given an managed object that wraps an UCOMITypeLib, return its guid //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibGuid(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)] public static Guid GetTypeLibGuid(UCOMITypeLib pTLB) { @@ -1427,7 +1325,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given an managed object that wraps an ITypeLib, return its guid //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Guid GetTypeLibGuid(ITypeLib typelib) { Guid result = new Guid (); @@ -1441,7 +1338,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps a UCOMITypeLib, return its lcid //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibLcid(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)] public static int GetTypeLibLcid(UCOMITypeLib pTLB) { @@ -1451,7 +1347,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps an ITypeLib, return its lcid //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetTypeLibLcid(ITypeLib typelib); @@ -1465,7 +1360,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps an ITypeInfo, return its guid. //==================================================================== - [System.Security.SecurityCritical] // auto-generated internal static Guid GetTypeInfoGuid(ITypeInfo typeInfo) { Guid result = new Guid (); @@ -1480,7 +1374,6 @@ namespace System.Runtime.InteropServices // Given a assembly, return the TLBID that will be generated for the // typelib exported from the assembly. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Guid GetTypeLibGuidForAssembly(Assembly asm) { if (asm == null) @@ -1506,7 +1399,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void _GetTypeLibVersionForAssembly(RuntimeAssembly inputAssembly, out int majorVersion, out int minorVersion); - [System.Security.SecurityCritical] // auto-generated_required public static void GetTypeLibVersionForAssembly(Assembly inputAssembly, out int majorVersion, out int minorVersion) { if (inputAssembly == null) @@ -1523,7 +1415,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps an UCOMITypeInfo, return its name //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeInfoName(ITypeInfo pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)] public static String GetTypeInfoName(UCOMITypeInfo pTI) { @@ -1533,7 +1424,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Given a managed object that wraps an ITypeInfo, return its name //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static String GetTypeInfoName(ITypeInfo typeInfo) { if (typeInfo == null) @@ -1554,7 +1444,6 @@ namespace System.Runtime.InteropServices // Internal version of GetTypeInfoName // Support GUID_ManagedName which aligns with TlbImp //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required internal static String GetTypeInfoNameInternal(ITypeInfo typeInfo, out bool hasManagedName) { if (typeInfo == null) @@ -1592,7 +1481,6 @@ namespace System.Runtime.InteropServices // Get the corresponding managed name as converted by TlbImp // Used to get the type using GetType() from imported assemblies //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required internal static String GetManagedTypeInfoNameInternal(ITypeLib typeLib, ITypeInfo typeInfo) { bool hasManagedName; @@ -1615,7 +1503,6 @@ namespace System.Runtime.InteropServices //==================================================================== // map ITypeInfo* to Type //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeForITypeInfo(IntPtr /* ITypeInfo* */ piTypeInfo) { ITypeInfo pTI = null; @@ -1698,7 +1585,6 @@ namespace System.Runtime.InteropServices // This method is identical to Type.GetTypeFromCLSID. Since it's interop specific, we expose it // on Marshal for more consistent API surface. #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] #endif //!FEATURE_CORECLR public static Type GetTypeFromCLSID(Guid clsid) { @@ -1708,7 +1594,6 @@ namespace System.Runtime.InteropServices //==================================================================== // map Type to ITypeInfo* //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr /* ITypeInfo* */ GetITypeInfoForType(Type t); @@ -1717,13 +1602,11 @@ namespace System.Runtime.InteropServices // is the one where the RCW was first seen. Will return null // otherwise. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetIUnknownForObject(Object o) { return GetIUnknownForObjectNative(o, false); } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetIUnknownForObjectInContext(Object o) { return GetIUnknownForObjectNative(o, true); @@ -1744,7 +1627,6 @@ namespace System.Runtime.InteropServices //==================================================================== // return the IDispatch* for an Object //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IDispatch */ GetIDispatchForObject(Object o) { #if FEATURE_CORECLR @@ -1760,7 +1642,6 @@ namespace System.Runtime.InteropServices // is the one where the RCW was first seen. Will return null // otherwise. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetIDispatchForObjectInContext(Object o) { return GetIDispatchForObjectNative(o, true); @@ -1773,13 +1654,11 @@ namespace System.Runtime.InteropServices // return the IUnknown* representing the interface for the Object // Object o should support Type T //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetComInterfaceForObject(Object o, Type T) { return GetComInterfaceForObjectNative(o, T, false, true); } - [System.Security.SecurityCritical] public static IntPtr GetComInterfaceForObject(T o) { return GetComInterfaceForObject(o, typeof(TInterface)); @@ -1790,7 +1669,6 @@ namespace System.Runtime.InteropServices // Object o should support Type T, it refer the value of mode to // invoke customized QueryInterface or not //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetComInterfaceForObject(Object o, Type T, CustomQueryInterfaceMode mode) { bool bEnableCustomizedQueryInterface = ((mode == CustomQueryInterfaceMode.Allow) ? true : false); @@ -1803,7 +1681,6 @@ namespace System.Runtime.InteropServices // is the one where the RCW was first seen. Will return null // otherwise. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr /* IUnknown* */ GetComInterfaceForObjectInContext(Object o, Type t) { return GetComInterfaceForObjectNative(o, t, true, true); @@ -1815,7 +1692,6 @@ namespace System.Runtime.InteropServices //==================================================================== // return an Object for IUnknown //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object GetObjectForIUnknown(IntPtr /* IUnknown* */ pUnk); @@ -1826,7 +1702,6 @@ namespace System.Runtime.InteropServices // where you want to be able to call ReleaseComObject on a RCW // and not worry about other active uses of said RCW. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object GetUniqueObjectForIUnknown(IntPtr unknown); @@ -1836,25 +1711,20 @@ namespace System.Runtime.InteropServices // Type T should be either a COM imported Type or a sub-type of COM // imported Type //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object GetTypedObjectForIUnknown(IntPtr /* IUnknown* */ pUnk, Type t); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr CreateAggregatedObject(IntPtr pOuter, Object o); - [System.Security.SecurityCritical] public static IntPtr CreateAggregatedObject(IntPtr pOuter, T o) { return CreateAggregatedObject(pOuter, (object)o); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void CleanupUnusedObjectsInCurrentContext(); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool AreComObjectsAvailableForCleanup(); @@ -1862,14 +1732,12 @@ namespace System.Runtime.InteropServices // check if the object is classic COM component //==================================================================== #if !FEATURE_CORECLR // with FEATURE_CORECLR, the whole type is SecurityCritical - [System.Security.SecuritySafeCritical] #endif [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool IsComObject(Object o); #endif // FEATURE_COMINTEROP - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr AllocCoTaskMem(int cb) { IntPtr pNewMem = Win32Native.CoTaskMemAlloc(new UIntPtr((uint)cb)); @@ -1880,7 +1748,6 @@ namespace System.Runtime.InteropServices return pNewMem; } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static IntPtr StringToCoTaskMemUni(String s) { if (s == null) @@ -1912,7 +1779,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static IntPtr StringToCoTaskMemUTF8(String s) { const int MAX_UTF8_CHAR_SIZE = 3; @@ -1944,14 +1810,12 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr StringToCoTaskMemAuto(String s) { // Ansi platforms are no longer supported return StringToCoTaskMemUni(s); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static IntPtr StringToCoTaskMemAnsi(String s) { if (s == null) @@ -1980,7 +1844,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static void FreeCoTaskMem(IntPtr ptr) { if (IsNotWin32Atom(ptr)) { @@ -1988,7 +1851,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb) { IntPtr pNewMem = Win32Native.CoTaskMemRealloc(pv, new UIntPtr((uint)cb)); @@ -2002,7 +1864,6 @@ namespace System.Runtime.InteropServices //==================================================================== // BSTR allocation and dealocation. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static void FreeBSTR(IntPtr ptr) { if (IsNotWin32Atom(ptr)) @@ -2011,7 +1872,6 @@ namespace System.Runtime.InteropServices } } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr StringToBSTR(String s) { if (s == null) @@ -2028,7 +1888,6 @@ namespace System.Runtime.InteropServices return bstr; } - [System.Security.SecurityCritical] // auto-generated_required public static String PtrToStringBSTR(IntPtr ptr) { return PtrToStringUni(ptr, (int)Win32Native.SysStringLen(ptr)); @@ -2039,7 +1898,6 @@ namespace System.Runtime.InteropServices // release the COM component and if the reference hits 0 zombie this object // further usage of this Object might throw an exception //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static int ReleaseComObject(Object o) { __ComObject co = null; @@ -2065,7 +1923,6 @@ namespace System.Runtime.InteropServices // release the COM component and zombie this object // further usage of this Object might throw an exception //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Int32 FinalReleaseComObject(Object o) { if (o == null) @@ -2096,7 +1953,6 @@ namespace System.Runtime.InteropServices //==================================================================== // This method retrieves data from the COM object. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Object GetComObjectData(Object obj, Object key) { #if FEATURE_CORECLR @@ -2137,7 +1993,6 @@ namespace System.Runtime.InteropServices // true if the data has been added, false if the data could not be // added because there already was data for the specified key. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static bool SetComObjectData(Object obj, Object key, Object data) { #if FEATURE_CORECLR @@ -2177,7 +2032,6 @@ namespace System.Runtime.InteropServices // This method takes the given COM object and wraps it in an object // of the specified type. The type must be derived from __ComObject. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Object CreateWrapperOfType(Object o, Type t) { // Validate the arguments. @@ -2224,7 +2078,6 @@ namespace System.Runtime.InteropServices return Wrapper; } - [System.Security.SecurityCritical] public static TWrapper CreateWrapperOfType(T o) { return (TWrapper)CreateWrapperOfType(o, typeof(TWrapper)); @@ -2233,7 +2086,6 @@ namespace System.Runtime.InteropServices //==================================================================== // Helper method called from CreateWrapperOfType. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Object InternalCreateWrapperOfType(Object o, Type t); @@ -2241,7 +2093,6 @@ namespace System.Runtime.InteropServices // There may be a thread-based cache of COM components. This service can // force the aggressive release of the current thread's cache. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("This API did not perform any operation and will be removed in future versions of the CLR.", false)] public static void ReleaseThreadCache() { @@ -2250,50 +2101,40 @@ namespace System.Runtime.InteropServices //==================================================================== // check if the type is visible from COM. //==================================================================== - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool IsTypeVisibleFromCom(Type t); //==================================================================== // IUnknown Helpers //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int /* HRESULT */ QueryInterface(IntPtr /* IUnknown */ pUnk, ref Guid iid, out IntPtr ppv); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int /* ULONG */ AddRef(IntPtr /* IUnknown */ pUnk ); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern int /* ULONG */ Release(IntPtr /* IUnknown */ pUnk ); - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void GetNativeVariantForObject(Object obj, /* VARIANT * */ IntPtr pDstNativeVariant); - [System.Security.SecurityCritical] public static void GetNativeVariantForObject(T obj, IntPtr pDstNativeVariant) { GetNativeVariantForObject((object)obj, pDstNativeVariant); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object GetObjectForNativeVariant(/* VARIANT * */ IntPtr pSrcNativeVariant ); - [System.Security.SecurityCritical] public static T GetObjectForNativeVariant(IntPtr pSrcNativeVariant) { return (T)GetObjectForNativeVariant(pSrcNativeVariant); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern Object[] GetObjectsForNativeVariants(/* VARIANT * */ IntPtr aSrcNativeVariant, int cVars ); - [System.Security.SecurityCritical] public static T[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars) { object[] objects = GetObjectsForNativeVariants(aSrcNativeVariant, cVars); @@ -2312,14 +2153,12 @@ namespace System.Runtime.InteropServices /// Returns the first valid COM slot that GetMethodInfoForSlot will work on /// This will be 3 for IUnknown based interfaces and 7 for IDispatch based interfaces. /// - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetStartComSlot(Type t); /// /// Returns the last valid COM slot that GetMethodInfoForSlot will work on. /// - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetEndComSlot(Type t); @@ -2330,7 +2169,6 @@ namespace System.Runtime.InteropServices /// For classes, the lookup is done on the default interface that will be /// exposed for the class. /// - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType); @@ -2338,7 +2176,6 @@ namespace System.Runtime.InteropServices /// Returns the COM slot for a memeber info, taking into account whether /// the exposed interface is IUnknown based or IDispatch based /// - [System.Security.SecurityCritical] // auto-generated_required public static int GetComSlotForMethodInfo(MemberInfo m) { if (m== null) @@ -2366,7 +2203,6 @@ namespace System.Runtime.InteropServices // guid GUID is generated based on the fully qualified name of the // type. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Guid GenerateGuidForType(Type type) { #if FEATURE_CORECLR @@ -2389,7 +2225,6 @@ namespace System.Runtime.InteropServices // PROGID is generated based on the fully qualified name of the // type. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static String GenerateProgIdForType(Type type) { if (type == null) @@ -2434,7 +2269,6 @@ namespace System.Runtime.InteropServices //==================================================================== // This method binds to the specified moniker. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Object BindToMoniker(String monikerName) { Object obj = null; @@ -2452,7 +2286,6 @@ namespace System.Runtime.InteropServices //==================================================================== // This method gets the currently running object. //==================================================================== - [System.Security.SecurityCritical] // auto-generated_required public static Object GetActiveObject(String progID) { Object obj = null; @@ -2476,32 +2309,26 @@ namespace System.Runtime.InteropServices [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void CLSIDFromProgIDEx([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid); [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid); [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void CreateBindCtx(UInt32 reserved, out IBindCtx ppbc); [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void MkParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] String szUserName, out UInt32 pchEaten, out IMoniker ppmk); [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void BindMoniker(IMoniker pmk, UInt32 grfOpt, ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out Object ppvResult); [DllImport(Microsoft.Win32.Win32Native.OLEAUT32, PreserveSig = false)] [SuppressUnmanagedCodeSecurity] - [System.Security.SecurityCritical] // auto-generated private static extern void GetActiveObject(ref Guid rclsid, IntPtr reserved, [MarshalAs(UnmanagedType.Interface)] out Object ppunk); //======================================================================== @@ -2516,7 +2343,6 @@ namespace System.Runtime.InteropServices //======================================================================== // Private method called from EE upon use of license/ICF2 marshaling. //======================================================================== - [SecurityCritical] private static IntPtr LoadLicenseManager() { Assembly sys = Assembly.Load("System, Version="+ ThisAssembly.Version + @@ -2527,16 +2353,13 @@ namespace System.Runtime.InteropServices return t.TypeHandle.Value; } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void ChangeWrapperHandleStrength(Object otp, bool fIsWeak); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InitializeWrapperForWinRT(object o, ref IntPtr pUnk); #if FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InitializeManagedWinRTFactoryObject(object o, RuntimeType runtimeClassType); #endif @@ -2544,7 +2367,6 @@ namespace System.Runtime.InteropServices //======================================================================== // Create activation factory and wraps it with a unique RCW //======================================================================== - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern object GetNativeActivationFactory(Type type); @@ -2552,11 +2374,9 @@ namespace System.Runtime.InteropServices // Methods allowing retrieval of the IIDs exposed by an underlying WinRT // object, as specified by the object's IInspectable::GetIids() //======================================================================== - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void _GetInspectableIids(ObjectHandleOnStack obj, ObjectHandleOnStack guids); - [System.Security.SecurityCritical] internal static System.Guid[] GetInspectableIids(object obj) { System.Guid[] result = null; @@ -2574,14 +2394,12 @@ namespace System.Runtime.InteropServices // Methods allowing retrieval of the cached WinRT type corresponding to // the specified GUID //======================================================================== - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void _GetCachedWinRTTypeByIid( ObjectHandleOnStack appDomainObj, System.Guid iid, out IntPtr rthHandle); - [System.Security.SecurityCritical] internal static System.Type GetCachedWinRTTypeByIid( System.AppDomain ad, System.Guid iid) @@ -2599,14 +2417,12 @@ namespace System.Runtime.InteropServices // Methods allowing retrieval of the WinRT types cached in the specified // app domain //======================================================================== - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void _GetCachedWinRTTypes( ObjectHandleOnStack appDomainObj, ref int epoch, ObjectHandleOnStack winrtTypes); - [System.Security.SecurityCritical] internal static System.Type[] GetCachedWinRTTypes( System.AppDomain ad, ref int epoch) @@ -2626,7 +2442,6 @@ namespace System.Runtime.InteropServices return result; } - [System.Security.SecurityCritical] internal static System.Type[] GetCachedWinRTTypes( System.AppDomain ad) { @@ -2637,7 +2452,6 @@ namespace System.Runtime.InteropServices #endif // FEATURE_COMINTEROP - [System.Security.SecurityCritical] // auto-generated_required public static Delegate GetDelegateForFunctionPointer(IntPtr ptr, Type t) { // Validate the parameters @@ -2661,7 +2475,6 @@ namespace System.Runtime.InteropServices return GetDelegateForFunctionPointerInternal(ptr, t); } - [System.Security.SecurityCritical] public static TDelegate GetDelegateForFunctionPointer(IntPtr ptr) { return (TDelegate)(object)GetDelegateForFunctionPointer(ptr, typeof(TDelegate)); @@ -2670,7 +2483,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Delegate GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t); - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr GetFunctionPointerForDelegate(Delegate d) { if (d == null) @@ -2680,7 +2492,6 @@ namespace System.Runtime.InteropServices return GetFunctionPointerForDelegateInternal(d); } - [System.Security.SecurityCritical] public static IntPtr GetFunctionPointerForDelegate(TDelegate d) { return GetFunctionPointerForDelegate((Delegate)(object)d); @@ -2689,7 +2500,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern IntPtr GetFunctionPointerForDelegateInternal(Delegate d); - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr SecureStringToBSTR(SecureString s) { if( s == null) { throw new ArgumentNullException(nameof(s)); @@ -2703,7 +2513,6 @@ namespace System.Runtime.InteropServices #endif } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr SecureStringToCoTaskMemAnsi(SecureString s) { if( s == null) { throw new ArgumentNullException(nameof(s)); @@ -2713,7 +2522,6 @@ namespace System.Runtime.InteropServices return s.MarshalToString(globalAlloc: false, unicode: false); } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s) { if( s == null) { @@ -2725,7 +2533,6 @@ namespace System.Runtime.InteropServices } #if FEATURE_COMINTEROP - [System.Security.SecurityCritical] // auto-generated_required public static void ZeroFreeBSTR(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)(Win32Native.SysStringLen(s) * 2)); @@ -2733,28 +2540,24 @@ namespace System.Runtime.InteropServices } #endif - [System.Security.SecurityCritical] // auto-generated_required public static void ZeroFreeCoTaskMemAnsi(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)(Win32Native.lstrlenA(s))); FreeCoTaskMem(s); } - [System.Security.SecurityCritical] // auto-generated_required public static void ZeroFreeCoTaskMemUnicode(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)(Win32Native.lstrlenW(s) * 2)); FreeCoTaskMem(s); } - [System.Security.SecurityCritical] // auto-generated_required unsafe public static void ZeroFreeCoTaskMemUTF8(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)System.StubHelpers.StubHelpers.strlen((sbyte*)s)); FreeCoTaskMem(s); } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr SecureStringToGlobalAllocAnsi(SecureString s) { if( s == null) { throw new ArgumentNullException(nameof(s)); @@ -2764,7 +2567,6 @@ namespace System.Runtime.InteropServices return s.MarshalToString(globalAlloc: true, unicode: false); } - [System.Security.SecurityCritical] // auto-generated_required public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s) { if( s == null) { throw new ArgumentNullException(nameof(s)); @@ -2774,13 +2576,11 @@ namespace System.Runtime.InteropServices return s.MarshalToString(globalAlloc: true, unicode: true);; } - [System.Security.SecurityCritical] // auto-generated_required public static void ZeroFreeGlobalAllocAnsi(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)(Win32Native.lstrlenA(s))); FreeHGlobal(s); } - [System.Security.SecurityCritical] // auto-generated_required public static void ZeroFreeGlobalAllocUnicode(IntPtr s) { Win32Native.ZeroMemory(s, (UIntPtr)(Win32Native.lstrlenW(s) * 2)); FreeHGlobal(s); @@ -2797,7 +2597,6 @@ namespace System.Runtime.InteropServices { } - [System.Security.SecuritySafeCritical] // overrides transparent public member public Assembly ResolveRef(Object TypeLib) { try diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs index 82cd4fa..650ea65 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs @@ -31,13 +31,10 @@ namespace System.Runtime.InteropServices { ] internal interface IDispatch { - [System.Security.SecurityCritical] void GetTypeInfoCount(out uint pctinfo); - [System.Security.SecurityCritical] void GetTypeInfo(uint iTInfo, int lcid, out IntPtr info); - [System.Security.SecurityCritical] void GetIDsOfNames( ref Guid iid, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 2)] @@ -48,7 +45,6 @@ namespace System.Runtime.InteropServices { [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I4, SizeParamIndex = 2)] int[] rgDispId); - [System.Security.SecurityCritical] void Invoke( int dispIdMember, ref Guid riid, diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs index 5fa059d..6752635 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs @@ -91,7 +91,6 @@ namespace System.Runtime.InteropServices { #region IRegistrationServices - [System.Security.SecurityCritical] // auto-generated_required public virtual bool RegisterAssembly(Assembly assembly, AssemblyRegistrationFlags flags) { // Validate the arguments. @@ -154,7 +153,6 @@ namespace System.Runtime.InteropServices { return false; } - [System.Security.SecurityCritical] // auto-generated_required public virtual bool UnregisterAssembly(Assembly assembly) { // Validate the arguments. @@ -214,7 +212,6 @@ namespace System.Runtime.InteropServices { return false; } - [System.Security.SecurityCritical] // auto-generated_required public virtual Type[] GetRegistrableTypesInAssembly(Assembly assembly) { // Validate the arguments. @@ -246,13 +243,11 @@ namespace System.Runtime.InteropServices { return RetArray; } - [System.Security.SecurityCritical] // auto-generated_required public virtual String GetProgIdForType(Type type) { return Marshal.GenerateProgIdForType(type); } - [System.Security.SecurityCritical] // auto-generated_required public virtual void RegisterTypeForComClients(Type type, ref Guid g) { #if FEATURE_COMINTEROP_MANAGED_ACTIVATION @@ -276,13 +271,11 @@ namespace System.Runtime.InteropServices { return s_ManagedCategoryGuid; } - [System.Security.SecurityCritical] // auto-generated_required public virtual bool TypeRequiresRegistration(Type type) { return TypeRequiresRegistrationHelper(type); } - [System.Security.SecuritySafeCritical] // auto-generated public virtual bool TypeRepresentsComType(Type type) { // If the type is not a COM import, then it does not represent a COM type. @@ -307,7 +300,6 @@ namespace System.Runtime.InteropServices { #region Public methods not on IRegistrationServices - [System.Security.SecurityCritical] // auto-generated_required [ComVisible(false)] public virtual int RegisterTypeForComClients(Type type, RegistrationClassContext classContext, RegistrationConnectionType flags) { @@ -327,7 +319,6 @@ namespace System.Runtime.InteropServices { #endif // FEATURE_COMINTEROP_MANAGED_ACTIVATION } - [System.Security.SecurityCritical] // auto-generated_required [ComVisible(false)] public virtual void UnregisterTypeForComClients(int cookie) { @@ -340,7 +331,6 @@ namespace System.Runtime.InteropServices { #region Internal helpers - [System.Security.SecurityCritical] // auto-generated_required internal static bool TypeRequiresRegistrationHelper(Type type) { // If the type is not a class or a value class, then it does not get registered. @@ -365,7 +355,6 @@ namespace System.Runtime.InteropServices { #region Private helpers - [System.Security.SecurityCritical] // auto-generated private void RegisterValueType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion) { // Retrieve some information that will be used during the registration process. @@ -397,7 +386,6 @@ namespace System.Runtime.InteropServices { } } - [System.Security.SecurityCritical] // auto-generated private void RegisterManagedType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion) { // @@ -483,7 +471,6 @@ namespace System.Runtime.InteropServices { EnsureManagedCategoryExists(); } - [System.Security.SecurityCritical] // auto-generated private void RegisterComImportedType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion) { // Retrieve some information that will be used during the registration process. @@ -525,7 +512,6 @@ namespace System.Runtime.InteropServices { } } - [System.Security.SecurityCritical] // auto-generated private bool UnregisterValueType(Type type, String strAsmVersion) { bool bAllVersionsGone = true; @@ -582,7 +568,6 @@ namespace System.Runtime.InteropServices { // Return : // true: All versions are gone. // false: Some versions are still left in registry - [System.Security.SecurityCritical] // auto-generated private bool UnregisterManagedType(Type type,String strAsmVersion) { bool bAllVersionsGone = true; @@ -776,7 +761,6 @@ namespace System.Runtime.InteropServices { // Return: // true: All version information are gone. // false: There are still some version left in registry - [System.Security.SecurityCritical] // auto-generated private bool UnregisterComImportedType(Type type, String strAsmVersion) { bool bAllVersionsGone = true; @@ -846,7 +830,6 @@ namespace System.Runtime.InteropServices { return bAllVersionsGone; } - [System.Security.SecurityCritical] // auto-generated private void RegisterPrimaryInteropAssembly(RuntimeAssembly assembly, String strAsmCodeBase, PrimaryInteropAssemblyAttribute attr) { // Validate that the PIA has a strong name. @@ -874,7 +857,6 @@ namespace System.Runtime.InteropServices { } } - [System.Security.SecurityCritical] // auto-generated private void UnregisterPrimaryInteropAssembly(Assembly assembly, PrimaryInteropAssemblyAttribute attr) { String strTlbId = "{" + Marshal.GetTypeLibGuidForAssembly(assembly).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; @@ -958,7 +940,6 @@ namespace System.Runtime.InteropServices { return true; } - [System.Security.SecurityCritical] // auto-generated private void CallUserDefinedRegistrationMethod(Type type, bool bRegister) { bool bFunctionCalled = false; @@ -1061,13 +1042,11 @@ namespace System.Runtime.InteropServices { #if FEATURE_COMINTEROP_MANAGED_ACTIVATION // GUID versioning can be controlled by using the GuidAttribute or // letting the runtime generate it based on type and assembly strong name. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void RegisterTypeForComClientsNative(Type type,ref Guid g); // GUID versioning can be controlled by using the GuidAttribute or // letting the runtime generate it based on type and assembly strong name. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int RegisterTypeForComClientsExNative(Type t, RegistrationClassContext clsContext, RegistrationConnectionType flags); #endif // FEATURE_COMINTEROP_MANAGED_ACTIVATION diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs index d722843..50fead7 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs @@ -42,20 +42,16 @@ namespace System.Runtime.InteropServices { } #endif - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetModuleFileName(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetDeveloperPath(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetHostBindingFile(); #if !FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void _GetSystemVersion(StringHandleOnStack retVer); @@ -67,7 +63,6 @@ namespace System.Runtime.InteropServices { } #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // public member #endif [MethodImpl (MethodImplOptions.NoInlining)] public static String GetSystemVersion() @@ -86,7 +81,6 @@ namespace System.Runtime.InteropServices { } - [System.Security.SecuritySafeCritical] // auto-generated public static String GetRuntimeDirectory() { String dir = GetRuntimeDirectoryImpl(); @@ -94,13 +88,11 @@ namespace System.Runtime.InteropServices { return dir; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetRuntimeDirectoryImpl(); // Returns the system ConfigurationFile public static String SystemConfigurationFile { - [System.Security.SecuritySafeCritical] // auto-generated get { StringBuilder sb = new StringBuilder(Path.MaxPath); sb.Append(GetRuntimeDirectory()); @@ -115,7 +107,6 @@ namespace System.Runtime.InteropServices { } #if FEATURE_COMINTEROP - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern IntPtr GetRuntimeInterfaceImpl( @@ -130,7 +121,6 @@ namespace System.Runtime.InteropServices { // Returns unmanaged pointer to requested interface on success. Throws // COMException with failed HR if there is a QI failure. // - [System.Security.SecurityCritical] // do not allow partial trust callers [ComVisible(false)] public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid) { @@ -145,7 +135,6 @@ namespace System.Runtime.InteropServices { // Returns an RCW to requested interface on success. Throws // COMException with failed HR if there is a QI failure. // - [System.Security.SecurityCritical] // do not allow partial trust callers [ComVisible(false)] public static object GetRuntimeInterfaceAsObject(Guid clsid, Guid riid) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs index 0946902..cf326c5 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs @@ -78,7 +78,6 @@ using Microsoft.Win32.SafeHandles; using System.Diagnostics.Contracts; - [System.Security.SecurityCritical] public abstract unsafe class SafeBuffer : SafeHandleZeroOrMinusOneIsInvalid { // Steal UIntPtr.MaxValue as our uninitialized value. diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs index c268528..554c6ba 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs @@ -134,9 +134,7 @@ using System.Runtime.Versioning; // we'll do this to ensure we've cut off all attack vectors. Similarly, all // methods have a link demand to ensure untrusted code cannot directly edit // or alter a handle. -[System.Security.SecurityCritical] // auto-generated_required #if !FEATURE_CORECLR -[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] #endif public abstract class SafeHandle : CriticalFinalizerObject, IDisposable { @@ -191,7 +189,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable } #endif - [System.Security.SecuritySafeCritical] // auto-generated ~SafeHandle() { Dispose(false); @@ -236,19 +233,16 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable get; } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void Close() { Dispose(true); } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void Dispose() { Dispose(true); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] protected virtual void Dispose(bool disposing) { @@ -266,7 +260,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable // your handle is invalid and you want to record that information. // An example is calling a syscall and getting back ERROR_INVALID_HANDLE. // This method will normally leak handles! - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void SetHandleAsInvalid(); @@ -295,7 +288,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable // when the method is interrupted prior to processing by a thread abort or // when the handle has already been (or is in the process of being) // released. - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void DangerousAddRef(ref bool success); @@ -309,7 +301,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable // constitutes a potential security hole (via handle recycling) as well as a // correctness problem -- so don't ever expose Dangerous* calls out to // untrusted code. - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void DangerousRelease(); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Variant.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Variant.cs index 9be1588..c7bbb78 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Variant.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Variant.cs @@ -11,7 +11,6 @@ namespace System.Runtime.InteropServices { /// to and from COM calls. /// [StructLayout(LayoutKind.Explicit)] - [System.Security.SecurityCritical] internal struct Variant { #if DEBUG diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs index e9d2cdd..8eb7090 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // int Count { get } [Pure] - [SecurityCritical] internal int Count() { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -47,7 +46,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // bool IsSynchronized { get } [Pure] - [SecurityCritical] internal bool IsSynchronized() { return false; @@ -55,7 +53,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // object SyncRoot { get } [Pure] - [SecurityCritical] internal object SyncRoot() { return this; @@ -63,7 +60,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CopyTo(Array array, int index) [Pure] - [SecurityCritical] internal void CopyTo(Array array, int arrayIndex) { if (array == null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs index 6ec2933..7bc36a1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs @@ -31,7 +31,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // object this[int index] { get } - [SecurityCritical] internal object Indexer_Get(int index) { if (index < 0) @@ -42,7 +41,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // object this[int index] { set } - [SecurityCritical] internal void Indexer_Set(int index, object value) { if (index < 0) @@ -53,7 +51,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // int Add(object value) - [SecurityCritical] internal int Add(object value) { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -69,7 +66,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Contains(object item) - [SecurityCritical] internal bool Contains(object item) { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -79,7 +75,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -88,7 +83,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // bool IsFixedSize { get } [Pure] - [SecurityCritical] internal bool IsFixedSize() { return false; @@ -96,14 +90,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime // bool IsReadOnly { get } [Pure] - [SecurityCritical] internal bool IsReadOnly() { return false; } // int IndexOf(object item) - [SecurityCritical] internal int IndexOf(object item) { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -123,7 +115,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Insert(int index, object item) - [SecurityCritical] internal void Insert(int index, object item) { if (index < 0) @@ -134,7 +125,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Remove(object item) - [SecurityCritical] internal void Remove(object item) { IBindableVector _this = JitHelpers.UnsafeCast(this); @@ -154,7 +144,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAt(int index) - [SecurityCritical] internal void RemoveAt(int index) { if (index < 0) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs index c88f13d..702e0c9 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs @@ -184,7 +184,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Point GetPoint() { if (this.Type != PropertyType.Point) @@ -195,7 +194,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Size GetSize() { if (this.Type != PropertyType.Size) @@ -206,7 +204,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Rect GetRect() { if (this.Type != PropertyType.Rect) @@ -328,7 +325,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Point[] GetPointArray() { if (this.Type != PropertyType.PointArray) @@ -339,7 +335,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Size[] GetSizeArray() { if (this.Type != PropertyType.SizeArray) @@ -351,7 +346,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } [Pure] - [SecuritySafeCritical] public Rect[] GetRectArray() { if (this.Type != PropertyType.RectArray) @@ -505,7 +499,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // Unbox the data stored in the property value to a structurally equivilent type [Pure] - [SecurityCritical] private unsafe T Unbox(Type expectedBoxedType) where T : struct { Contract.Requires(expectedBoxedType != null); Contract.Requires(Marshal.SizeOf(expectedBoxedType) == Marshal.SizeOf(typeof(T))); @@ -526,7 +519,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // Convert the array stored in the property value to a structurally equivilent array type [Pure] - [SecurityCritical] private unsafe T[] UnboxArray(Type expectedArrayElementType) where T : struct { Contract.Requires(expectedArrayElementType != null); Contract.Requires(Marshal.SizeOf(expectedArrayElementType) == Marshal.SizeOf(typeof(T))); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs index e379d38..65b4704 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs @@ -229,7 +229,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal static readonly Type s_rectType = Type.GetType("Windows.Foundation.Rect, " + AssemblyRef.SystemRuntimeWindowsRuntime); internal static readonly Type s_sizeType = Type.GetType("Windows.Foundation.Size, " + AssemblyRef.SystemRuntimeWindowsRuntime); - [SecuritySafeCritical] internal static Object CreateIReference(Object obj) { Contract.Requires(obj != null, "Null should not be boxed."); @@ -306,7 +305,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return null; } - [SecuritySafeCritical] internal static Object CreateIReferenceArray(Array obj) { Contract.Requires(obj != null); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs index 85ebd71..3840e18 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs @@ -88,7 +88,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime InvokeInternal(target, new object[] { indexValue, value }, false); } - [SecuritySafeCritical] private object InvokeInternal(object target, object[] args, bool getValue) { // Forward to the right object if we are dealing with a proxy diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs index fa021b7..1a173a6 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // V Lookup(K key) - [SecurityCritical] internal V Lookup(K key) { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -50,7 +49,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint Size { get } - [SecurityCritical] internal uint Size() { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -58,7 +56,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool HasKey(K key) - [SecurityCritical] internal bool HasKey(K key) { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -66,7 +63,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // IMapView GetView() - [SecurityCritical] internal IReadOnlyDictionary GetView() { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -83,7 +79,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Insert(K key, V value) - [SecurityCritical] internal bool Insert(K key, V value) { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -93,7 +88,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Remove(K key) - [SecurityCritical] internal void Remove(K key) { IDictionary _this = JitHelpers.UnsafeCast>(this); @@ -108,7 +102,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { IDictionary _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs index 7329d31..7df55f4 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs @@ -29,7 +29,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // This method is invoked when First is called on a managed implementation of IIterable. - [System.Security.SecurityCritical] internal IIterator First_Stub() { IEnumerable _this = JitHelpers.UnsafeCast>(this); @@ -58,7 +57,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // This method is invoked when First is called on a managed implementation of IBindableIterable. - [System.Security.SecurityCritical] internal IBindableIterator First_Stub() { IEnumerable _this = JitHelpers.UnsafeCast(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs index 847147a..b78e1f8 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs @@ -30,7 +30,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime Contract.Assert(false, "This class is never instantiated"); } - [SecurityCritical] public void Close() { IDisposable _this = JitHelpers.UnsafeCast(this); @@ -39,7 +38,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // Adapter class which converts IDisposable.Dispose calls into IClosable.Close - [SecurityCritical] internal sealed class IClosableToIDisposableAdapter { private IClosableToIDisposableAdapter() @@ -47,7 +45,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime Contract.Assert(false, "This class is never instantiated"); } - [SecurityCritical] private void Dispose() { IClosable _this = JitHelpers.UnsafeCast(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs index 143a33e..3bbde35 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs @@ -50,7 +50,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // Creates a ICustomProperty implementation for Jupiter // Called from ICustomPropertyProvider_GetIndexedProperty from within runtime // - [System.Security.SecurityCritical] static internal unsafe ICustomProperty CreateIndexedProperty(object target, string propertyName, TypeNameNative *pIndexedParamType) { Contract.Requires(target != null); @@ -87,7 +86,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return new CustomPropertyImpl(propertyInfo); } - [System.Security.SecurityCritical] static internal unsafe void GetType(object target, TypeNameNative *pIndexedParamType) { IGetProxyTarget proxy = target as IGetProxyTarget; @@ -207,7 +205,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // // ICustomQueryInterface methods // - [System.Security.SecurityCritical] public CustomQueryInterfaceResult GetInterface([In]ref Guid iid, out IntPtr ppv) { ppv = IntPtr.Zero; @@ -441,7 +438,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - [SecuritySafeCritical] private IBindableVector GetIBindableVectorNoThrow() { if ((_flags & InterfaceForwardingSupport.IBindableVector) != 0) @@ -450,7 +446,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return null; } - [SecuritySafeCritical] private IVector_Raw GetVectorOfT() { if ((_flags & InterfaceForwardingSupport.IVector) != 0) @@ -517,7 +512,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime public bool MoveNext() { return _iterator.MoveNext(); } } - [SecuritySafeCritical] private IBindableVectorView GetIBindableVectorViewNoThrow() { if ((_flags & InterfaceForwardingSupport.IBindableVectorView) != 0) @@ -526,7 +520,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return null; } - [SecuritySafeCritical] private IVectorView GetVectorViewOfT() { if ((_flags & InterfaceForwardingSupport.IVectorView) != 0) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs index 32bbd3f..5ede9d6 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // V this[K key] { get } - [SecurityCritical] internal V Indexer_Get(K key) { if (key == null) @@ -44,7 +43,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // IEnumerable Keys { get } - [SecurityCritical] internal IEnumerable Keys() { IMapView _this = JitHelpers.UnsafeCast>(this); @@ -53,7 +51,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // IEnumerable Values { get } - [SecurityCritical] internal IEnumerable Values() { IMapView _this = JitHelpers.UnsafeCast>(this); @@ -63,7 +60,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // bool ContainsKey(K key) [Pure] - [SecurityCritical] internal bool ContainsKey(K key) { if (key == null) @@ -74,7 +70,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool TryGetValue(TKey key, out TValue value) - [SecurityCritical] internal bool TryGetValue(K key, out V value) { if (key == null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs index d57f8f1..ef52a50 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // V Lookup(K key) - [SecurityCritical] internal V Lookup(K key) { IReadOnlyDictionary _this = JitHelpers.UnsafeCast>(this); @@ -50,7 +49,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint Size { get } - [SecurityCritical] internal uint Size() { IReadOnlyDictionary _this = JitHelpers.UnsafeCast>(this); @@ -58,7 +56,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool HasKey(K key) - [SecurityCritical] internal bool HasKey(K key) { IReadOnlyDictionary _this = JitHelpers.UnsafeCast>(this); @@ -66,7 +63,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Split(out IMapView first, out IMapView second) - [SecurityCritical] internal void Split(out IMapView first, out IMapView second) { IReadOnlyDictionary _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs index c37c32d..ddb8912 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T GetAt(uint index) - [SecurityCritical] internal T GetAt(uint index) { IReadOnlyList _this = JitHelpers.UnsafeCast>(this); @@ -50,7 +49,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint Size { get } - [SecurityCritical] internal uint Size() { IReadOnlyList _this = JitHelpers.UnsafeCast>(this); @@ -58,7 +56,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool IndexOf(T value, out uint index) - [SecurityCritical] internal bool IndexOf(T value, out uint index) { IReadOnlyList _this = JitHelpers.UnsafeCast>(this); @@ -85,7 +82,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint GetMany(uint startIndex, T[] items) - [SecurityCritical] internal uint GetMany(uint startIndex, T[] items) { IReadOnlyList _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs index bb497ca..9e32168 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs @@ -34,7 +34,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T this[int index] { get } - [SecurityCritical] internal T Indexer_Get(int index) { if (index < 0) @@ -59,7 +58,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T this[int index] { get } - [SecurityCritical] internal T Indexer_Get_Variance(int index) where T : class { bool fUseString; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs index 061a732..a5fe29c 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // This method is invoked when GetEnumerator is called on a WinRT-backed implementation of IEnumerable. - [SecurityCritical] internal IEnumerator GetEnumerator_Stub() { IIterable _this = JitHelpers.UnsafeCast>(this); @@ -43,7 +42,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // and it is possible that the implementation supports IEnumerable/IEnumerable/IEnumerable/ // IEnumerable/IEnumerable rather than IEnumerable because T is assignable from Type/string/ // Exception/array/delegate via co-variance. - [SecurityCritical] internal IEnumerator GetEnumerator_Variance_Stub() where T : class { bool fUseString; @@ -87,7 +85,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // This method is invoked when GetEnumerator is called on a WinRT-backed implementation of IEnumerable. - [SecurityCritical] internal IEnumerator GetEnumerator_Stub() { IBindableIterable _this = JitHelpers.UnsafeCast(this); @@ -145,7 +142,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - [SecuritySafeCritical] public bool MoveNext() { // If we've passed the end of the iteration, IEnumerable should return false, while diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs index 3cf1d4d..901befc 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // object GetAt(uint index) - [SecurityCritical] internal object GetAt(uint index) { IList _this = JitHelpers.UnsafeCast(this); @@ -49,7 +48,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint Size { get } - [SecurityCritical] internal uint Size() { IList _this = JitHelpers.UnsafeCast(this); @@ -57,7 +55,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // IBindableVectorView GetView() - [SecurityCritical] internal IBindableVectorView GetView() { IList _this = JitHelpers.UnsafeCast(this); @@ -65,7 +62,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool IndexOf(object value, out uint index) - [SecurityCritical] internal bool IndexOf(object value, out uint index) { IList _this = JitHelpers.UnsafeCast(this); @@ -82,7 +78,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void SetAt(uint index, object value) - [SecurityCritical] internal void SetAt(uint index, object value) { IList _this = JitHelpers.UnsafeCast(this); @@ -99,7 +94,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void InsertAt(uint index, object value) - [SecurityCritical] internal void InsertAt(uint index, object value) { IList _this = JitHelpers.UnsafeCast(this); @@ -121,7 +115,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAt(uint index) - [SecurityCritical] internal void RemoveAt(uint index) { IList _this = JitHelpers.UnsafeCast(this); @@ -140,7 +133,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Append(object value) - [SecurityCritical] internal void Append(object value) { IList _this = JitHelpers.UnsafeCast(this); @@ -148,7 +140,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAtEnd() - [SecurityCritical] internal void RemoveAtEnd() { IList _this = JitHelpers.UnsafeCast(this); @@ -164,7 +155,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { IList _this = JitHelpers.UnsafeCast(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs index cb61168..af6ed4e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs @@ -32,7 +32,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T GetAt(uint index) - [SecurityCritical] internal T GetAt(uint index) { IList _this = JitHelpers.UnsafeCast>(this); @@ -49,7 +48,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint Size { get } - [SecurityCritical] internal uint Size() { IList _this = JitHelpers.UnsafeCast>(this); @@ -57,7 +55,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // IVectorView GetView() - [SecurityCritical] internal IReadOnlyList GetView() { IList _this = JitHelpers.UnsafeCast>(this); @@ -74,7 +71,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool IndexOf(T value, out uint index) - [SecurityCritical] internal bool IndexOf(T value, out uint index) { IList _this = JitHelpers.UnsafeCast>(this); @@ -91,7 +87,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void SetAt(uint index, T value) - [SecurityCritical] internal void SetAt(uint index, T value) { IList _this = JitHelpers.UnsafeCast>(this); @@ -108,7 +103,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void InsertAt(uint index, T value) - [SecurityCritical] internal void InsertAt(uint index, T value) { IList _this = JitHelpers.UnsafeCast>(this); @@ -130,7 +124,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAt(uint index) - [SecurityCritical] internal void RemoveAt(uint index) { IList _this = JitHelpers.UnsafeCast>(this); @@ -149,7 +142,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Append(T value) - [SecurityCritical] internal void Append(T value) { IList _this = JitHelpers.UnsafeCast>(this); @@ -157,7 +149,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAtEnd() - [SecurityCritical] internal void RemoveAtEnd() { IList _this = JitHelpers.UnsafeCast>(this); @@ -173,7 +164,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { IList _this = JitHelpers.UnsafeCast>(this); @@ -181,7 +171,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // uint GetMany(uint startIndex, T[] items) - [SecurityCritical] internal uint GetMany(uint startIndex, T[] items) { IList _this = JitHelpers.UnsafeCast>(this); @@ -189,7 +178,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void ReplaceAll(T[] items) - [SecurityCritical] internal void ReplaceAll(T[] items) { IList _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs index cb710ff..2d08cab 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs @@ -33,7 +33,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime { private Type m_type; - [SecurityCritical] internal ManagedActivationFactory(Type type) { if (type == null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs index 4517e15..4f79b55 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs @@ -34,7 +34,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // int Count { get } [Pure] - [SecurityCritical] internal int Count() { object _this = JitHelpers.UnsafeCast(this); @@ -66,14 +65,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool IsReadOnly { get } - [SecurityCritical] internal bool IsReadOnly() { return false; } // void Add(T item) - [SecurityCritical] internal void Add(KeyValuePair item) { object _this = JitHelpers.UnsafeCast(this); @@ -91,7 +88,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { object _this = JitHelpers.UnsafeCast(this); @@ -109,7 +105,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Contains(T item) - [SecurityCritical] internal bool Contains(KeyValuePair item) { object _this = JitHelpers.UnsafeCast(this); @@ -135,7 +130,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void CopyTo(T[] array, int arrayIndex) - [SecurityCritical] internal void CopyTo(KeyValuePair[] array, int arrayIndex) { if (array == null) @@ -160,7 +154,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Remove(T item) - [SecurityCritical] internal bool Remove(KeyValuePair item) { object _this = JitHelpers.UnsafeCast(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs index d032937..89d1573 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs @@ -30,7 +30,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // V this[K key] { get } - [SecurityCritical] internal V Indexer_Get(K key) { if (key == null) @@ -43,7 +42,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // V this[K key] { set } - [SecurityCritical] internal void Indexer_Set(K key, V value) { if (key == null) @@ -56,7 +54,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // ICollection Keys { get } - [SecurityCritical] internal ICollection Keys() { IMap _this = JitHelpers.UnsafeCast>(this); @@ -65,7 +62,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // ICollection Values { get } - [SecurityCritical] internal ICollection Values() { IMap _this = JitHelpers.UnsafeCast>(this); @@ -75,7 +71,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // bool ContainsKey(K key) [Pure] - [SecurityCritical] internal bool ContainsKey(K key) { if (key == null) @@ -86,7 +81,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Add(K key, V value) - [SecurityCritical] internal void Add(K key, V value) { if (key == null) @@ -102,7 +96,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Remove(TKey key) - [SecurityCritical] internal bool Remove(K key) { if (key == null) @@ -128,7 +121,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool TryGetValue(TKey key, out TValue value) - [SecurityCritical] internal bool TryGetValue(K key, out V value) { if (key == null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs index 58427fb..2dd34192 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs @@ -34,7 +34,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // int Count { get } [Pure] - [SecurityCritical] internal int Count() { object _this = JitHelpers.UnsafeCast(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs index b8cd65e..4380369 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs @@ -22,30 +22,25 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal static class UnsafeNativeMethods { [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll", PreserveSig = false)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static extern IRestrictedErrorInfo GetRestrictedErrorInfo(); [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll")] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool RoOriginateLanguageException(int error, [MarshalAs(UnmanagedType.HString)]string message, IntPtr languageException); [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll", PreserveSig = false)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static extern void RoReportUnhandledError(IRestrictedErrorInfo error); [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static unsafe extern int WindowsCreateString([MarshalAs(UnmanagedType.LPWStr)] string sourceString, int length, [Out] IntPtr *hstring); [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static unsafe extern int WindowsCreateStringReference(char *sourceString, int length, @@ -53,12 +48,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime [Out] IntPtr *hstring); [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static extern int WindowsDeleteString(IntPtr hstring); [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static unsafe extern char* WindowsGetStringRawBuffer(IntPtr hstring, [Out] uint *length); } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs index 5dd7d00..cd3c53a 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs @@ -57,15 +57,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime { // // Support for ToString/GetHashCode/Equals override // - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern IntPtr GetRedirectedGetHashCodeMD(); - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern int RedirectGetHashCode(IntPtr pMD); - [System.Security.SecuritySafeCritical] public override int GetHashCode() { IntPtr pMD = GetRedirectedGetHashCodeMD(); @@ -74,15 +71,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime { return RedirectGetHashCode(pMD); } - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern IntPtr GetRedirectedToStringMD(); - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern string RedirectToString(IntPtr pMD); - [System.Security.SecuritySafeCritical] public override string ToString() { // Check whether the type implements IStringable. @@ -102,15 +96,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime { } } - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern IntPtr GetRedirectedEqualsMD(); - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal extern bool RedirectEquals(object obj, IntPtr pMD); - [System.Security.SecuritySafeCritical] public override bool Equals(object obj) { IntPtr pMD = GetRedirectedEqualsMD(); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs index ba29eae..89f1022 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs @@ -31,7 +31,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // int Count { get } [Pure] - [SecurityCritical] internal int Count() { IVector _this = JitHelpers.UnsafeCast>(this); @@ -45,14 +44,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool IsReadOnly { get } - [SecurityCritical] internal bool IsReadOnly() { return false; } // void Add(T item) - [SecurityCritical] internal void Add(T item) { IVector _this = JitHelpers.UnsafeCast>(this); @@ -60,7 +57,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Clear() - [SecurityCritical] internal void Clear() { IVector _this = JitHelpers.UnsafeCast>(this); @@ -68,7 +64,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Contains(T item) - [SecurityCritical] internal bool Contains(T item) { IVector _this = JitHelpers.UnsafeCast>(this); @@ -78,7 +73,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void CopyTo(T[] array, int arrayIndex) - [SecurityCritical] internal void CopyTo(T[] array, int arrayIndex) { if (array == null) @@ -104,7 +98,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // bool Remove(T item) - [SecurityCritical] internal bool Remove(T item) { IVector _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs index feefe4e..76cfda3 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs @@ -30,7 +30,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T this[int index] { get } - [SecurityCritical] internal T Indexer_Get(int index) { if (index < 0) @@ -41,7 +40,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // T this[int index] { set } - [SecurityCritical] internal void Indexer_Set(int index, T value) { if (index < 0) @@ -52,7 +50,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // int IndexOf(T item) - [SecurityCritical] internal int IndexOf(T item) { IVector _this = JitHelpers.UnsafeCast>(this); @@ -72,7 +69,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void Insert(int index, T item) - [SecurityCritical] internal void Insert(int index, T item) { if (index < 0) @@ -83,7 +79,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // void RemoveAt(int index) - [SecurityCritical] internal void RemoveAt(int index) { if (index < 0) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs index 4b4ae5d..451446e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs @@ -31,7 +31,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // int Count { get } [Pure] - [SecurityCritical] internal int Count() { IVectorView _this = JitHelpers.UnsafeCast>(this); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs index 0d59895..a786880 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs @@ -19,7 +19,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime { internal static class WindowsRuntimeBufferHelper { - [SecurityCritical] [DllImport(JitHelpers.QCall)] [SuppressUnmanagedCodeSecurity] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -27,7 +26,6 @@ internal static class WindowsRuntimeBufferHelper { [FriendAccessAllowed] - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal unsafe static void StoreOverlappedInCCW(Object windowsRuntimeBuffer, NativeOverlapped* overlapped) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs index 5b04329..3f075d7 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs @@ -23,7 +23,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // delegate. It then stores the corresponding token in a dictionary for easy access by RemoveEventHandler // later. Note that the dictionary is indexed by the remove method that will be used for RemoveEventHandler // so the removeMethod given here must match the remove method supplied there exactly. - [SecurityCritical] public static void AddEventHandler(Func addMethod, Action removeMethod, T handler) @@ -54,7 +53,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // Remove the delegate handler from the Windows Runtime style event registration by looking for // its token, previously stored via AddEventHandler - [SecurityCritical] public static void RemoveEventHandler(Action removeMethod, T handler) { if (removeMethod == null) @@ -79,7 +77,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime ManagedEventRegistrationImpl.RemoveEventHandler(removeMethod, handler); } - [SecurityCritical] public static void RemoveAllEventHandlers(Action removeMethod) { if (removeMethod == null) @@ -220,7 +217,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime ConditionalWeakTable>> s_eventRegistrations = new ConditionalWeakTable>>(); - [SecurityCritical] internal static void AddEventHandler(Func addMethod, Action removeMethod, T handler) @@ -280,7 +276,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - [SecurityCritical] internal static void RemoveEventHandler(Action removeMethod, T handler) { Contract.Requires(removeMethod != null); @@ -322,7 +317,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime BCLDebug.Log("INTEROP", "[WinRT_Eventing] Event unsubscribed for managed instance = " + instance + ", handler = " + handler + ", token = " + token.m_value + "\n"); } - [SecurityCritical] internal static void RemoveAllEventHandlers(Action removeMethod) { Contract.Requires(removeMethod != null); @@ -538,7 +532,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime private volatile static MyReaderWriterLock s_eventCacheRWLock = new MyReaderWriterLock(); // Get InstanceKey to use in the cache - [SecuritySafeCritical] private static object GetInstanceKey(Action removeMethod) { object target = removeMethod.Target; @@ -550,7 +543,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return (object) Marshal.GetRawIUnknownForComObjectNoAddRef(target); } - [SecurityCritical] internal static void AddEventHandler(Func addMethod, Action removeMethod, T handler) @@ -685,7 +677,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - [SecurityCritical] internal static void RemoveEventHandler(Action removeMethod, T handler) { object instanceKey = GetInstanceKey(removeMethod); @@ -762,7 +753,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime removeMethod(token); } - [SecurityCritical] internal static void RemoveAllEventHandlers(Action removeMethod) { object instanceKey = GetInstanceKey(removeMethod); @@ -1044,7 +1034,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime throw new AggregateException(exceptions.ToArray()); } - [SecurityCritical] internal static unsafe string HStringToString(IntPtr hstring) { Contract.Requires(Environment.IsWinRTSupported); @@ -1092,7 +1081,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime private static bool s_haveBlueErrorApis = true; - [SecurityCritical] private static bool RoOriginateLanguageException(int error, string message, IntPtr languageException) { if (s_haveBlueErrorApis) @@ -1110,7 +1098,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return false; } - [SecurityCritical] private static void RoReportUnhandledError(IRestrictedErrorInfo error) { if (s_haveBlueErrorApis) @@ -1134,7 +1121,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime /// /// true if the error was reported, false if not (ie running on Win8) [FriendAccessAllowed] - [SecuritySafeCritical] internal static bool ReportUnhandledError(Exception e) { // Only report to the WinRT global exception handler in modern apps @@ -1200,14 +1186,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime #if FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION // Get an IActivationFactory * for a managed type - [SecurityCritical] internal static IntPtr GetActivationFactoryForType(Type type) { ManagedActivationFactory activationFactory = GetManagedActivationFactory(type); return Marshal.GetComInterfaceForObject(activationFactory, typeof(IActivationFactory)); } - [SecurityCritical] internal static ManagedActivationFactory GetManagedActivationFactory(Type type) { ManagedActivationFactory activationFactory = new ManagedActivationFactory(type); @@ -1224,7 +1208,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // holds the IWinRTClassActivator* that is used for the process private static IntPtr s_pClassActivator = IntPtr.Zero; - [SecurityCritical] internal static IntPtr GetClassActivatorForApplication(string appBase) { if (s_pClassActivator == IntPtr.Zero) @@ -1268,7 +1251,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // factories from other apartments and make transiton to those apartments and cause // deadlocks and create objects in incorrect apartments // - [SecurityCritical] public static IActivationFactory GetActivationFactory(Type type) { if (type == null) @@ -1291,7 +1273,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // HSTRING marshaling methods: - [SecurityCritical] public static IntPtr StringToHString(String s) { if (!Environment.IsWinRTSupported) @@ -1309,7 +1290,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - [SecurityCritical] public static String PtrToStringHString(IntPtr ptr) { if (!Environment.IsWinRTSupported) @@ -1320,7 +1300,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return HStringToString(ptr); } - [SecurityCritical] public static void FreeHString(IntPtr ptr) { if (!Environment.IsWinRTSupported) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs index 642c4b2..9ca959c 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs @@ -19,14 +19,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime public static class WindowsRuntimeMetadata { // Wrapper for Win8 API RoResolveNamespace with default Windows SDK path as installed .winmd files in %WINDIR%\system32\WinMetadata. - [System.Security.SecurityCritical] public static IEnumerable ResolveNamespace(string namespaceName, IEnumerable packageGraphFilePaths) { return ResolveNamespace(namespaceName, null, packageGraphFilePaths); } // Wrapper for Win8 API RoResolveNamespace. - [System.Security.SecurityCritical] public static IEnumerable ResolveNamespace(string namespaceName, string windowsSdkFilePath, IEnumerable packageGraphFilePaths) { if (namespaceName == null) @@ -58,7 +56,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime return retFileNames; } - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void nResolveNamespace( diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs index 37ac309..e158a5a 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs @@ -17,7 +17,6 @@ using System.Threading; namespace System.Runtime.Loader { - [System.Security.SecuritySafeCritical] public abstract class AssemblyLoadContext { [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] @@ -62,7 +61,6 @@ namespace System.Runtime.Loader InitializeLoadContext(fRepresentsTPALoadContext); } - [System.Security.SecuritySafeCritical] void InitializeLoadContext(bool fRepresentsTPALoadContext) { // Initialize the VM side of AssemblyLoadContext if not already done. @@ -501,14 +499,12 @@ namespace System.Runtime.Loader } } - [System.Security.SecuritySafeCritical] class AppPathAssemblyLoadContext : AssemblyLoadContext { internal AppPathAssemblyLoadContext() : base(true) { } - [System.Security.SecuritySafeCritical] protected override Assembly Load(AssemblyName assemblyName) { // We were loading an assembly into TPA ALC that was not found on TPA list. As a result we are here. @@ -517,14 +513,12 @@ namespace System.Runtime.Loader } } - [System.Security.SecuritySafeCritical] internal class IndividualAssemblyLoadContext : AssemblyLoadContext { internal IndividualAssemblyLoadContext() : base(false) { } - [System.Security.SecuritySafeCritical] protected override Assembly Load(AssemblyName assemblyName) { return null; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs b/src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs index c22ce65..03fdbe3 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs @@ -143,7 +143,6 @@ namespace System.Runtime private ulong _reservedMemory; // The size of this request (from user) private bool _mustSubtractReservation; // Did we add data to SharedStatics? - [System.Security.SecuritySafeCritical] // auto-generated static MemoryFailPoint() { GetMemorySettings(out GCSegmentSize, out TopOfMemory); @@ -153,7 +152,6 @@ namespace System.Runtime // have scenarios for this in partial trust in the future, but // we're doing this just to restrict this in case the code below // is somehow incorrect. - [System.Security.SecurityCritical] // auto-generated_required public MemoryFailPoint(int sizeInMegabytes) { if (sizeInMegabytes <= 0) @@ -306,7 +304,6 @@ namespace System.Runtime #endif } - [System.Security.SecurityCritical] // auto-generated private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { bool r; @@ -323,7 +320,6 @@ namespace System.Runtime // returns whether there is enough space. In all cases, we update // our last known free address space, hopefully avoiding needing to // probe again. - [System.Security.SecurityCritical] // auto-generated private static unsafe bool CheckForFreeAddressSpace(ulong size, bool shouldThrow) { // Start walking the address space at 0. VirtualAlloc may wrap @@ -350,7 +346,6 @@ namespace System.Runtime // of pages. If we didn't have enough address space, we still return // a positive value < size, to help potentially avoid the overhead of // this check if we use a MemoryFailPoint with a smaller size next. - [System.Security.SecurityCritical] // auto-generated private static unsafe ulong MemFreeAfterAddress(void * address, ulong size) { if (size >= TopOfMemory) @@ -377,11 +372,9 @@ namespace System.Runtime return largestFreeRegion; } - [System.Security.SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetMemorySettings(out ulong maxGCSegmentSize, out ulong topOfMemory); - [System.Security.SecuritySafeCritical] // destructors should be safe to call ~MemoryFailPoint() { Dispose(false); @@ -394,14 +387,12 @@ namespace System.Runtime // future create an allocation context and release it in the Dispose // method. While the finalizer will eventually free this block of // memory, apps will help their performance greatly by calling Dispose. - [System.Security.SecuritySafeCritical] // auto-generated public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private void Dispose(bool disposing) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/ProfileOptimization.cs b/src/coreclr/src/mscorlib/src/System/Runtime/ProfileOptimization.cs index c877d21..1e42308 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/ProfileOptimization.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/ProfileOptimization.cs @@ -27,22 +27,18 @@ namespace System.Runtime { public static class ProfileOptimization { [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static extern void InternalSetProfileRoot(string directoryPath); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] internal static extern void InternalStartProfile(string profile, IntPtr ptrNativeAssemblyLoadContext); - [SecurityCritical] public static void SetProfileRoot(string directoryPath) { InternalSetProfileRoot(directoryPath); } - [SecurityCritical] public static void StartProfile(string profile) { InternalStartProfile(profile, IntPtr.Zero); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs index 2524aaa..34714f1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs @@ -23,14 +23,10 @@ using System.Runtime.InteropServices; namespace System.Runtime.ConstrainedExecution { #if !FEATURE_CORECLR - [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] #endif [System.Runtime.InteropServices.ComVisible(true)] public abstract class CriticalFinalizerObject { - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - #endif [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected CriticalFinalizerObject() { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs index c2911d9..7544a0b 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs @@ -35,10 +35,8 @@ namespace System.Runtime.Serialization { public static class FormatterServices { #if FEATURE_SERIALIZATION internal static Dictionary m_MemberInfoTable = new Dictionary(32); - [System.Security.SecurityCritical] private static bool unsafeTypeForwardersIsEnabled = false; - [System.Security.SecurityCritical] private static volatile bool unsafeTypeForwardersIsEnabledInitialized = false; private static Object s_FormatterServicesSyncObject = null; @@ -56,7 +54,6 @@ namespace System.Runtime.Serialization { } } - [SecuritySafeCritical] static FormatterServices() { // Static initialization touches security critical types, so we need an @@ -186,7 +183,6 @@ namespace System.Runtime.Serialization { // be included, properties must have both a getter and a setter. N.B.: A class // which implements ISerializable or has a serialization surrogate may not use all of these members // (or may have additional members). - [System.Security.SecurityCritical] // auto-generated_required public static MemberInfo[] GetSerializableMembers(Type type) { return GetSerializableMembers(type, new StreamingContext(StreamingContextStates.All)); } @@ -194,7 +190,6 @@ namespace System.Runtime.Serialization { // Get all of the Serializable Members for a particular class. If we're not cloning, this is all // non-transient, non-static fields. If we are cloning, include the transient fields as well since // we know that we're going to live inside of the same context. - [System.Security.SecurityCritical] // auto-generated_required public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context) { MemberInfo[] members; @@ -249,7 +244,6 @@ namespace System.Runtime.Serialization { // will not create an unitialized string because it is non-sensical to create an empty // instance of an immutable type. // - [System.Security.SecurityCritical] // auto-generated_required public static Object GetUninitializedObject(Type type) { if ((object)type == null) { throw new ArgumentNullException(nameof(type)); @@ -263,7 +257,6 @@ namespace System.Runtime.Serialization { return nativeGetUninitializedObject((RuntimeType)type); } - [System.Security.SecurityCritical] // auto-generated_required public static Object GetSafeUninitializedObject(Type type) { if ((object)type == null) { throw new ArgumentNullException(nameof(type)); @@ -282,19 +275,15 @@ namespace System.Runtime.Serialization { } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Object nativeGetSafeUninitializedObject(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Object nativeGetUninitializedObject(RuntimeType type); #if FEATURE_SERIALIZATION - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool GetEnableUnsafeTypeForwarders(); - [SecuritySafeCritical] internal static bool UnsafeTypeForwardersIsEnabled() { if (!unsafeTypeForwardersIsEnabledInitialized) @@ -307,7 +296,6 @@ namespace System.Runtime.Serialization { } #endif private static Binder s_binder = Type.DefaultBinder; - [System.Security.SecurityCritical] internal static void SerializationSetValue(MemberInfo fi, Object target, Object value) { Contract.Requires(fi != null); @@ -334,7 +322,6 @@ namespace System.Runtime.Serialization { // Fill in the members of obj with the data contained in data. // Returns the number of members populated. // - [System.Security.SecurityCritical] // auto-generated_required public static Object PopulateObjectMembers(Object obj, MemberInfo[] members, Object[] data) { if (obj==null) { throw new ArgumentNullException(nameof(obj)); @@ -389,7 +376,6 @@ namespace System.Runtime.Serialization { // extract (must be FieldInfos or PropertyInfos). For each supplied member, extract the matching value and // return it in a Object[] of the same size. // - [System.Security.SecurityCritical] // auto-generated_required public static Object[] GetObjectData(Object obj, MemberInfo[] members) { if (obj==null) { @@ -432,7 +418,6 @@ namespace System.Runtime.Serialization { return data; } - [System.Security.SecurityCritical] // auto-generated_required [System.Runtime.InteropServices.ComVisible(false)] public static ISerializationSurrogate GetSurrogateForCyclicalReference(ISerializationSurrogate innerSurrogate) { @@ -448,7 +433,6 @@ namespace System.Runtime.Serialization { **Arguments: **Exceptions: ==============================================================================*/ - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeFromAssembly(Assembly assem, String name) { if (assem==null) throw new ArgumentNullException(nameof(assem)); @@ -559,13 +543,11 @@ namespace System.Runtime.Serialization { this.innerSurrogate = innerSurrogate; } - [System.Security.SecurityCritical] // auto-generated public void GetObjectData(Object obj, SerializationInfo info, StreamingContext context) { innerSurrogate.GetObjectData(obj, info, context); } - [System.Security.SecurityCritical] // auto-generated public Object SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { return innerSurrogate.SetObjectData(obj, info, context, selector); diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs index f1a1bc0..42662a1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs @@ -22,7 +22,6 @@ namespace System.Runtime.Serialization { // Interface does not need to be marked with the serializable attribute [System.Runtime.InteropServices.ComVisible(true)] public interface IObjectReference { - [System.Security.SecurityCritical] // auto-generated_required Object GetRealObject(StreamingContext context); } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs index e59fa65..fc283d4 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs @@ -22,7 +22,6 @@ namespace System.Runtime.Serialization { [System.Runtime.InteropServices.ComVisible(true)] public interface ISerializable { - [System.Security.SecurityCritical] // auto-generated_required void GetObjectData(SerializationInfo info, StreamingContext context); } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs index 9bb30d9..226bbdc 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs @@ -24,13 +24,11 @@ namespace System.Runtime.Serialization { // Returns a SerializationInfo completely populated with all of the data needed to reinstantiate the // the object at the other end of serialization. // - [System.Security.SecurityCritical] // auto-generated_required void GetObjectData(Object obj, SerializationInfo info, StreamingContext context); // Reinflate the object using all of the information in data. The information in // members is used to find the particular field or property which needs to be set. // - [System.Security.SecurityCritical] // auto-generated_required Object SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector); } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs index 01b960f..87b7845 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs @@ -22,16 +22,13 @@ namespace System.Runtime.Serialization { // Interface does not need to be marked with the serializable attribute // Specifies the next ISurrogateSelector to be examined for surrogates if the current // instance doesn't have a surrogate for the given type and assembly in the given context. - [System.Security.SecurityCritical] // auto-generated_required void ChainSelector(ISurrogateSelector selector); // Returns the appropriate surrogate for the given type in the given context. - [System.Security.SecurityCritical] // auto-generated_required ISerializationSurrogate GetSurrogate(Type type, StreamingContext context, out ISurrogateSelector selector); // Return the next surrogate in the chain. Returns null if no more exist. - [System.Security.SecurityCritical] // auto-generated_required ISurrogateSelector GetNextSelector(); } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs index 9c89327..585d367 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs @@ -153,8 +153,6 @@ namespace System.Runtime.Serialization // // 3. Serialize the safe serialization object in GetObjectData, and call its CompleteSerialization method: // - // [SecurityCritical] - // void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) // { // info.AddValue("m_safeSerializationManager", m_safeSerializationManager, typeof(SafeSerializationManager)); // m_safeSerializationManager.CompleteSerialization(this, info, context); @@ -281,7 +279,6 @@ namespace System.Runtime.Serialization { } - [SecurityCritical] private SafeSerializationManager(SerializationInfo info, StreamingContext context) { // We need to determine if we're being called to really deserialize a SafeSerializationManager, @@ -313,7 +310,6 @@ namespace System.Runtime.Serialization // CompleteSerialization is called by the base ISerializable in its GetObjectData method. It is // responsible for gathering up the serialized object state of any delegates that wish to add their // own state to the serialized object. - [SecurityCritical] internal void CompleteSerialization(object serializedObject, SerializationInfo info, StreamingContext context) @@ -360,7 +356,6 @@ namespace System.Runtime.Serialization } } - [SecurityCritical] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("m_serializedStates", m_serializedStates, typeof(List)); @@ -369,7 +364,6 @@ namespace System.Runtime.Serialization // GetRealObject intercepts the deserialization process in order to allow deserializing part of the // object's inheritance heirarchy using standard ISerializable constructors, and the remaining // portion using the saved serialization states. - [SecurityCritical] object IObjectReference.GetRealObject(StreamingContext context) { // If we've already deserialized the real object, use that rather than deserializing it again diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs index 3b77c7a..464f770 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs @@ -88,7 +88,6 @@ namespace System.Runtime.Serialization { return m_field.GetValue(obj); } - [System.Security.SecurityCritical] internal Object InternalGetValue(Object obj) { RtFieldInfo field = m_field as RtFieldInfo; if (field != null) @@ -104,7 +103,6 @@ namespace System.Runtime.Serialization { m_field.SetValue(obj, value, invokeAttr, binder, culture); } - [System.Security.SecurityCritical] internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { RtFieldInfo field = m_field as RtFieldInfo; if (field != null) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs index c75de11..875001c 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -106,7 +106,6 @@ namespace System.Runtime.Serialization { return m_assemName; } - [SecuritySafeCritical] set { if (null == value) @@ -123,7 +122,6 @@ namespace System.Runtime.Serialization } } - [SecuritySafeCritical] public void SetType(Type type) { if ((object)type == null) @@ -165,7 +163,6 @@ namespace System.Runtime.Serialization } } - [SecuritySafeCritical] internal static void DemandForUnsafeAssemblyNameAssignments(string originalAssemblyName, string newAssemblyName) { #if !FEATURE_CORECLR @@ -503,7 +500,6 @@ namespace System.Runtime.Serialization // form requested. // - [System.Security.SecuritySafeCritical] // auto-generated public Object GetValue(String name, Type type) { @@ -532,7 +528,6 @@ namespace System.Runtime.Serialization return m_converter.Convert(value, type); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] internal Object GetValueNoThrow(String name, Type type) { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs index b06c424..6bf8f8c 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs @@ -21,13 +21,11 @@ namespace System.Runtime.Versioning * * These apis are for internal use only for FX assmeblies. It has not been decided if they can be used by OOB components due to EULA restrictions */ - [System.Security.SecurityCritical] public static bool IsEnabled(string compatibilitySwitchName) { return IsEnabledInternalCall(compatibilitySwitchName, true); } - [System.Security.SecurityCritical] public static string GetValue(string compatibilitySwitchName) { // This is used by AppContext.TryGetSwitch to check switch overrides in the Windows Quirk DB @@ -36,19 +34,16 @@ namespace System.Runtime.Versioning return GetValueInternalCall(compatibilitySwitchName, true); } - [System.Security.SecurityCritical] internal static bool IsEnabledInternal(string compatibilitySwitchName) { return IsEnabledInternalCall(compatibilitySwitchName, false); } - [System.Security.SecurityCritical] internal static string GetValueInternal(string compatibilitySwitchName) { return GetValueInternalCall(compatibilitySwitchName, false); } - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal static extern string GetAppContextOverridesInternalCall(); diff --git a/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs b/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs index 15a9c6e..198cbde 100644 --- a/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs +++ b/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs @@ -48,11 +48,9 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsInstanceOfType(RuntimeType type, Object o); - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers) { Type type = typeStart; @@ -127,14 +125,12 @@ namespace System public IntPtr Value { - [SecurityCritical] get { return m_type != null ? m_type.m_handle : IntPtr.Zero; } } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] internal static extern IntPtr GetValueInternal(RuntimeTypeHandle handle); @@ -148,7 +144,6 @@ namespace System return m_type == null; } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsPrimitive(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); @@ -157,35 +152,30 @@ namespace System corElemType == CorElementType.U; } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsByRef(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); return (corElemType == CorElementType.ByRef); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsPointer(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); return (corElemType == CorElementType.Ptr); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsArray(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); return (corElemType == CorElementType.Array || corElemType == CorElementType.SzArray); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsSzArray(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); return (corElemType == CorElementType.SzArray); } - [System.Security.SecuritySafeCritical] // auto-generated internal static bool HasElementType(RuntimeType type) { CorElementType corElemType = GetCorElementType(type); @@ -195,7 +185,6 @@ namespace System || (corElemType == CorElementType.ByRef)); // IsByRef } - [SecurityCritical] internal static IntPtr[] CopyRuntimeTypeHandles(RuntimeTypeHandle[] inHandles, out int length) { if (inHandles == null || inHandles.Length == 0) @@ -213,7 +202,6 @@ namespace System return outHandles; } - [SecurityCritical] internal static IntPtr[] CopyRuntimeTypeHandles(Type[] inHandles, out int length) { if (inHandles == null || inHandles.Length == 0) @@ -231,19 +219,15 @@ namespace System return outHandles; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object Allocate(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object CreateInstanceForAnotherGenericParameter(RuntimeType type, RuntimeType genericParameter); @@ -252,15 +236,12 @@ namespace System return m_type; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static CorElementType GetCorElementType(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeAssembly GetAssembly(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern static RuntimeModule GetModule(RuntimeType type); @@ -272,31 +253,24 @@ namespace System return new ModuleHandle(RuntimeTypeHandle.GetModule(m_type)); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeType GetBaseType(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static TypeAttributes GetAttributes(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeType GetElementType(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool CompareCanonicalHandles(RuntimeType left, RuntimeType right); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetArrayRank(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetToken(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeMethodHandleInternal GetMethodAt(RuntimeType type, int slot); @@ -306,14 +280,12 @@ namespace System bool _firstCall; RuntimeMethodHandleInternal _handle; - [System.Security.SecuritySafeCritical] // auto-generated internal IntroducedMethodEnumerator(RuntimeType type) { _handle = RuntimeTypeHandle.GetFirstIntroducedMethod(type); _firstCall = true; } - [System.Security.SecuritySafeCritical] // auto-generated public bool MoveNext() { if (_firstCall) @@ -346,28 +318,22 @@ namespace System return new IntroducedMethodEnumerator(type); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern RuntimeMethodHandleInternal GetFirstIntroducedMethod(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetNextIntroducedMethod(ref RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool GetFields(RuntimeType type, IntPtr* result, int* count); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static Type[] GetInterfaces(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetConstraints(RuntimeTypeHandle handle, ObjectHandleOnStack types); - [System.Security.SecuritySafeCritical] // auto-generated internal Type[] GetConstraints() { Type[] types = null; @@ -376,118 +342,96 @@ namespace System return types; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static IntPtr GetGCHandle(RuntimeTypeHandle handle, GCHandleType type); - [System.Security.SecurityCritical] // auto-generated internal IntPtr GetGCHandle(GCHandleType type) { return GetGCHandle(GetNativeHandle(), type); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetNumVirtuals(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal void VerifyInterfaceIsImplemented(RuntimeTypeHandle interfaceHandle) { VerifyInterfaceIsImplemented(GetNativeHandle(), interfaceHandle.GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle) { return GetInterfaceMethodImplementationSlot(GetNativeHandle(), interfaceHandle.GetNativeHandle(), interfaceMethodHandle); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsComObject(RuntimeType type, bool isGenericCOM); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsContextful(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsInterface(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private extern static bool _IsVisible(RuntimeTypeHandle typeHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsVisible(RuntimeType type) { return _IsVisible(new RuntimeTypeHandle(type)); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecurityCritical(RuntimeTypeHandle typeHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecurityCritical() { return IsSecurityCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecuritySafeCritical(RuntimeTypeHandle typeHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecuritySafeCritical() { return IsSecuritySafeCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecurityTransparent(RuntimeTypeHandle typeHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecurityTransparent() { return IsSecurityTransparent(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool HasProxyAttribute(RuntimeType type); - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsValueType(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void ConstructName(RuntimeTypeHandle handle, TypeNameFormatFlags formatFlags, StringHandleOnStack retString); - [System.Security.SecuritySafeCritical] // auto-generated internal string ConstructName(TypeNameFormatFlags formatFlags) { string name = null; @@ -495,34 +439,27 @@ namespace System return name; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static void* _GetUtf8Name(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated internal static Utf8String GetUtf8Name(RuntimeType type) { return new Utf8String(_GetUtf8Name(type)); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool CanCastTo(RuntimeType type, RuntimeType target); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeType GetDeclaringType(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static IRuntimeMethodInfo GetDeclaringMethod(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetDefaultConstructor(RuntimeTypeHandle handle, ObjectHandleOnStack method); - [System.Security.SecuritySafeCritical] // auto-generated internal IRuntimeMethodInfo GetDefaultConstructor() { IRuntimeMethodInfo ctor = null; @@ -530,7 +467,6 @@ namespace System return ctor; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, StackCrawlMarkHandle stackMark, @@ -543,7 +479,6 @@ namespace System return GetTypeByName(name, throwOnError, ignoreCase, reflectionOnly, ref stackMark, IntPtr.Zero, loadTypeFromPartialName); } - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref StackCrawlMark stackMark, IntPtr pPrivHostBinder, bool loadTypeFromPartialName) @@ -573,12 +508,10 @@ namespace System return GetTypeByName(name, false, false, false, ref stackMark, false); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetTypeByNameUsingCARules(string name, RuntimeModule scope, ObjectHandleOnStack type); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetTypeByNameUsingCARules(string name, RuntimeModule scope) { if (name == null || name.Length == 0) @@ -591,12 +524,10 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static void GetInstantiation(RuntimeTypeHandle type, ObjectHandleOnStack types, bool fAsRuntimeTypeArray); - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeType[] GetInstantiationInternal() { RuntimeType[] types = null; @@ -604,7 +535,6 @@ namespace System return types; } - [System.Security.SecuritySafeCritical] // auto-generated internal Type[] GetInstantiationPublic() { Type[] types = null; @@ -612,12 +542,10 @@ namespace System return types; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, int numGenericArgs, ObjectHandleOnStack type); - [System.Security.SecurityCritical] // auto-generated internal RuntimeType Instantiate(Type[] inst) { // defensive copy to be sure array is not mutated from the outside during processing @@ -633,12 +561,10 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void MakeArray(RuntimeTypeHandle handle, int rank, ObjectHandleOnStack type); - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeType MakeArray(int rank) { RuntimeType type = null; @@ -646,12 +572,10 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void MakeSZArray(RuntimeTypeHandle handle, ObjectHandleOnStack type); - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeType MakeSZArray() { RuntimeType type = null; @@ -659,12 +583,10 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void MakeByRef(RuntimeTypeHandle handle, ObjectHandleOnStack type); - [System.Security.SecuritySafeCritical] // auto-generated internal RuntimeType MakeByRef() { RuntimeType type = null; @@ -672,12 +594,10 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void MakePointer(RuntimeTypeHandle handle, ObjectHandleOnStack type); - [System.Security.SecurityCritical] // auto-generated internal RuntimeType MakePointer() { RuntimeType type = null; @@ -685,14 +605,10 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static bool IsCollectible(RuntimeTypeHandle handle); -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated -#endif [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool HasInstantiation(RuntimeType type); @@ -701,12 +617,10 @@ namespace System return HasInstantiation(GetTypeChecked()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetGenericTypeDefinition(RuntimeTypeHandle type, ObjectHandleOnStack retType); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetGenericTypeDefinition(RuntimeType type) { RuntimeType retType = type; @@ -717,11 +631,9 @@ namespace System return retType; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsGenericTypeDefinition(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsGenericVariable(RuntimeType type); @@ -730,11 +642,9 @@ namespace System return IsGenericVariable(GetTypeChecked()); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static int GetGenericVariableIndex(RuntimeType type); - [System.Security.SecuritySafeCritical] // auto-generated internal int GetGenericVariableIndex() { RuntimeType type = GetTypeChecked(); @@ -745,21 +655,17 @@ namespace System return GetGenericVariableIndex(type); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool ContainsGenericVariables(RuntimeType handle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool ContainsGenericVariables() { return ContainsGenericVariables(GetTypeChecked()); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static bool SatisfiesConstraints(RuntimeType paramType, IntPtr *pTypeContext, int typeContextLength, IntPtr *pMethodContext, int methodContextLength, RuntimeType toType); - [System.Security.SecurityCritical] internal static bool SatisfiesConstraints(RuntimeType paramType, RuntimeType[] typeContext, RuntimeType[] methodContext, RuntimeType toType) { int typeContextLength; @@ -778,17 +684,14 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static IntPtr _GetMetadataImport(RuntimeType type); - [System.Security.SecurityCritical] // auto-generated internal static MetadataImport GetMetadataImport(RuntimeType type) { return new MetadataImport(_GetMetadataImport(type), type); } - [System.Security.SecurityCritical] // auto-generated private RuntimeTypeHandle(SerializationInfo info, StreamingContext context) { if(info == null) @@ -803,7 +706,6 @@ namespace System throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } - [System.Security.SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { if(info == null) @@ -817,11 +719,9 @@ namespace System } #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool IsEquivalentTo(RuntimeType rtType1, RuntimeType rtType2); - [System.Security.SecuritySafeCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool IsEquivalentType(RuntimeType type); #endif // FEATURE_CORECLR @@ -853,14 +753,12 @@ namespace System internal IntPtr Value { - [SecurityCritical] get { return m_handle; } } - [SecurityCritical] internal RuntimeMethodHandleInternal(IntPtr value) { m_handle = value; @@ -877,7 +775,6 @@ namespace System m_value = methodHandleValue; } - [SecurityCritical] public RuntimeMethodInfoStub(IntPtr methodHandleValue, object keepalive) { m_keepalive = keepalive; @@ -946,14 +843,12 @@ namespace System } // Used by EE - [SecurityCritical] private static IntPtr GetValueInternal(RuntimeMethodHandle rmh) { return rmh.Value; } // ISerializable interface - [System.Security.SecurityCritical] // auto-generated private RuntimeMethodHandle(SerializationInfo info, StreamingContext context) { if(info == null) @@ -968,7 +863,6 @@ namespace System throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } - [System.Security.SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -986,21 +880,18 @@ namespace System public IntPtr Value { - [SecurityCritical] get { return m_value != null ? m_value.Value.Value : IntPtr.Zero; } } - [SecuritySafeCritical] public override int GetHashCode() { return ValueType.GetHashCodeOfPtr(Value); } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] public override bool Equals(object obj) { if (!(obj is RuntimeMethodHandle)) @@ -1022,7 +913,6 @@ namespace System } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] public bool Equals(RuntimeMethodHandle handle) { return handle.Value == Value; @@ -1034,12 +924,10 @@ namespace System return m_value == null; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static IntPtr GetFunctionPointer(RuntimeMethodHandleInternal handle); - [System.Security.SecurityCritical] // auto-generated public IntPtr GetFunctionPointer() { IntPtr ptr = GetFunctionPointer(EnsureNonNullMethodInfo(m_value).Value); @@ -1047,11 +935,9 @@ namespace System return ptr; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal unsafe extern static void CheckLinktimeDemands(IRuntimeMethodInfo method, RuntimeModule module, bool isDecoratedTargetSecurityTransparent); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static bool IsCAVisibleFromDecoratedType( @@ -1060,21 +946,17 @@ namespace System RuntimeTypeHandle sourceTypeHandle, RuntimeModule sourceModule); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern IRuntimeMethodInfo _GetCurrentMethod(ref StackCrawlMark stackMark); - [System.Security.SecuritySafeCritical] // auto-generated internal static IRuntimeMethodInfo GetCurrentMethod(ref StackCrawlMark stackMark) { return _GetCurrentMethod(ref stackMark); } [Pure] - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern MethodAttributes GetAttributes(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated internal static MethodAttributes GetAttributes(IRuntimeMethodInfo method) { MethodAttributes retVal = RuntimeMethodHandle.GetAttributes(method.Value); @@ -1082,16 +964,13 @@ namespace System return retVal; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern MethodImplAttributes GetImplAttributes(IRuntimeMethodInfo method); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void ConstructInstantiation(IRuntimeMethodInfo method, TypeNameFormatFlags format, StringHandleOnStack retString); - [System.Security.SecuritySafeCritical] // auto-generated internal static string ConstructInstantiation(IRuntimeMethodInfo method, TypeNameFormatFlags format) { string name = null; @@ -1099,11 +978,9 @@ namespace System return name; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeType GetDeclaringType(RuntimeMethodHandleInternal method); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetDeclaringType(IRuntimeMethodInfo method) { RuntimeType type = RuntimeMethodHandle.GetDeclaringType(method.Value); @@ -1111,11 +988,9 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetSlot(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated internal static int GetSlot(IRuntimeMethodInfo method) { Contract.Requires(method != null); @@ -1125,15 +1000,12 @@ namespace System return slot; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetMethodDef(IRuntimeMethodInfo method); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static string GetName(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated internal static string GetName(IRuntimeMethodInfo method) { string name = RuntimeMethodHandle.GetName(method.Value); @@ -1141,43 +1013,35 @@ namespace System return name; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static void* _GetUtf8Name(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated internal static Utf8String GetUtf8Name(RuntimeMethodHandleInternal method) { return new Utf8String(_GetUtf8Name(method)); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool MatchesNameHash(RuntimeMethodHandleInternal method, uint hash); - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static object InvokeMethod(object target, object[] arguments, Signature sig, bool constructor); #region Private Invocation Helpers - [System.Security.SecurityCritical] // auto-generated internal static INVOCATION_FLAGS GetSecurityFlags(IRuntimeMethodInfo handle) { return (INVOCATION_FLAGS)RuntimeMethodHandle.GetSpecialSecurityFlags(handle); } - [System.Security.SecurityCritical] // auto-generated [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); - [System.Security.SecurityCritical] static internal void PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags) { RuntimeMethodHandle.PerformSecurityCheck(obj, method.Value, parent, invocationFlags); @@ -1187,7 +1051,6 @@ namespace System #endif //!FEATURE_CORECLR #endregion - [System.Security.SecuritySafeCritical] // auto-generated [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [MethodImplAttribute(MethodImplOptions.InternalCall)] @@ -1196,62 +1059,48 @@ namespace System // This returns true if the token is SecurityTransparent: // just the token - does not consider including module/type etc. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool _IsTokenSecurityTransparent(RuntimeModule module, int metaDataToken); -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated -#else - [System.Security.SecurityCritical] -#endif internal static bool IsTokenSecurityTransparent(Module module, int metaDataToken) { return _IsTokenSecurityTransparent(module.ModuleHandle.GetRuntimeModule(), metaDataToken); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool _IsSecurityCritical(IRuntimeMethodInfo method); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsSecurityCritical(IRuntimeMethodInfo method) { return _IsSecurityCritical(method); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool _IsSecuritySafeCritical(IRuntimeMethodInfo method); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsSecuritySafeCritical(IRuntimeMethodInfo method) { return _IsSecuritySafeCritical(method); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool _IsSecurityTransparent(IRuntimeMethodInfo method); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsSecurityTransparent(IRuntimeMethodInfo method) { return _IsSecurityTransparent(method); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetMethodInstantiation(RuntimeMethodHandleInternal method, ObjectHandleOnStack types, bool fAsRuntimeTypeArray); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType[] GetMethodInstantiationInternal(IRuntimeMethodInfo method) { RuntimeType[] types = null; @@ -1260,7 +1109,6 @@ namespace System return types; } - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method) { RuntimeType[] types = null; @@ -1268,7 +1116,6 @@ namespace System return types; } - [System.Security.SecuritySafeCritical] // auto-generated internal static Type[] GetMethodInstantiationPublic(IRuntimeMethodInfo method) { RuntimeType[] types = null; @@ -1277,11 +1124,9 @@ namespace System return types; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool HasMethodInstantiation(RuntimeMethodHandleInternal method); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool HasMethodInstantiation(IRuntimeMethodInfo method) { bool fRet = RuntimeMethodHandle.HasMethodInstantiation(method.Value); @@ -1289,19 +1134,15 @@ namespace System return fRet; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsGenericMethodDefinition(RuntimeMethodHandleInternal method); - [System.Security.SecuritySafeCritical] // auto-generated internal static bool IsGenericMethodDefinition(IRuntimeMethodInfo method) { bool fRet = RuntimeMethodHandle.IsGenericMethodDefinition(method.Value); @@ -1310,16 +1151,13 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsTypicalMethodDefinition(IRuntimeMethodInfo method); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetTypicalMethodDefinition(IRuntimeMethodInfo method, ObjectHandleOnStack outMethod); - [System.Security.SecuritySafeCritical] // auto-generated internal static IRuntimeMethodInfo GetTypicalMethodDefinition(IRuntimeMethodInfo method) { if (!IsTypicalMethodDefinition(method)) @@ -1328,12 +1166,10 @@ namespace System return method; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void StripMethodInstantiation(IRuntimeMethodInfo method, ObjectHandleOnStack outMethod); - [System.Security.SecuritySafeCritical] // auto-generated internal static IRuntimeMethodInfo StripMethodInstantiation(IRuntimeMethodInfo method) { IRuntimeMethodInfo strippedMethod = method; @@ -1343,25 +1179,20 @@ namespace System return strippedMethod; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static bool IsDynamicMethod(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static void Destroy(RuntimeMethodHandleInternal method); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static Resolver GetResolver(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetCallerType(StackCrawlMarkHandle stackMark, ObjectHandleOnStack retType); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetCallerType(ref StackCrawlMark stackMark) { RuntimeType type = null; @@ -1370,14 +1201,11 @@ namespace System } [MethodImpl(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] // auto-generated internal extern static MethodBody GetMethodBody(IRuntimeMethodInfo method, RuntimeType declaringType); - [System.Security.SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] internal extern static bool IsConstructor(RuntimeMethodHandleInternal method); - [System.Security.SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] internal extern static LoaderAllocator GetLoaderAllocator(RuntimeMethodHandleInternal method); } @@ -1408,14 +1236,12 @@ namespace System internal IntPtr Value { - [SecurityCritical] get { return m_handle; } } - [SecurityCritical] internal RuntimeFieldHandleInternal(IntPtr value) { m_handle = value; @@ -1435,7 +1261,6 @@ namespace System [StructLayout(LayoutKind.Sequential)] internal class RuntimeFieldInfoStub : IRuntimeFieldInfo { - [SecuritySafeCritical] public RuntimeFieldInfoStub(IntPtr methodHandleValue, object keepalive) { m_keepalive = keepalive; @@ -1489,7 +1314,6 @@ namespace System public IntPtr Value { - [SecurityCritical] get { return m_ptr != null ? m_ptr.Value.Value : IntPtr.Zero; @@ -1501,14 +1325,12 @@ namespace System return m_ptr == null; } - [SecuritySafeCritical] public override int GetHashCode() { return ValueType.GetHashCodeOfPtr(Value); } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] public override bool Equals(object obj) { if (!(obj is RuntimeFieldHandle)) @@ -1520,7 +1342,6 @@ namespace System } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] public unsafe bool Equals(RuntimeFieldHandle handle) { return handle.Value == Value; @@ -1536,30 +1357,23 @@ namespace System return !left.Equals(right); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetName(RtFieldInfo field); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern unsafe void* _GetUtf8Name(RuntimeFieldHandleInternal field); - [System.Security.SecuritySafeCritical] // auto-generated internal static unsafe Utf8String GetUtf8Name(RuntimeFieldHandleInternal field) { return new Utf8String(_GetUtf8Name(field)); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool MatchesNameHash(RuntimeFieldHandleInternal handle, uint hash); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern FieldAttributes GetAttributes(RuntimeFieldHandleInternal field); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeType GetApproxDeclaringType(RuntimeFieldHandleInternal field); - [System.Security.SecurityCritical] // auto-generated internal static RuntimeType GetApproxDeclaringType(IRuntimeFieldInfo field) { RuntimeType type = GetApproxDeclaringType(field.Value); @@ -1567,77 +1381,62 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetToken(RtFieldInfo field); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, ref bool domainInitialized); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern Object GetValueDirect(RtFieldInfo field, RuntimeType fieldType, void *pTypedRef, RuntimeType contextType); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SetValue(RtFieldInfo field, Object obj, Object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SetValueDirect(RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, Object value, RuntimeType contextType); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeFieldHandleInternal GetStaticFieldForGenericType(RuntimeFieldHandleInternal field, RuntimeType declaringType); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool AcquiresContextFromThis(RuntimeFieldHandleInternal field); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecurityCritical(RuntimeFieldHandle fieldHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecurityCritical() { return IsSecurityCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecuritySafeCritical(RuntimeFieldHandle fieldHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecuritySafeCritical() { return IsSecuritySafeCritical(GetNativeHandle()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsSecurityTransparent(RuntimeFieldHandle fieldHandle); - [System.Security.SecuritySafeCritical] // auto-generated internal bool IsSecurityTransparent() { return IsSecurityTransparent(GetNativeHandle()); } - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void CheckAttributeAccess(RuntimeFieldHandle fieldHandle, RuntimeModule decoratedTarget); // ISerializable interface - [System.Security.SecurityCritical] // auto-generated private RuntimeFieldHandle(SerializationInfo info, StreamingContext context) { if(info==null) @@ -1655,7 +1454,6 @@ namespace System throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } - [System.Security.SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -1739,11 +1537,9 @@ namespace System return !left.Equals(right); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern IRuntimeMethodInfo GetDynamicMethod(DynamicMethod method, RuntimeModule module, string name, byte[] sig, Resolver resolver); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetToken(RuntimeModule module); @@ -1765,7 +1561,6 @@ namespace System return new RuntimeTypeHandle(ModuleHandle.ResolveTypeHandleInternal(GetRuntimeModule(), typeToken, typeInstantiationContext, methodInstantiationContext)); } - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType ResolveTypeHandleInternal(RuntimeModule module, int typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) { ValidateModulePointer(module); @@ -1787,7 +1582,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void ResolveType(RuntimeModule module, @@ -1807,7 +1601,6 @@ namespace System return new RuntimeMethodHandle(ResolveMethodHandleInternal(GetRuntimeModule(), methodToken, typeInstantiationContext, methodInstantiationContext)); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IRuntimeMethodInfo ResolveMethodHandleInternal(RuntimeModule module, int methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) { int typeInstCount, methodInstCount; @@ -1822,7 +1615,6 @@ namespace System return retVal; } - [System.Security.SecurityCritical] // auto-generated internal static RuntimeMethodHandleInternal ResolveMethodHandleInternalCore(RuntimeModule module, int methodToken, IntPtr[] typeInstantiationContext, int typeInstCount, IntPtr[] methodInstantiationContext, int methodInstCount) { ValidateModulePointer(module); @@ -1836,7 +1628,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static RuntimeMethodHandleInternal ResolveMethod(RuntimeModule module, @@ -1852,7 +1643,6 @@ namespace System public RuntimeFieldHandle ResolveFieldHandle(int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) { return new RuntimeFieldHandle(ResolveFieldHandleInternal(GetRuntimeModule(), fieldToken, typeInstantiationContext, methodInstantiationContext)); } - [System.Security.SecuritySafeCritical] // auto-generated internal static IRuntimeFieldInfo ResolveFieldHandleInternal(RuntimeModule module, int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) { ValidateModulePointer(module); @@ -1875,7 +1665,6 @@ namespace System } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void ResolveField(RuntimeModule module, @@ -1886,23 +1675,19 @@ namespace System int methodInstCount, ObjectHandleOnStack retField); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static bool _ContainsPropertyMatchingHash(RuntimeModule module, int propertyToken, uint hash); - [System.Security.SecurityCritical] // auto-generated internal static bool ContainsPropertyMatchingHash(RuntimeModule module, int propertyToken, uint hash) { return _ContainsPropertyMatchingHash(module.GetNativeHandle(), propertyToken, hash); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetAssembly(RuntimeModule handle, ObjectHandleOnStack retAssembly); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeAssembly GetAssembly(RuntimeModule module) { RuntimeAssembly retAssembly = null; @@ -1910,12 +1695,10 @@ namespace System return retAssembly; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal extern static void GetModuleType(RuntimeModule handle, ObjectHandleOnStack type); - [System.Security.SecuritySafeCritical] // auto-generated internal static RuntimeType GetModuleType(RuntimeModule module) { RuntimeType type = null; @@ -1923,13 +1706,11 @@ namespace System return type; } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private extern static void GetPEKind(RuntimeModule handle, out int peKind, out int machine); // making this internal, used by Module.GetPEKind - [System.Security.SecuritySafeCritical] // auto-generated internal static void GetPEKind(RuntimeModule module, out PortableExecutableKinds peKind, out ImageFileMachine machine) { int lKind, lMachine; @@ -1938,21 +1719,17 @@ namespace System machine = (ImageFileMachine)lMachine; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int GetMDStreamVersion(RuntimeModule module); public int MDStreamVersion { - [System.Security.SecuritySafeCritical] // auto-generated get { return GetMDStreamVersion(GetRuntimeModule().GetNativeHandle()); } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static IntPtr _GetMetadataImport(RuntimeModule module); - [System.Security.SecurityCritical] // auto-generated internal static MetadataImport GetMetadataImport(RuntimeModule module) { return new MetadataImport(_GetMetadataImport(module.GetNativeHandle()), module); @@ -1985,7 +1762,6 @@ namespace System #endregion #region FCalls - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void GetSignature( void* pCorSig, int cCorSig, @@ -2001,7 +1777,6 @@ namespace System internal RuntimeType m_declaringType; internal RuntimeType m_returnTypeORfieldType; internal object m_keepalive; - [SecurityCritical] internal void* m_sig; internal int m_managedCallingConventionAndArgIteratorFlags; // lowest byte is CallingConvention, upper 3 bytes are ArgIterator flags internal int m_nSizeOfArgStack; @@ -2010,7 +1785,6 @@ namespace System #endregion #region Constructors - [System.Security.SecuritySafeCritical] // auto-generated public Signature ( IRuntimeMethodInfo method, RuntimeType[] arguments, @@ -2025,20 +1799,17 @@ namespace System GetSignature(null, 0, new RuntimeFieldHandleInternal(), method, null); } - [System.Security.SecuritySafeCritical] // auto-generated public Signature(IRuntimeMethodInfo methodHandle, RuntimeType declaringType) { GetSignature(null, 0, new RuntimeFieldHandleInternal(), methodHandle, declaringType); } - [System.Security.SecurityCritical] // auto-generated public Signature(IRuntimeFieldInfo fieldHandle, RuntimeType declaringType) { GetSignature(null, 0, fieldHandle.Value, null, declaringType); GC.KeepAlive(fieldHandle); } - [System.Security.SecurityCritical] // auto-generated public Signature(void* pCorSig, int cCorSig, RuntimeType declaringType) { GetSignature(pCorSig, cCorSig, new RuntimeFieldHandleInternal(), null, declaringType); @@ -2051,11 +1822,9 @@ namespace System internal RuntimeType ReturnType { get { return m_returnTypeORfieldType; } } internal RuntimeType FieldType { get { return m_returnTypeORfieldType; } } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool CompareSig(Signature sig1, Signature sig2); - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern Type[] GetCustomModifiers(int position, bool required); #endregion @@ -2078,12 +1847,10 @@ namespace System internal abstract RuntimeType GetJitContext(ref int securityControlFlags); internal abstract byte[] GetCodeInfo(ref int stackSize, ref int initLocals, ref int EHCount); internal abstract byte[] GetLocalsSignature(); - [System.Security.SecurityCritical] // takes a pointer parameter internal abstract unsafe void GetEHInfo(int EHNumber, void* exception); internal abstract unsafe byte[] GetRawEHInfo(); // token resolution internal abstract String GetStringLiteral(int token); - [System.Security.SecurityCritical] // passes a pointer out internal abstract void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle); internal abstract byte[] ResolveSignature(int token, int fromMethod); // diff --git a/src/coreclr/src/mscorlib/src/System/SByte.cs b/src/coreclr/src/mscorlib/src/System/SByte.cs index a9ec9cf..da6ac5c 100644 --- a/src/coreclr/src/mscorlib/src/System/SByte.cs +++ b/src/coreclr/src/mscorlib/src/System/SByte.cs @@ -73,13 +73,11 @@ namespace System { // Provides a string representation of a byte. - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatInt32(m_value, null, NumberFormatInfo.GetInstance(provider)); @@ -95,7 +93,6 @@ namespace System { return ToString(format, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated private String ToString(String format, NumberFormatInfo info) { Contract.Ensures(Contract.Result() != null); diff --git a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs index 16f3a5b..c3e22b0 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs @@ -19,14 +19,12 @@ namespace System.Security [Serializable] #if !FEATURE_CORECLR - [SecurityPermissionAttribute( SecurityAction.InheritanceDemand, ControlEvidence = true, ControlPolicy = true )] #endif [System.Runtime.InteropServices.ComVisible(true)] abstract public class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk { // Static methods for manipulation of stack - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static void RevertAssert() { @@ -34,7 +32,6 @@ namespace System.Security SecurityRuntime.RevertAssert(ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public static void RevertDeny() @@ -43,7 +40,6 @@ namespace System.Security SecurityRuntime.RevertDeny(ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static void RevertPermitOnly() { @@ -51,7 +47,6 @@ namespace System.Security SecurityRuntime.RevertPermitOnly(ref stackMark); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static void RevertAll() { @@ -66,7 +61,6 @@ namespace System.Security // Mark this method as requiring a security object on the caller's frame // so the caller won't be inlined (which would mess up stack crawling). - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void Demand() @@ -78,7 +72,6 @@ namespace System.Security } } - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static void Demand(PermissionType permissionType) @@ -96,7 +89,6 @@ namespace System.Security // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void Assert() @@ -106,7 +98,6 @@ namespace System.Security } - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable static internal void Assert(bool allPossible) @@ -124,7 +115,6 @@ namespace System.Security // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] @@ -137,7 +127,6 @@ namespace System.Security // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void PermitOnly() diff --git a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs index ca65cc1..e31fe6a 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs @@ -52,11 +52,9 @@ namespace System.Security { internal static SecurityPermission AssertPermission; internal static PermissionToken AssertPermissionToken; - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SpecialDemand(PermissionType whatPermission, ref StackCrawlMark stackMark); - [System.Security.SecurityCritical] // auto-generated [System.Diagnostics.Conditional( "_DEBUG" )] private static void DEBUG_OUT( String str ) { @@ -96,7 +94,6 @@ namespace System.Security { AssertPermissionToken = PermissionToken.GetToken(AssertPermission); } - [System.Security.SecurityCritical] // auto-generated #pragma warning disable 618 private static void ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) #pragma warning restore 618 @@ -113,7 +110,6 @@ namespace System.Security { throw SecurityException.MakeSecurityException(asmName, asmEvidence, granted, refused, rmh, action, demand, permThatFailed); } - [System.Security.SecurityCritical] // auto-generated #pragma warning disable 618 private static void ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) #pragma warning restore 618 @@ -130,7 +126,6 @@ namespace System.Security { } #if FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated internal static void CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, @@ -145,9 +140,6 @@ namespace System.Security { CheckSetHelper(grants, refused, demands, rmh, (Object)asm, action, true); } #else // FEATURE_COMPRESSEDSTACK - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif #pragma warning disable 618 internal static void CheckSetHelper(Object notUsed, PermissionSet grants, @@ -168,7 +160,6 @@ namespace System.Security { #endif // FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated #pragma warning disable 618 internal static bool CheckSetHelper(PermissionSet grants, PermissionSet refused, @@ -232,7 +223,6 @@ namespace System.Security { return true; } #if FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated internal static void CheckHelper(CompressedStack cs, PermissionSet grantedSet, PermissionSet refusedSet, @@ -248,9 +238,6 @@ namespace System.Security { CheckHelper(grantedSet, refusedSet, demand, permToken, rmh, (Object)asm, action, true); } #else // FEATURE_COMPRESSEDSTACK - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif #pragma warning disable 618 internal static void CheckHelper(Object notUsed, PermissionSet grantedSet, @@ -269,7 +256,6 @@ namespace System.Security { CheckHelper(grantedSet, refusedSet, demand, permToken, rmh, (Object)asm, action, true); } #endif // FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated #pragma warning disable 618 internal static bool CheckHelper(PermissionSet grantedSet, PermissionSet refusedSet, @@ -383,42 +369,35 @@ namespace System.Security { return true; } - [System.Security.SecurityCritical] // auto-generated internal static void Check(CodeAccessPermission cap, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void Check(PermissionSet permSet, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern FrameSecurityDescriptor CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, ref StackCrawlMark stackMark, int create ); - [System.Security.SecurityCritical] // auto-generated internal static void Assert(CodeAccessPermission cap, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void Deny(CodeAccessPermission cap, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void PermitOnly(CodeAccessPermission cap, ref StackCrawlMark stackMark) { } #if FEATURE_PLS // Update the PLS used for optimization in the AppDomain: called from the VM - [System.Security.SecurityCritical] // auto-generated private static PermissionListSet UpdateAppDomainPLS(PermissionListSet adPLS, PermissionSet grantedPerms, PermissionSet refusedPerms) { if (adPLS == null) { adPLS = new PermissionListSet(); diff --git a/src/coreclr/src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs b/src/coreclr/src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs index f49a377..5e9dab8 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs @@ -40,10 +40,8 @@ namespace System.Security { // if this frame contains a call to any WindowsIdentity.Impersonate(), // we save the previous SafeTokenHandles here (in the next two fields) // Used during exceptionstackwalks to revert impersonation before calling filters - [System.Security.SecurityCritical] // auto-generated [NonSerialized] private SafeAccessTokenHandle m_callerToken; - [System.Security.SecurityCritical] // auto-generated [NonSerialized] private SafeAccessTokenHandle m_impToken; #endif @@ -56,16 +54,12 @@ namespace System.Security { - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void IncrementOverridesCount(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void DecrementOverridesCount(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void IncrementAssertCount(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void DecrementAssertCount(); @@ -105,14 +99,12 @@ namespace System.Security { // we store declarative actions in both fields, so check if they are different return (m_restriction != null); } - [System.Security.SecurityCritical] // auto-generated internal void SetAssert(IPermission perm) { m_assertions = CreateSingletonSet(perm); IncrementAssertCount(); } - [System.Security.SecurityCritical] // auto-generated internal void SetAssert(PermissionSet permSet) { m_assertions = permSet.Copy(); @@ -125,7 +117,6 @@ namespace System.Security { return (fDeclarative) ? m_DeclarativeAssertions : m_assertions; } - [System.Security.SecurityCritical] // auto-generated internal void SetAssertAllPossible() { m_assertAllPossible = true; @@ -141,14 +132,12 @@ namespace System.Security { // D E N Y //-----------------------------------------------------------+ - [System.Security.SecurityCritical] // auto-generated internal void SetDeny(IPermission perm) { m_denials = CreateSingletonSet(perm); IncrementOverridesCount(); } - [System.Security.SecurityCritical] // auto-generated internal void SetDeny(PermissionSet permSet) { m_denials = permSet.Copy(); @@ -164,14 +153,12 @@ namespace System.Security { // R E S T R I C T //-----------------------------------------------------------+ - [System.Security.SecurityCritical] // auto-generated internal void SetPermitOnly(IPermission perm) { m_restriction = CreateSingletonSet(perm); IncrementOverridesCount(); } - [System.Security.SecurityCritical] // auto-generated internal void SetPermitOnly(PermissionSet permSet) { // permSet must not be null @@ -188,7 +175,6 @@ namespace System.Security { //-----------------------------------------------------------+ // SafeAccessTokenHandle (Impersonation + EH purposes) //-----------------------------------------------------------+ - [System.Security.SecurityCritical] // auto-generated internal void SetTokenHandles (SafeAccessTokenHandle callerToken, SafeAccessTokenHandle impToken) { m_callerToken = callerToken; @@ -199,7 +185,6 @@ namespace System.Security { // R E V E R T //-----------------------------------------------------------+ - [System.Security.SecurityCritical] // auto-generated internal void RevertAssert() { if (m_assertions != null) @@ -219,7 +204,6 @@ namespace System.Security { } } - [System.Security.SecurityCritical] // auto-generated internal void RevertAssertAllPossible() { if (m_assertAllPossible) @@ -229,7 +213,6 @@ namespace System.Security { } } - [System.Security.SecurityCritical] // auto-generated internal void RevertDeny() { if (HasImperativeDenials()) @@ -239,7 +222,6 @@ namespace System.Security { } } - [System.Security.SecurityCritical] // auto-generated internal void RevertPermitOnly() { if (HasImperativeRestrictions()) @@ -249,7 +231,6 @@ namespace System.Security { } } - [System.Security.SecurityCritical] // auto-generated internal void RevertAll() { RevertAssert(); @@ -265,7 +246,6 @@ namespace System.Security { // This will get called when we hit a FSD while evaluating a demand on the call stack or compressedstack - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh) { // imperative security @@ -278,7 +258,6 @@ namespace System.Security { return fContinue; } - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemand2(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh, bool fDeclarative) { PermissionSet permSet; @@ -392,7 +371,6 @@ namespace System.Security { return SecurityRuntime.StackContinue; } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemand(PermissionSet demandSet, out PermissionSet alteredDemandSet, RuntimeMethodHandleInternal rmh) @@ -424,7 +402,6 @@ namespace System.Security { return fContinue; } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemand2(PermissionSet demandSet, out PermissionSet alteredDemandSet, RuntimeMethodHandleInternal rmh, bool fDeclarative) diff --git a/src/coreclr/src/mscorlib/src/System/Security/HostProtectionException.cs b/src/coreclr/src/mscorlib/src/System/Security/HostProtectionException.cs index ffdc607..b08fccd 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/HostProtectionException.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/HostProtectionException.cs @@ -120,7 +120,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) diff --git a/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs b/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs index 2da75ce..ba59303 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs @@ -34,10 +34,8 @@ namespace System.Security AllFlags = 0x001F } - [System.Security.SecurityCritical] // auto-generated_required [Serializable] #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.Infrastructure)] #endif [System.Runtime.InteropServices.ComVisible(true)] public class HostSecurityManager { diff --git a/src/coreclr/src/mscorlib/src/System/Security/PermissionListSet.cs b/src/coreclr/src/mscorlib/src/System/Security/PermissionListSet.cs index 7eb13a7..cb2ac30 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/PermissionListSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/PermissionListSet.cs @@ -53,13 +53,11 @@ namespace System.Security } #if FEATURE_PLS - [System.Security.SecurityCritical] // auto-generated internal void UpdateDomainPLS (PermissionListSet adPLS) { if (adPLS != null && adPLS.m_firstPermSetTriple != null) UpdateDomainPLS(adPLS.m_firstPermSetTriple.GrantSet, adPLS.m_firstPermSetTriple.RefusedSet); } - [System.Security.SecurityCritical] // auto-generated internal void UpdateDomainPLS (PermissionSet grantSet, PermissionSet deniedSet) { Contract.Assert(m_permSetTriples == null, "m_permSetTriples != null"); if (m_firstPermSetTriple == null) @@ -76,7 +74,6 @@ namespace System.Security UpdateTripleListAndCreateNewTriple(currentTriple, null); } - [System.Security.SecurityCritical] // auto-generated private void Terminate(PermissionSetTriple currentTriple, PermissionListSet pls) { #if FEATURE_COMPRESSEDSTACK @@ -86,7 +83,6 @@ namespace System.Security this.UpdateTripleListAndCreateNewTriple(currentTriple, null); } - [System.Security.SecurityCritical] // auto-generated private bool Update(PermissionSetTriple currentTriple, PermissionListSet pls) { #if FEATURE_COMPRESSEDSTACK @@ -95,7 +91,6 @@ namespace System.Security return this.UpdatePermissions(currentTriple, pls); } - [System.Security.SecurityCritical] // auto-generated private bool Update(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd) { #if FEATURE_COMPRESSEDSTACK @@ -117,7 +112,6 @@ namespace System.Security } #if FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptorWithResolver fsdWithResolver) { System.Reflection.Emit.DynamicResolver resolver = fsdWithResolver.Resolver; @@ -127,7 +121,6 @@ namespace System.Security } #endif // FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd, bool fDeclarative) { // Deny @@ -187,7 +180,6 @@ namespace System.Security return false; } - [System.Security.SecurityCritical] // auto-generated private void Update(PermissionSetTriple currentTriple, PermissionSet in_g, PermissionSet in_r) { #if FEATURE_COMPRESSEDSTACK @@ -203,7 +195,6 @@ namespace System.Security } // Called from the VM for HG CS construction - [System.Security.SecurityCritical] // auto-generated private void Update(PermissionSet in_g) { if (m_firstPermSetTriple == null) @@ -226,7 +217,6 @@ namespace System.Security } #endif // FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] // auto-generated private bool UpdatePermissions(PermissionSetTriple currentTriple, PermissionListSet pls) { if (pls != null) @@ -322,7 +312,6 @@ namespace System.Security } } -[System.Security.SecurityCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] // public(internal) interface begins... // Creation functions @@ -370,7 +359,6 @@ namespace System.Security return pls; } - [System.Security.SecurityCritical] // auto-generated static internal PermissionListSet CreateCompressedState(IntPtr unmanagedDCS, out bool bHaltConstruction) { PermissionListSet pls = new PermissionListSet(); @@ -411,7 +399,6 @@ namespace System.Security return pls; } - [System.Security.SecurityCritical] // auto-generated static internal PermissionListSet CreateCompressedState_HG() { PermissionListSet pls = new PermissionListSet(); @@ -420,7 +407,6 @@ namespace System.Security } #endif // #if FEATURE_COMPRESSEDSTACK // Private Demand evaluation functions - only called from the VM - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemandNoThrow(CodeAccessPermission demand) { // AppDomain permissions - no asserts. So there should only be one triple to work with @@ -436,7 +422,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemandNoThrow(PermissionSet pSet) { // AppDomain permissions - no asserts. So there should only be one triple to work with @@ -447,7 +432,6 @@ namespace System.Security } // Demand evauation functions - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh) { bool bRet = SecurityRuntime.StackContinue; @@ -467,7 +451,6 @@ namespace System.Security return bRet; } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemand(PermissionSet pset , RuntimeMethodHandleInternal rmh) { PermissionSet unused; @@ -475,7 +458,6 @@ namespace System.Security return SecurityRuntime.StackHalt; // CS demand check always terminates the stackwalk } - [System.Security.SecurityCritical] internal bool CheckSetDemandWithModification(PermissionSet pset, out PermissionSet alteredDemandSet, RuntimeMethodHandleInternal rmh) { bool bRet = SecurityRuntime.StackContinue; @@ -503,7 +485,6 @@ namespace System.Security /// Check to see if the PLS satisfies a demand for the special permissions encoded in flags /// /// set of flags to check (See PermissionType) - [System.Security.SecurityCritical] // auto-generated private bool CheckFlags(int flags) { Contract.Assert(flags != 0, "Invalid permission flag demand"); @@ -531,7 +512,6 @@ namespace System.Security /// /// set of flags to check (See PermissionType) /// alternate permission set to check - [System.Security.SecurityCritical] // auto-generated internal void DemandFlagsOrGrantSet(int flags, PermissionSet grantSet) { if (CheckFlags(flags)) diff --git a/src/coreclr/src/mscorlib/src/System/Security/PermissionSet.cs b/src/coreclr/src/mscorlib/src/System/Security/PermissionSet.cs index a587ae1..ed98e47 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/PermissionSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/PermissionSet.cs @@ -1111,7 +1111,6 @@ namespace System.Security { // Mark this method as requiring a security object on the caller's frame // so the caller won't be inlined (which would mess up stack crawling). - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void Demand() @@ -1132,7 +1131,6 @@ namespace System.Security { } } - [System.Security.SecurityCritical] // auto-generated internal void DemandNonCAS() { ContainsNonCodeAccessPermissions(); @@ -1155,7 +1153,6 @@ namespace System.Security { // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void Assert() @@ -1167,7 +1164,6 @@ namespace System.Security { // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable [Obsolete("Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] @@ -1180,7 +1176,6 @@ namespace System.Security { // Metadata for this method should be flaged with REQ_SQ so that // EE can allocate space on the stack frame for FrameSecurityDescriptor - [System.Security.SecuritySafeCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public void PermitOnly() @@ -1289,7 +1284,6 @@ namespace System.Security { // Determines whether the permission set contains any non-code access // security permissions. - [System.Security.SecurityCritical] // auto-generated public bool ContainsNonCodeAccessPermissions() { if (m_CheckedForNonCas) @@ -1389,9 +1383,6 @@ namespace System.Security { } // Converts an array of SecurityAttributes to a PermissionSet - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif private static byte[] CreateSerialized(Object[] attrs, bool serialize, ref byte[] nonCasBlob, @@ -1475,7 +1466,6 @@ namespace System.Security { } #endif - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static void RevertAssert() { diff --git a/src/coreclr/src/mscorlib/src/System/Security/PermissionSetTriple.cs b/src/coreclr/src/mscorlib/src/System/Security/PermissionSetTriple.cs index f1527ac..25e0177 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/PermissionSetTriple.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/PermissionSetTriple.cs @@ -53,7 +53,6 @@ namespace System.Security private PermissionToken ZoneToken { - [System.Security.SecurityCritical] // auto-generated get { if (s_zoneToken == null) @@ -63,7 +62,6 @@ namespace System.Security } private PermissionToken UrlToken { - [System.Security.SecurityCritical] // auto-generated get { if (s_urlToken == null) @@ -71,7 +69,6 @@ namespace System.Security return s_urlToken; } } - [System.Security.SecurityCritical] // auto-generated internal bool Update(PermissionSetTriple psTriple, out PermissionSetTriple retTriple) { retTriple = null; @@ -86,7 +83,6 @@ namespace System.Security return false; } - [System.Security.SecurityCritical] // auto-generated internal PermissionSetTriple UpdateAssert(PermissionSet in_a) { PermissionSetTriple retTriple = null; @@ -128,7 +124,6 @@ namespace System.Security } return retTriple; } - [System.Security.SecurityCritical] // auto-generated internal void UpdateGrant(PermissionSet in_g, out ZoneIdentityPermission z,out UrlIdentityPermission u) { z = null; @@ -145,7 +140,6 @@ namespace System.Security } } - [System.Security.SecurityCritical] // auto-generated internal void UpdateGrant(PermissionSet in_g) { if (in_g != null) @@ -168,7 +162,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated static bool CheckAssert(PermissionSet pSet, CodeAccessPermission demand, PermissionToken permToken) { if (pSet != null) @@ -193,7 +186,6 @@ namespace System.Security return SecurityRuntime.StackContinue; } - [System.Security.SecurityCritical] // auto-generated static bool CheckAssert(PermissionSet assertPset, PermissionSet demandSet, out PermissionSet newDemandSet) { newDemandSet = null; @@ -210,7 +202,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh) { if (CheckAssert(AssertSet, demand, permToken) == SecurityRuntime.StackHalt) @@ -222,7 +213,6 @@ namespace System.Security return SecurityRuntime.StackContinue; } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemand(PermissionSet demandSet , out PermissionSet alteredDemandset, RuntimeMethodHandleInternal rmh) { alteredDemandset = null; @@ -239,7 +229,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated internal bool CheckDemandNoThrow(CodeAccessPermission demand, PermissionToken permToken) { Contract.Assert(AssertSet == null, "AssertSet not null"); @@ -247,7 +236,6 @@ namespace System.Security return CodeAccessSecurityEngine.CheckHelper(GrantSet, RefusedSet, demand, permToken, RuntimeMethodHandleInternal.EmptyHandle, null, SecurityAction.Demand, false); #pragma warning restore 618 } - [System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemandNoThrow(PermissionSet demandSet) { Contract.Assert(AssertSet == null, "AssertSet not null"); @@ -263,7 +251,6 @@ namespace System.Security /// If the triple asserts for one of the bits in the flags, it is zeroed out. /// /// set of flags to check (See PermissionType) - [System.Security.SecurityCritical] // auto-generated internal bool CheckFlags(ref int flags) { if (AssertSet != null) diff --git a/src/coreclr/src/mscorlib/src/System/Security/PermissionToken.cs b/src/coreclr/src/mscorlib/src/System/Security/PermissionToken.cs index f6df2c5..3d69fdc 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/PermissionToken.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/PermissionToken.cs @@ -35,7 +35,6 @@ namespace System.Security _info = CultureInfo.InvariantCulture.TextInfo; } - [System.Security.SecuritySafeCritical] // auto-generated public int Compare(Object a, Object b) { String strA = a as String; @@ -137,7 +136,6 @@ namespace System.Security m_type = type; } - [System.Security.SecurityCritical] // auto-generated public static PermissionToken GetToken(Type cls) { if (cls == null) @@ -228,7 +226,6 @@ namespace System.Security return token; } - [SecuritySafeCritical] internal PermissionToken GetToken(Type cls, IPermission perm) { Contract.Assert( cls != null, "Must pass in valid type" ); diff --git a/src/coreclr/src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs index 23b4517..567fe51 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs @@ -56,7 +56,6 @@ namespace System.Security.Permissions { return str; } - [SecuritySafeCritical] public override string ToString() { // SafeCritical: we're not storing path information in the strings, so exposing them out is fine ... @@ -103,7 +102,6 @@ namespace System.Security.Permissions { AddPathList( flag, pathList ); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddPathList( EnvironmentPermissionAccess flag, String pathList ) { VerifyFlag( flag ); @@ -204,7 +202,6 @@ namespace System.Security.Permissions { // //------------------------------------------------------ - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsSubsetOf(IPermission target) { if (target == null) @@ -232,7 +229,6 @@ namespace System.Security.Permissions { } } - [System.Security.SecuritySafeCritical] // auto-generated public override IPermission Intersect(IPermission target) { if (target == null) @@ -275,7 +271,6 @@ namespace System.Security.Permissions { return intersectPermission; } - [System.Security.SecuritySafeCritical] // auto-generated public override IPermission Union(IPermission other) { if (other == null) diff --git a/src/coreclr/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs index 0797485..5ac0609 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs @@ -59,7 +59,6 @@ namespace System.Security.Permissions } } - [System.Security.SecuritySafeCritical] // auto-generated public FileIOPermission( FileIOPermissionAccess access, String path ) { VerifyAccess( access ); @@ -68,7 +67,6 @@ namespace System.Security.Permissions AddPathList( access, pathList, false, true, false ); } - [System.Security.SecuritySafeCritical] // auto-generated public FileIOPermission( FileIOPermissionAccess access, String[] pathList ) { VerifyAccess( access ); @@ -76,7 +74,6 @@ namespace System.Security.Permissions AddPathList( access, pathList, false, true, false ); } - [System.Security.SecurityCritical] // auto-generated internal FileIOPermission( FileIOPermissionAccess access, String[] pathList, bool checkForDuplicates, bool needFullPath ) { VerifyAccess( access ); @@ -105,7 +102,6 @@ namespace System.Security.Permissions SetPathList( access, AccessControlActions.None, pathList, checkForDuplicates ); } - [System.Security.SecuritySafeCritical] // auto-generated internal void SetPathList( FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates ) { VerifyAccess( access ); @@ -129,7 +125,6 @@ namespace System.Security.Permissions AddPathList( access, pathList, checkForDuplicates, true, true ); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddPathList( FileIOPermissionAccess access, String path ) { String[] pathList; @@ -140,19 +135,16 @@ namespace System.Security.Permissions AddPathList( access, pathList, false, true, false ); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddPathList( FileIOPermissionAccess access, String[] pathList ) { AddPathList( access, pathList, true, true, true ); } - [System.Security.SecurityCritical] // auto-generated internal void AddPathList( FileIOPermissionAccess access, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList ) { AddPathList( access, AccessControlActions.None, pathListOrig, checkForDuplicates, needFullPath, copyPathList ); } - [System.Security.SecurityCritical] // auto-generated internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList) { if (pathListOrig == null) @@ -227,7 +219,6 @@ namespace System.Security.Permissions } } - [SecuritySafeCritical] public String[] GetPathList( FileIOPermissionAccess access ) { VerifyAccess( access ); @@ -813,7 +804,6 @@ namespace System.Security.Permissions /// /// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify /// - [System.Security.SecuritySafeCritical] internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates = false, bool needFullPath = false) { EmulateFileIOPermissionChecks(fullPath); @@ -829,7 +819,6 @@ namespace System.Security.Permissions /// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify /// /// - [System.Security.SecuritySafeCritical] internal static void QuickDemand(FileIOPermissionAccess access, string[] fullPathList, bool checkForDuplicates = false, bool needFullPath = true) { foreach (string fullPath in fullPathList) @@ -838,7 +827,6 @@ namespace System.Security.Permissions } } - [System.Security.SecuritySafeCritical] internal static void QuickDemand(PermissionState state) { // Should be a no-op without CAS @@ -907,7 +895,6 @@ namespace System.Security.Permissions m_pathDiscovery = pathDiscovery; } - [System.Security.SecurityCritical] // auto-generated public FileIOAccess( String value ) { if (value == null) @@ -962,7 +949,6 @@ namespace System.Security.Permissions m_pathDiscovery = operand.m_pathDiscovery; } - [System.Security.SecurityCritical] // auto-generated public void AddExpressions(ArrayList values, bool checkForDuplicates) { m_allFiles = false; @@ -1013,7 +999,6 @@ namespace System.Security.Permissions return new FileIOAccess( this ); } - [System.Security.SecuritySafeCritical] // auto-generated public FileIOAccess Union( FileIOAccess operand ) { if (operand == null) @@ -1031,7 +1016,6 @@ namespace System.Security.Permissions return new FileIOAccess( this.m_set.Union( operand.m_set ), false, this.m_allLocalFiles || operand.m_allLocalFiles, this.m_pathDiscovery ); } - [System.Security.SecuritySafeCritical] // auto-generated public FileIOAccess Intersect( FileIOAccess operand ) { if (operand == null) @@ -1101,7 +1085,6 @@ namespace System.Security.Permissions return new FileIOAccess( intersectionSet, false, this.m_allLocalFiles && operand.m_allLocalFiles, this.m_pathDiscovery ); } - [System.Security.SecuritySafeCritical] // auto-generated public bool IsSubsetOf( FileIOAccess operand ) { if (operand == null) @@ -1158,7 +1141,6 @@ namespace System.Security.Permissions } } - [SecuritySafeCritical] public override String ToString() { // SafeCritical: all string expression sets are constructed with the throwOnRelative bit set, so @@ -1187,7 +1169,6 @@ namespace System.Security.Permissions } } - [SecuritySafeCritical] public String[] ToStringArray() { // SafeCritical: all string expression sets are constructed with the throwOnRelative bit set, so @@ -1195,12 +1176,10 @@ namespace System.Security.Permissions return m_set.UnsafeToStringArray(); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern bool IsLocalDrive(String path); - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(Object obj) { FileIOAccess operand = obj as FileIOAccess; diff --git a/src/coreclr/src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs b/src/coreclr/src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs index 3e41c72..b6ac8ec 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs @@ -88,7 +88,6 @@ namespace System.Security.Permissions abstract public IPermission CreatePermission(); - [System.Security.SecurityCritical] // auto-generated internal static unsafe IntPtr FindSecurityAttributeTypeHandle(String typeName) { PermissionSet.s_fullTrust.Assert(); diff --git a/src/coreclr/src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs index af6c5d4..c0c51e9 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs @@ -82,7 +82,6 @@ namespace System.Security.Permissions AddPathList( access, AccessControlActions.None, pathList ); } - [System.Security.SecuritySafeCritical] // auto-generated public void AddPathList( RegistryPermissionAccess access, AccessControlActions control, String pathList ) { VerifyAccess( access ); @@ -109,7 +108,6 @@ namespace System.Security.Permissions } } - [SecuritySafeCritical] public String GetPathList( RegistryPermissionAccess access ) { // SafeCritical: these are registry paths, which means we're not leaking file system information here @@ -194,7 +192,6 @@ namespace System.Security.Permissions // //------------------------------------------------------ - [System.Security.SecuritySafeCritical] // auto-generated public override bool IsSubsetOf(IPermission target) { if (target == null) @@ -218,7 +215,6 @@ namespace System.Security.Permissions (this.m_changeAcl == null || this.m_changeAcl.IsSubsetOf( operand.m_changeAcl ))); } - [System.Security.SecuritySafeCritical] // auto-generated public override IPermission Intersect(IPermission target) { if (target == null) @@ -270,7 +266,6 @@ namespace System.Security.Permissions return intersectPermission; } - [System.Security.SecuritySafeCritical] // auto-generated public override IPermission Union(IPermission other) { if (other == null) diff --git a/src/coreclr/src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs b/src/coreclr/src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs index 079db0e..3d4e35a 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs @@ -118,10 +118,6 @@ namespace System.Security.Policy } } -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] -#pragma warning restore 618 - [SecuritySafeCritical] public override EvidenceBase Clone() { return base.Clone(); diff --git a/src/coreclr/src/mscorlib/src/System/Security/Policy/EvidenceBase.cs b/src/coreclr/src/mscorlib/src/System/Security/Policy/EvidenceBase.cs index f142ebe..3875793 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Policy/EvidenceBase.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Policy/EvidenceBase.cs @@ -22,9 +22,6 @@ namespace System.Security.Policy /// [ComVisible(true)] [Serializable] -#pragma warning disable 618 - [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 public abstract class EvidenceBase { protected EvidenceBase() @@ -44,11 +41,6 @@ namespace System.Security.Policy /// Since legacy evidence objects would be cloned by being serialized, the default implementation /// of EvidenceBase will do the same. /// -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)] - [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 - [SecuritySafeCritical] public virtual EvidenceBase Clone() { #if FEATURE_SERIALIZATION @@ -113,10 +105,6 @@ namespace System.Security.Policy return m_legacyEvidence.GetHashCode(); } -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] -#pragma warning restore 618 - [SecuritySafeCritical] public override EvidenceBase Clone() { return base.Clone(); @@ -181,10 +169,6 @@ namespace System.Security.Policy return m_legacyEvidenceList.GetEnumerator(); } -#pragma warning disable 618 - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] -#pragma warning restore 618 - [SecuritySafeCritical] public override EvidenceBase Clone() { return base.Clone(); diff --git a/src/coreclr/src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs b/src/coreclr/src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs index 5bd3648..8f8c07c 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs @@ -18,7 +18,6 @@ namespace System.Security.Policy { /// bool IsVerified { - [System.Security.SecurityCritical] get; } diff --git a/src/coreclr/src/mscorlib/src/System/Security/Policy/StrongName.cs b/src/coreclr/src/mscorlib/src/System/Security/Policy/StrongName.cs index 613e297..999b478 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Policy/StrongName.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Policy/StrongName.cs @@ -89,7 +89,6 @@ namespace System.Security.Policy { bool IDelayEvaluatedEvidence.IsVerified { - [System.Security.SecurityCritical] // auto-generated get { return true; diff --git a/src/coreclr/src/mscorlib/src/System/Security/Policy/Zone.cs b/src/coreclr/src/mscorlib/src/System/Security/Policy/Zone.cs index c7c5346..7bcb4b9 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Policy/Zone.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Policy/Zone.cs @@ -50,7 +50,6 @@ namespace System.Security.Policy public SecurityZone SecurityZone { - [System.Security.SecuritySafeCritical] // auto-generated get { return m_zone; diff --git a/src/coreclr/src/mscorlib/src/System/Security/SafeSecurityHandles.cs b/src/coreclr/src/mscorlib/src/System/Security/SafeSecurityHandles.cs index ea9cd4b..9a84164 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SafeSecurityHandles.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SafeSecurityHandles.cs @@ -11,7 +11,6 @@ namespace Microsoft.Win32.SafeHandles { // Introduce this handle to replace internal SafeTokenHandle, // which is mainly used to hold Windows thread or process access token - [SecurityCritical] public sealed class SafeAccessTokenHandle : SafeHandle { private SafeAccessTokenHandle() @@ -27,24 +26,20 @@ namespace Microsoft.Win32.SafeHandles { public static SafeAccessTokenHandle InvalidHandle { - [SecurityCritical] get { return new SafeAccessTokenHandle(IntPtr.Zero); } } public override bool IsInvalid { - [SecurityCritical] get { return handle == IntPtr.Zero || handle == new IntPtr(-1); } } - [SecurityCritical] protected override bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaLogonProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaLogonProcessHandle() : base (true) {} @@ -57,7 +52,6 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeLsaLogonProcessHandle(IntPtr.Zero); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaDeregisterLogonProcess returns an NTSTATUS @@ -65,7 +59,6 @@ namespace Microsoft.Win32.SafeHandles { } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaMemoryHandle : SafeBuffer { private SafeLsaMemoryHandle() : base(true) {} @@ -78,14 +71,12 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeLsaMemoryHandle( IntPtr.Zero ); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaFreeMemory(handle) == 0; } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaPolicyHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaPolicyHandle() : base(true) {} @@ -98,14 +89,12 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeLsaPolicyHandle( IntPtr.Zero ); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaClose(handle) == 0; } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaReturnBufferHandle : SafeBuffer { private SafeLsaReturnBufferHandle() : base (true) {} @@ -118,7 +107,6 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeLsaReturnBufferHandle(IntPtr.Zero); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaFreeReturnBuffer returns an NTSTATUS @@ -126,7 +114,6 @@ namespace Microsoft.Win32.SafeHandles { } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeProcessHandle() : base (true) {} @@ -139,14 +126,12 @@ namespace Microsoft.Win32.SafeHandles { get { return new SafeProcessHandle(IntPtr.Zero); } } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } - [System.Security.SecurityCritical] // auto-generated internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeThreadHandle() : base (true) {} @@ -155,7 +140,6 @@ namespace Microsoft.Win32.SafeHandles { SetHandle(handle); } - [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityContext.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityContext.cs index 5d06a78..bc22345 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityContext.cs @@ -51,13 +51,11 @@ namespace System.Security internal ExecutionContext currEC; // current ExecutionContext on Thread internal CompressedStackSwitcher cssw; - [System.Security.SecuritySafeCritical] // overrides public transparent member public void Dispose() { Undo(); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #if FEATURE_CORRUPTING_EXCEPTIONS [HandleProcessCorruptedStateExceptions] @@ -75,7 +73,6 @@ namespace System.Security return true; } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #if FEATURE_CORRUPTING_EXCEPTIONS [HandleProcessCorruptedStateExceptions] @@ -167,7 +164,6 @@ namespace System.Security static internal SecurityContext FullTrustSecurityContext { - [System.Security.SecurityCritical] // auto-generated get { if (_fullTrustSC == null) @@ -203,19 +199,16 @@ namespace System.Security { } - [System.Security.SecurityCritical] // auto-generated_required public static AsyncFlowControl SuppressFlow() { return SuppressFlow(SecurityContextDisableFlow.All); } - [System.Security.SecurityCritical] // auto-generated_required public static AsyncFlowControl SuppressFlowWindowsIdentity() { return SuppressFlow(SecurityContextDisableFlow.WI); } - [SecurityCritical] internal static AsyncFlowControl SuppressFlow(SecurityContextDisableFlow flags) { if (IsFlowSuppressed(flags)) @@ -231,7 +224,6 @@ namespace System.Security return afc; } - [SecuritySafeCritical] public static void RestoreFlow() { SecurityContext sc = Thread.CurrentThread.GetMutableExecutionContext().SecurityContext; @@ -247,7 +239,6 @@ namespace System.Security return SecurityContext.IsFlowSuppressed(SecurityContextDisableFlow.All); } - [SecuritySafeCritical] internal static bool IsFlowSuppressed(SecurityContextDisableFlow flags) { return Thread.CurrentThread.GetExecutionContextReader().SecurityContext.IsFlowSuppressed(flags); @@ -257,7 +248,6 @@ namespace System.Security // continue past the call to SecurityContext.Run. If you change the signature to this method, or // provide an alternate way to do a SecurityContext.Run make sure to update // SecurityStackWalk::IsSpecialRunFrame in the VM to search for the new method. - [System.Security.SecurityCritical] // auto-generated_required [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static void Run(SecurityContext securityContext, ContextCallback callback, Object state) @@ -303,7 +293,6 @@ namespace System.Security } } - [System.Security.SecurityCritical] // auto-generated internal static void RunInternal(SecurityContext securityContext, ContextCallback callBack, Object state) { if (cleanupCode == null) @@ -331,7 +320,6 @@ namespace System.Security } } - [System.Security.SecurityCritical] // auto-generated static internal void runTryCode(Object userData) { SecurityContextRunData rData = (SecurityContextRunData) userData; @@ -340,7 +328,6 @@ namespace System.Security } - [System.Security.SecurityCritical] // auto-generated [PrePrepareMethod] static internal void runFinallyCode(Object userData, bool exceptionThrown) { @@ -355,7 +342,6 @@ namespace System.Security // Internal API that gets called from public SetSecurityContext and from SetExecutionContext [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - [System.Security.SecurityCritical] // auto-generated [DynamicSecurityMethodAttribute()] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable internal static SecurityContextSwitcher SetSecurityContext(SecurityContext sc, SecurityContext.Reader prevSecurityContext, bool modifyCurrentExecutionContext) @@ -364,7 +350,6 @@ namespace System.Security return SetSecurityContext(sc, prevSecurityContext, modifyCurrentExecutionContext, ref stackMark); } - [System.Security.SecurityCritical] // auto-generated #if FEATURE_CORRUPTING_EXCEPTIONS [HandleProcessCorruptedStateExceptions] #endif // FEATURE_CORRUPTING_EXCEPTIONS @@ -404,7 +389,6 @@ namespace System.Security } /// - [System.Security.SecuritySafeCritical] // auto-generated public SecurityContext CreateCopy() { if (!isNewCapture) @@ -423,7 +407,6 @@ namespace System.Security } /// - [System.Security.SecuritySafeCritical] // auto-generated internal SecurityContext CreateMutableCopy() { Contract.Assert(!this.isNewCapture); @@ -437,7 +420,6 @@ namespace System.Security return sc; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static SecurityContext Capture( ) { @@ -453,7 +435,6 @@ namespace System.Security } // create a clone from a non-existing SecurityContext - [System.Security.SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.AggressiveInlining)] static internal SecurityContext Capture(ExecutionContext.Reader currThreadEC, ref StackCrawlMark stackMark) { @@ -468,7 +449,6 @@ namespace System.Security return CaptureCore(currThreadEC, ref stackMark); } - [System.Security.SecurityCritical] // auto-generated static private SecurityContext CaptureCore(ExecutionContext.Reader currThreadEC, ref StackCrawlMark stackMark) { SecurityContext sc = new SecurityContext(); @@ -479,7 +459,6 @@ namespace System.Security return sc; } - [System.Security.SecurityCritical] // auto-generated static internal SecurityContext CreateFullTrustSecurityContext() { SecurityContext sc = new SecurityContext(); @@ -499,7 +478,6 @@ namespace System.Security return (IsDefaultThreadSecurityInfo()); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern static bool IsDefaultThreadSecurityInfo(); } diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityException.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityException.cs index d071201..c76674c 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityException.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityException.cs @@ -34,14 +34,12 @@ namespace System.Security [Serializable] public class SecurityException : SystemException { - [System.Security.SecuritySafeCritical] // auto-generated internal static string GetResString(string sResourceName) { PermissionSet.s_fullTrust.Assert(); return Environment.GetResourceString(sResourceName); } - [System.Security.SecurityCritical] // auto-generated #pragma warning disable 618 internal static Exception MakeSecurityException(AssemblyName asmName, Evidence asmEvidence, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) #pragma warning restore 618 @@ -78,7 +76,6 @@ namespace System.Security internal SecurityException(string message, Object deny, Object permitOnly, MethodInfo method, Object demanded, IPermission permThatFailed) : this(){} - [System.Security.SecuritySafeCritical] // auto-generated protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) @@ -91,7 +88,6 @@ namespace System.Security return base.ToString(); } - [System.Security.SecurityCritical] // auto-generated private bool CanAccessSensitiveInfo() { bool retVal = false; @@ -108,7 +104,6 @@ namespace System.Security return retVal; } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityManager.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityManager.cs index 74be29e..933fe0b 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityManager.cs @@ -143,16 +143,13 @@ namespace System.Security } #pragma warning restore 618 - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern bool IsSameType(String strLeft, String strRight); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool _SetThreadSecurity(bool bThreadSecurity); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void GetGrantedPermissions(ObjectHandleOnStack retGranted, ObjectHandleOnStack retDenied, StackCrawlMarkHandle stackMark); diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityRuntime.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityRuntime.cs index 7b62549..d037fe9 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityRuntime.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityRuntime.cs @@ -27,7 +27,6 @@ namespace System.Security // // Internal only, do not doc. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern FrameSecurityDescriptor GetSecurityObjectForFrame(ref StackCrawlMark stackMark, @@ -38,7 +37,6 @@ namespace System.Security internal const bool StackHalt = false; // this method is a big perf hit, so don't call unnecessarily - [System.Security.SecurityCritical] // auto-generated internal static MethodInfo GetMethodInfo(RuntimeMethodHandleInternal rmh) { if (rmh.IsNullHandle()) @@ -61,7 +59,6 @@ namespace System.Security #endif } - [System.Security.SecurityCritical] // auto-generated private static bool FrameDescSetHelper(FrameSecurityDescriptor secDesc, PermissionSet demandSet, out PermissionSet alteredDemandSet, @@ -70,7 +67,6 @@ namespace System.Security return secDesc.CheckSetDemand(demandSet, out alteredDemandSet, rmh); } - [System.Security.SecurityCritical] // auto-generated private static bool FrameDescHelper(FrameSecurityDescriptor secDesc, IPermission demandIn, PermissionToken permToken, @@ -80,7 +76,6 @@ namespace System.Security } #if FEATURE_COMPRESSEDSTACK - [System.Security.SecurityCritical] private static bool CheckDynamicMethodSetHelper(System.Reflection.Emit.DynamicResolver dynamicResolver, PermissionSet demandSet, out PermissionSet alteredDemandSet, @@ -100,7 +95,6 @@ namespace System.Security return result; } - [System.Security.SecurityCritical] private static bool CheckDynamicMethodHelper(System.Reflection.Emit.DynamicResolver dynamicResolver, IPermission demandIn, PermissionToken permToken, @@ -124,22 +118,18 @@ namespace System.Security // API for PermissionSets // - [System.Security.SecurityCritical] // auto-generated internal static void Assert(PermissionSet permSet, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void AssertAllPossible(ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void Deny(PermissionSet permSet, ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void PermitOnly(PermissionSet permSet, ref StackCrawlMark stackMark) { } @@ -148,22 +138,18 @@ namespace System.Security // Revert API // - [System.Security.SecurityCritical] // auto-generated internal static void RevertAssert(ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void RevertDeny(ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void RevertPermitOnly(ref StackCrawlMark stackMark) { } - [System.Security.SecurityCritical] // auto-generated internal static void RevertAll(ref StackCrawlMark stackMark) { } diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs index bd23acd..510ed04 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs @@ -7,15 +7,10 @@ using System.Security.Permissions; namespace System.Security { - [System.Security.SecurityCritical] // auto-generated_required -#pragma warning disable 618 - [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 public abstract class SecurityState { protected SecurityState(){} - [System.Security.SecurityCritical] // auto-generated public bool IsStateAvailable() { AppDomainManager domainManager = AppDomainManager.CurrentAppDomainManager; diff --git a/src/coreclr/src/mscorlib/src/System/Security/Util/Config.cs b/src/coreclr/src/mscorlib/src/System/Security/Util/Config.cs index 7f96602..afc9b8c 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Util/Config.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Util/Config.cs @@ -37,7 +37,6 @@ namespace System.Security.Util { private static volatile string m_machineConfig; private static volatile string m_userConfig; - [System.Security.SecurityCritical] // auto-generated private static void GetFileLocales() { if (m_machineConfig == null) @@ -56,7 +55,6 @@ namespace System.Security.Util { internal static string MachineDirectory { - [System.Security.SecurityCritical] // auto-generated get { GetFileLocales(); @@ -66,7 +64,6 @@ namespace System.Security.Util { internal static string UserDirectory { - [System.Security.SecurityCritical] // auto-generated get { GetFileLocales(); @@ -74,15 +71,12 @@ namespace System.Security.Util { } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void GetMachineDirectory(StringHandleOnStack retDirectory); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] private static extern void GetUserDirectory(StringHandleOnStack retDirectory); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] internal static extern bool WriteToEventLog(string message); } diff --git a/src/coreclr/src/mscorlib/src/System/Security/Util/StringExpressionSet.cs b/src/coreclr/src/mscorlib/src/System/Security/Util/StringExpressionSet.cs index c12ca2f..379fe04 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Util/StringExpressionSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Util/StringExpressionSet.cs @@ -26,12 +26,9 @@ namespace System.Security.Util { // 2. Ensuring that the partial trust code has permission to see full path data // 3. Not using this set for paths (eg EnvironmentStringExpressionSet) // - [SecurityCritical] protected ArrayList m_list; protected bool m_ignoreCase; - [SecurityCritical] protected String m_expressions; - [SecurityCritical] protected String[] m_expressionsArray; protected bool m_throwOnRelative; @@ -61,7 +58,6 @@ namespace System.Security.Util { { } - [System.Security.SecuritySafeCritical] // auto-generated public StringExpressionSet( bool ignoreCase, String str, bool throwOnRelative ) { m_list = null; @@ -78,7 +74,6 @@ namespace System.Security.Util { return new StringExpressionSet(); } - [SecuritySafeCritical] public virtual StringExpressionSet Copy() { // SafeCritical: just copying this value around, not leaking it @@ -118,7 +113,6 @@ namespace System.Security.Util { return StaticProcessSingleString(str); } - [System.Security.SecurityCritical] // auto-generated public void AddExpressions( String str ) { if (str == null) @@ -181,13 +175,11 @@ namespace System.Security.Util { Reduce(); } - [System.Security.SecurityCritical] // auto-generated public void AddExpressions( String[] str, bool checkForDuplicates, bool needFullPath ) { AddExpressions(CreateListFromExpressions(str, needFullPath), checkForDuplicates); } - [System.Security.SecurityCritical] // auto-generated public void AddExpressions( ArrayList exprArrayList, bool checkForDuplicates) { Contract.Assert( m_throwOnRelative, "This should only be called when throw on relative is set" ); @@ -205,7 +197,6 @@ namespace System.Security.Util { } - [System.Security.SecurityCritical] // auto-generated internal static ArrayList CreateListFromExpressions(String[] str, bool needFullPath) { if (str == null) @@ -249,7 +240,6 @@ namespace System.Security.Util { return retArrayList; } - [System.Security.SecurityCritical] // auto-generated protected void CheckList() { if (m_list == null && m_expressions != null) @@ -303,7 +293,6 @@ namespace System.Security.Util { } - [System.Security.SecurityCritical] // auto-generated protected void CreateList() { String[] expressionsArray = Split( m_expressions ); @@ -339,7 +328,6 @@ namespace System.Security.Util { } } - [SecuritySafeCritical] public bool IsEmpty() { // SafeCritical: we're just showing that the expressions are empty, the sensitive portion is their @@ -354,7 +342,6 @@ namespace System.Security.Util { } } - [System.Security.SecurityCritical] // auto-generated public bool IsSubsetOf( StringExpressionSet ses ) { if (this.IsEmpty()) @@ -376,7 +363,6 @@ namespace System.Security.Util { return true; } - [System.Security.SecurityCritical] // auto-generated public bool IsSubsetOfPathDiscovery( StringExpressionSet ses ) { if (this.IsEmpty()) @@ -399,7 +385,6 @@ namespace System.Security.Util { } - [System.Security.SecurityCritical] // auto-generated public StringExpressionSet Union( StringExpressionSet ses ) { // If either set is empty, the union represents a copy of the other. @@ -434,7 +419,6 @@ namespace System.Security.Util { } - [System.Security.SecurityCritical] // auto-generated public StringExpressionSet Intersect( StringExpressionSet ses ) { // If either set is empty, the intersection is empty @@ -477,7 +461,6 @@ namespace System.Security.Util { return intersectSet; } - [SecuritySafeCritical] protected void GenerateString() { // SafeCritical - moves critical data around, but doesn't expose it out @@ -522,7 +505,6 @@ namespace System.Security.Util { // expressions contain paths that were canonicalized and expanded from the input that would cause // information disclosure, so we instead only expose this out to trusted code that can ensure they // either don't leak the information or required full path information. - [SecurityCritical] public string UnsafeToString() { CheckList(); @@ -534,7 +516,6 @@ namespace System.Security.Util { return m_expressions; } - [SecurityCritical] public String[] UnsafeToStringArray() { if (m_expressionsArray == null && m_list != null) @@ -550,7 +531,6 @@ namespace System.Security.Util { // protected static helper functions //------------------------------- - [SecurityCritical] private bool StringSubsetStringExpression( String left, StringExpressionSet right, bool ignoreCase ) { for (int index = 0; index < right.m_list.Count; ++index) @@ -563,7 +543,6 @@ namespace System.Security.Util { return false; } - [SecurityCritical] private static bool StringSubsetStringExpressionPathDiscovery( String left, StringExpressionSet right, bool ignoreCase ) { for (int index = 0; index < right.m_list.Count; ++index) @@ -661,7 +640,6 @@ namespace System.Security.Util { // protected helper functions //------------------------------- - [SecuritySafeCritical] protected void AddSingleExpressionNoDuplicates( String expression ) { // SafeCritical: We're not exposing out the string sets, just allowing modification of them @@ -691,7 +669,6 @@ namespace System.Security.Util { this.m_list.Add( expression ); } - [System.Security.SecurityCritical] // auto-generated protected void Reduce() { CheckList(); @@ -726,18 +703,15 @@ namespace System.Security.Util { } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern void GetLongPathName( String path, StringHandleOnStack retLongPath ); - [System.Security.SecurityCritical] // auto-generated internal static String CanonicalizePath( String path ) { return CanonicalizePath( path, true ); } - [System.Security.SecurityCritical] // auto-generated internal static string CanonicalizePath(string path, bool needFullPath) { if (needFullPath) diff --git a/src/coreclr/src/mscorlib/src/System/Security/Util/URLString.cs b/src/coreclr/src/mscorlib/src/System/Security/Util/URLString.cs index 3eb8f8a..83f9ce4 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Util/URLString.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Util/URLString.cs @@ -1128,7 +1128,6 @@ namespace System.Security.Util { } #if !PLATFORM_UNIX - [System.Security.SecuritySafeCritical] // auto-generated internal URLString SpecialNormalizeUrl() { // Under WinXP, file protocol urls can be mapped to @@ -1178,7 +1177,6 @@ namespace System.Security.Util { } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetDeviceName( String driveLetter, StringHandleOnStack retDeviceName ); diff --git a/src/coreclr/src/mscorlib/src/System/Security/Util/XMLUtil.cs b/src/coreclr/src/mscorlib/src/System/Security/Util/XMLUtil.cs index a9a8a65..e5798c2 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Util/XMLUtil.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Util/XMLUtil.cs @@ -105,7 +105,6 @@ namespace System.Security.Util { assemblyVersion = an.Version.ToString(); return true; } - [System.Security.SecurityCritical] // auto-generated private static bool ParseElementForObjectCreation( SecurityElement el, String requiredNamespace, @@ -170,7 +169,6 @@ namespace System.Security.Util { return false; } - [SecuritySafeCritical] public static IPermission CreatePermission (SecurityElement el, PermissionState permState, bool ignoreTypeLoadFailures) { diff --git a/src/coreclr/src/mscorlib/src/System/SharedStatics.cs b/src/coreclr/src/mscorlib/src/System/SharedStatics.cs index bc34280..25388af 100644 --- a/src/coreclr/src/mscorlib/src/System/SharedStatics.cs +++ b/src/coreclr/src/mscorlib/src/System/SharedStatics.cs @@ -37,7 +37,6 @@ namespace System private volatile String _Remoting_Identity_IDGuid; public static String Remoting_Identity_IDGuid { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_sharedStatics._Remoting_Identity_IDGuid == null) diff --git a/src/coreclr/src/mscorlib/src/System/Single.cs b/src/coreclr/src/mscorlib/src/System/Single.cs index a2d3b13..481c088 100644 --- a/src/coreclr/src/mscorlib/src/System/Single.cs +++ b/src/coreclr/src/mscorlib/src/System/Single.cs @@ -40,21 +40,18 @@ namespace System { internal static float NegativeZero = BitConverter.Int32BitsToSingle(unchecked((int)0x80000000)); [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsInfinity(float f) { return (*(int*)(&f) & 0x7FFFFFFF) == 0x7F800000; } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsPositiveInfinity(float f) { return *(int*)(&f) == 0x7F800000; } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsNegativeInfinity(float f) { return *(int*)(&f) == unchecked((int)0xFF800000); @@ -62,14 +59,12 @@ namespace System { [Pure] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] [System.Runtime.Versioning.NonVersionable] public unsafe static bool IsNaN(float f) { return (*(int*)(&f) & 0x7FFFFFFF) > 0x7F800000; } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static bool IsNegative(float f) { return (*(uint*)(&f) & 0x80000000) == 0x80000000; } @@ -163,7 +158,6 @@ namespace System { return IsNaN(obj) && IsNaN(m_value); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override int GetHashCode() { float f = m_value; if (f == 0) { @@ -174,25 +168,21 @@ namespace System { return v; } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatSingle(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatSingle(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatSingle(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatSingle(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/String.Comparison.cs b/src/coreclr/src/mscorlib/src/System/String.Comparison.cs index 4d352af..88c2080 100644 --- a/src/coreclr/src/mscorlib/src/System/String.Comparison.cs +++ b/src/coreclr/src/mscorlib/src/System/String.Comparison.cs @@ -17,7 +17,6 @@ namespace System //Native Static Methods // - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static int CompareOrdinalIgnoreCaseHelper(String strA, String strB) { Contract.Requires(strA != null); @@ -55,13 +54,11 @@ namespace System } // native call to COMString::CompareOrdinalEx - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int CompareOrdinalHelper(String strA, int indexA, int countA, String strB, int indexB, int countB); //This will not work in case-insensitive mode for any character greater than 0x80. //We'll throw an ArgumentException. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe internal static extern int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte *strBBytes); @@ -75,7 +72,6 @@ namespace System // Search/Query methods // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private unsafe static bool EqualsHelper(String strA, String strB) { @@ -137,7 +133,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private unsafe static bool StartsWithOrdinalHelper(String str, String startsWith) { @@ -194,7 +189,6 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated private unsafe static int CompareOrdinalHelper(String strA, String strB) { Contract.Requires(strA != null); @@ -342,7 +336,6 @@ namespace System // Provides a more flexible function for string comparision. See StringComparison // for meaning of different comparisonType. [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public static int Compare(String strA, String strB, StringComparison comparisonType) { // Single comparison to check if comparisonType is within [CurrentCulture .. OrdinalIgnoreCase] @@ -532,7 +525,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public static int Compare(String strA, int indexA, String strB, int indexB, int length, StringComparison comparisonType) { if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase) { throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType)); @@ -638,7 +630,6 @@ namespace System // Compares strA and strB using an ordinal (code-point) comparison. // [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public static int CompareOrdinal(String strA, int indexA, String strB, int indexB, int length) { if (strA == null || strB == null) @@ -724,7 +715,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public Boolean EndsWith(String value, StringComparison comparisonType) { if( (Object)value == null) { @@ -846,7 +836,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public bool Equals(String value, StringComparison comparisonType) { if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase) throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType)); @@ -915,7 +904,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public static bool Equals(String a, String b, StringComparison comparisonType) { if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase) throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType)); @@ -981,16 +969,13 @@ namespace System #if FEATURE_RANDOMIZED_STRING_HASHING // Do not remove! // This method is called by reflection in System.Xml - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int InternalMarvin32HashString(string s, int strLen, long additionalEntropy); - [System.Security.SecuritySafeCritical] internal static bool UseRandomizedHashing() { return InternalUseRandomizedHashing(); } - [System.Security.SecurityCritical] [System.Security.SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern bool InternalUseRandomizedHashing(); @@ -998,7 +983,6 @@ namespace System // Gets a hash code for this string. If strings A and B are such that A.Equals(B), then // they will return the same hash code. - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public override int GetHashCode() { @@ -1014,7 +998,6 @@ namespace System // Use this if and only if you need the hashcode to not change across app domains (e.g. you have an app domain agile // hash table). - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal int GetLegacyNonRandomizedHashCode() { unsafe { @@ -1080,7 +1063,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [ComVisible(false)] public Boolean StartsWith(String value, StringComparison comparisonType) { if( (Object)value == null) { diff --git a/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs b/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs index e1bf4be..74a25b5 100644 --- a/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs +++ b/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs @@ -17,7 +17,6 @@ namespace System private const int TrimTail = 1; private const int TrimBoth = 2; - [System.Security.SecuritySafeCritical] // auto-generated unsafe private static void FillStringChecked(String dest, int destPos, String src) { Contract.Requires(dest != null); @@ -109,7 +108,6 @@ namespace System return Concat(objArgs); } - [System.Security.SecuritySafeCritical] public static string Concat(params object[] args) { if (args == null) @@ -262,7 +260,6 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated public static String Concat(String str0, String str1) { Contract.Ensures(Contract.Result() != null); Contract.Ensures(Contract.Result().Length == @@ -291,7 +288,6 @@ namespace System return result; } - [System.Security.SecuritySafeCritical] // auto-generated public static String Concat(String str0, String str1, String str2) { Contract.Ensures(Contract.Result() != null); Contract.Ensures(Contract.Result().Length == @@ -325,7 +321,6 @@ namespace System return result; } - [System.Security.SecuritySafeCritical] // auto-generated public static String Concat(String str0, String str1, String str2, String str3) { Contract.Ensures(Contract.Result() != null); Contract.Ensures(Contract.Result().Length == @@ -366,7 +361,6 @@ namespace System return result; } - [System.Security.SecuritySafeCritical] public static String Concat(params String[] values) { if (values == null) throw new ArgumentNullException(nameof(values)); @@ -502,7 +496,6 @@ namespace System .AppendFormatHelper(provider, format, args)); } - [System.Security.SecuritySafeCritical] // auto-generated public String Insert(int startIndex, String value) { if (value == null) @@ -643,7 +636,6 @@ namespace System // Joins an array of strings together as one string with a separator between each original string. // - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static string Join(string separator, string[] value, int startIndex, int count) { separator = separator ?? string.Empty; @@ -858,7 +850,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String PadLeft(int totalWidth, char paddingChar) { if (totalWidth < 0) throw new ArgumentOutOfRangeException(nameof(totalWidth), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -888,7 +879,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public String PadRight(int totalWidth, char paddingChar) { if (totalWidth < 0) throw new ArgumentOutOfRangeException(nameof(totalWidth), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -912,7 +902,6 @@ namespace System return result; } - [System.Security.SecuritySafeCritical] // auto-generated public String Remove(int startIndex, int count) { if (startIndex < 0) @@ -969,7 +958,6 @@ namespace System // Replaces all instances of oldChar with newChar. // - [System.Security.SecuritySafeCritical] // auto-generated public String Replace(char oldChar, char newChar) { Contract.Ensures(Contract.Result() != null); @@ -1040,7 +1028,6 @@ namespace System // This method contains the same functionality as StringBuilder Replace. The only difference is that // a new String has to be allocated since Strings are immutable - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern String ReplaceInternal(String oldValue, String newValue); @@ -1110,13 +1097,11 @@ namespace System return SplitInternal(separator, count, options); } - [System.Security.SecuritySafeCritical] private unsafe String[] SplitInternal(char separator, int count, StringSplitOptions options) { return SplitInternal(&separator, 1, count, options); } - [System.Security.SecuritySafeCritical] private unsafe String[] SplitInternal(char[] separator, int count, StringSplitOptions options) { fixed (char* pSeparators = separator) @@ -1126,7 +1111,6 @@ namespace System } } - [System.Security.SecurityCritical] private unsafe String[] SplitInternal(char* separators, int separatorsLength, int count, StringSplitOptions options) { if (count < 0) @@ -1355,7 +1339,6 @@ namespace System // Args: separator -- A string containing all of the split characters. // sepList -- an array of ints for split char indicies. //-------------------------------------------------------------------- - [System.Security.SecurityCritical] private unsafe int MakeSeparatorList(char* separators, int separatorsLength, int[] sepList) { Contract.Assert(separatorsLength >= 0, "separatorsLength >= 0"); int foundCount=0; @@ -1394,7 +1377,6 @@ namespace System // Args: separator -- the separator // sepList -- an array of ints for split string indicies. //-------------------------------------------------------------------- - [System.Security.SecuritySafeCritical] // auto-generated private unsafe int MakeSeparatorList(string separator, int[] sepList) { Contract.Assert(!string.IsNullOrEmpty(separator), "!string.IsNullOrEmpty(separator)"); @@ -1424,7 +1406,6 @@ namespace System // sepList -- an array of ints for split string indicies. // lengthList -- an array of ints for split string lengths. //-------------------------------------------------------------------- - [System.Security.SecuritySafeCritical] // auto-generated private unsafe int MakeSeparatorList(String[] separators, int[] sepList, int[] lengthList) { Contract.Assert(separators != null && separators.Length > 0, "separators != null && separators.Length > 0"); @@ -1464,7 +1445,6 @@ namespace System // Returns a substring of this string. // - [System.Security.SecuritySafeCritical] // auto-generated public String Substring(int startIndex, int length) { //Bounds Checking. @@ -1496,7 +1476,6 @@ namespace System return InternalSubString(startIndex, length); } - [System.Security.SecurityCritical] // auto-generated unsafe string InternalSubString(int startIndex, int length) { Contract.Assert( startIndex >= 0 && startIndex <= this.Length, "StartIndex is out of range!"); Contract.Assert( length >= 0 && startIndex <= this.Length - length, "length is out of range!"); @@ -1607,7 +1586,6 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated private String TrimHelper(int trimType) { //end will point to the first non-trimmed character on the right //start will point to the first non-trimmed character on the Left @@ -1631,7 +1609,6 @@ namespace System } - [System.Security.SecuritySafeCritical] // auto-generated private String TrimHelper(char[] trimChars, int trimType) { //end will point to the first non-trimmed character on the right //start will point to the first non-trimmed character on the Left @@ -1669,7 +1646,6 @@ namespace System } - [System.Security.SecurityCritical] // auto-generated private String CreateTrimmedString(int start, int end) { int len = end -start + 1; if (len == this.Length) { diff --git a/src/coreclr/src/mscorlib/src/System/String.Searching.cs b/src/coreclr/src/mscorlib/src/System/String.Searching.cs index 30933db..2620cfd 100644 --- a/src/coreclr/src/mscorlib/src/System/String.Searching.cs +++ b/src/coreclr/src/mscorlib/src/System/String.Searching.cs @@ -29,7 +29,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public unsafe int IndexOf(char value, int startIndex, int count) { if (startIndex < 0 || startIndex > Length) throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index")); @@ -85,7 +84,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int IndexOfAny(char [] anyOf, int startIndex, int count); @@ -138,7 +136,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] public int IndexOf(String value, int startIndex, int count, StringComparison comparisonType) { // Validate inputs if (value == null) @@ -194,7 +191,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public unsafe int LastIndexOf(char value, int startIndex, int count) { if (Length == 0) return -1; @@ -258,7 +254,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int LastIndexOfAny(char [] anyOf, int startIndex, int count); @@ -299,7 +294,6 @@ namespace System } [Pure] - [System.Security.SecuritySafeCritical] public int LastIndexOf(String value, int startIndex, int count, StringComparison comparisonType) { if (value == null) throw new ArgumentNullException(nameof(value)); diff --git a/src/coreclr/src/mscorlib/src/System/String.cs b/src/coreclr/src/mscorlib/src/System/String.cs index f39ca98..5e24158 100644 --- a/src/coreclr/src/mscorlib/src/System/String.cs +++ b/src/coreclr/src/mscorlib/src/System/String.cs @@ -67,7 +67,6 @@ namespace System { // than 0x80) before security is fully initialized. Without security initialized, we can't grab resources (the nlp's) // from the assembly. This provides a workaround for that problem and should NOT be used anywhere else. // - [System.Security.SecuritySafeCritical] // auto-generated internal unsafe static string SmallCharToUpper(string strIn) { Contract.Requires(strIn != null); Contract.EndContractBlock(); @@ -102,7 +101,6 @@ namespace System { [System.Runtime.CompilerServices.IndexerName("Chars")] public extern char this[int index] { [MethodImpl(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] // public member get; } @@ -111,7 +109,6 @@ namespace System { // sourceIndex + count - 1 to the character array buffer, beginning // at destinationIndex. // - [System.Security.SecuritySafeCritical] // auto-generated unsafe public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { if (destination == null) @@ -136,7 +133,6 @@ namespace System { } // Returns the entire string as an array of characters. - [System.Security.SecuritySafeCritical] // auto-generated unsafe public char[] ToCharArray() { int length = Length; if (length > 0) @@ -158,7 +154,6 @@ namespace System { // Returns a substring of this string as an array of characters. // - [System.Security.SecuritySafeCritical] // auto-generated unsafe public char[] ToCharArray(int startIndex, int length) { // Range check everything. @@ -210,7 +205,6 @@ namespace System { // // Spec#: Add postcondition in a contract assembly. Potential perf problem. public extern int Length { - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } @@ -218,25 +212,19 @@ namespace System { // Creates a new string with the characters copied in from ptr. If // ptr is null, a 0-length string (like String.Empty) is returned. // - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe public extern String(char *value); - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe public extern String(char *value, int startIndex, int length); - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe public extern String(sbyte *value); - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe public extern String(sbyte *value, int startIndex, int length); - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe public extern String(sbyte *value, int startIndex, int length, Encoding enc); - [System.Security.SecurityCritical] // auto-generated unsafe static private String CreateString(sbyte *value, int startIndex, int length, Encoding enc) { if (enc == null) return new String(value, startIndex, length); // default to ANSI @@ -267,7 +255,6 @@ namespace System { // Helper for encodings so they can talk to our buffer directly // stringLength must be the exact size we'll expect - [System.Security.SecurityCritical] // auto-generated unsafe static internal String CreateStringFromEncoding( byte* bytes, int byteLength, Encoding encoding) { @@ -297,7 +284,6 @@ namespace System { // This is only intended to be used by char.ToString. // It is necessary to put the code in this class instead of Char, since m_firstChar is a private member. // Making m_firstChar internal would be dangerous since it would make it much easier to break String's immutability. - [SecuritySafeCritical] internal static string CreateFromChar(char c) { string result = FastAllocateString(1); @@ -305,7 +291,6 @@ namespace System { return result; } - [System.Security.SecuritySafeCritical] // auto-generated unsafe internal int GetBytesFromEncoding(byte* pbNativeBuffer, int cbNativeBuffer,Encoding encoding) { // encoding == Encoding.UTF8 @@ -315,7 +300,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated unsafe internal int ConvertToAnsi(byte *pbNativeBuffer, int cbNativeBuffer, bool fBestFit, bool fThrowOnUnmappableChar) { Contract.Assert(cbNativeBuffer >= (Length + 1) * Marshal.SystemMaxDBCSCharSize, "Insufficient buffer length passed to ConvertToAnsi"); @@ -363,7 +347,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated public bool IsNormalized(NormalizationForm normalizationForm) { #if !FEATURE_NORM_IDNA_ONLY @@ -391,7 +374,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated public String Normalize(NormalizationForm normalizationForm) { #if !FEATURE_NORM_IDNA_ONLY @@ -408,7 +390,6 @@ namespace System { return Normalization.Normalize(this, normalizationForm); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static String FastAllocateString(int length); @@ -416,7 +397,6 @@ namespace System { // be created from the characters in value between startIndex and // startIndex + length - 1. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern String(char [] value, int startIndex, int length); @@ -424,17 +404,14 @@ namespace System { // created from the characters in value. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern String(char [] value); - [System.Security.SecurityCritical] // auto-generated internal static unsafe void wstrcpy(char *dmem, char *smem, int charCount) { Buffer.Memcpy((byte*)dmem, (byte*)smem, charCount * 2); // 2 used everywhere instead of sizeof(char) } - [System.Security.SecuritySafeCritical] // auto-generated private String CtorCharArray(char [] value) { if (value != null && value.Length != 0) { @@ -451,7 +428,6 @@ namespace System { return String.Empty; } - [System.Security.SecuritySafeCritical] // auto-generated private String CtorCharArrayStartLength(char [] value, int startIndex, int length) { if (value == null) @@ -481,7 +457,6 @@ namespace System { return String.Empty; } - [System.Security.SecuritySafeCritical] // auto-generated private String CtorCharCount(char c, int count) { if (count > 0) { @@ -522,7 +497,6 @@ namespace System { throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegNum", nameof(count))); } - [System.Security.SecurityCritical] // auto-generated private static unsafe int wcslen(char *ptr) { char *end = ptr; @@ -617,7 +591,6 @@ namespace System { return count; } - [System.Security.SecurityCritical] // auto-generated private unsafe String CtorCharPtr(char *ptr) { if (ptr == null) @@ -645,7 +618,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated private unsafe String CtorCharPtrStartLength(char *ptr, int startIndex, int length) { if (length < 0) { @@ -679,7 +651,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern String(char c, int count); @@ -705,7 +676,6 @@ namespace System { return this; } - [System.Security.SecuritySafeCritical] // auto-generated unsafe public static String Copy (String str) { if (str==null) { throw new ArgumentNullException(nameof(str)); @@ -724,7 +694,6 @@ namespace System { return result; } - [System.Security.SecuritySafeCritical] // auto-generated public static String Intern(String str) { if (str==null) { throw new ArgumentNullException(nameof(str)); @@ -737,7 +706,6 @@ namespace System { } [Pure] - [System.Security.SecuritySafeCritical] // auto-generated public static String IsInterned(String str) { if (str==null) { throw new ArgumentNullException(nameof(str)); @@ -834,20 +802,16 @@ namespace System { // Is this a string that can be compared quickly (that is it has only characters > 0x80 // and not a - or ' - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern bool IsFastSort(); // Is this a string that only contains characters < 0x80. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern bool IsAscii(); // Set extra byte for odd-sized strings that came from interop as BSTR. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetTrailByte(byte data); // Try to retrieve the extra byte - returns false if not present. - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern bool TryGetTrailByte(out byte data); @@ -874,7 +838,6 @@ namespace System { } // Copies the source String (byte buffer) to the destination IntPtr memory allocated with len bytes. - [System.Security.SecurityCritical] // auto-generated internal unsafe static void InternalCopy(String src, IntPtr dest,int len) { if (len == 0) diff --git a/src/coreclr/src/mscorlib/src/System/StringComparer.cs b/src/coreclr/src/mscorlib/src/System/StringComparer.cs index 38964f0..af0b595 100644 --- a/src/coreclr/src/mscorlib/src/System/StringComparer.cs +++ b/src/coreclr/src/mscorlib/src/System/StringComparer.cs @@ -385,7 +385,6 @@ namespace System { return x.Equals(y); } - [System.Security.SecuritySafeCritical] public override int GetHashCode(string obj) { if( obj == null) { throw new ArgumentNullException(nameof(obj)); diff --git a/src/coreclr/src/mscorlib/src/System/StubHelpers.cs b/src/coreclr/src/mscorlib/src/System/StubHelpers.cs index 34745e5..04d6581 100644 --- a/src/coreclr/src/mscorlib/src/System/StubHelpers.cs +++ b/src/coreclr/src/mscorlib/src/System/StubHelpers.cs @@ -23,7 +23,6 @@ namespace System.StubHelpers { { // The length of the returned array is an approximation based on the length of the input string and the system // character set. It is only guaranteed to be larger or equal to cbLength, don't depend on the exact value. - [System.Security.SecurityCritical] unsafe static internal byte[] DoAnsiConversion(string str, bool fBestFit, bool fThrowOnUnmappableChar, out int cbLength) { byte[] buffer = new byte[(str.Length + 1) * Marshal.SystemMaxDBCSCharSize]; @@ -34,7 +33,6 @@ namespace System.StubHelpers { return buffer; } - [System.Security.SecurityCritical] unsafe static internal byte ConvertToNative(char managedChar, bool fBestFit, bool fThrowOnUnmappableChar) { int cbAllocLength = (1 + 1) * Marshal.SystemMaxDBCSCharSize; @@ -57,7 +55,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class CSTRMarshaler { - [System.Security.SecurityCritical] // auto-generated static internal unsafe IntPtr ConvertToNative(int flags, string strManaged, IntPtr pNativeBuffer) { if (null == strManaged) @@ -109,7 +106,6 @@ namespace System.StubHelpers { return (IntPtr)pbNativeBuffer; } - [System.Security.SecurityCritical] // auto-generated static internal unsafe string ConvertToManaged(IntPtr cstr) { if (IntPtr.Zero == cstr) @@ -118,7 +114,6 @@ namespace System.StubHelpers { return new String((sbyte*)cstr); } - [System.Security.SecurityCritical] // auto-generated static internal void ClearNative(IntPtr pNative) { Win32Native.CoTaskMemFree(pNative); @@ -129,7 +124,6 @@ namespace System.StubHelpers { internal static class UTF8Marshaler { const int MAX_UTF8_CHAR_SIZE = 3; - [System.Security.SecurityCritical] static internal unsafe IntPtr ConvertToNative(int flags, string strManaged, IntPtr pNativeBuffer) { if (null == strManaged) @@ -166,7 +160,6 @@ namespace System.StubHelpers { return (IntPtr)pbNativeBuffer; } - [System.Security.SecurityCritical] static internal unsafe string ConvertToManaged(IntPtr cstr) { if (IntPtr.Zero == cstr) @@ -175,7 +168,6 @@ namespace System.StubHelpers { return String.CreateStringFromEncoding((byte*)cstr, nbBytes, Encoding.UTF8); } - [System.Security.SecurityCritical] static internal void ClearNative(IntPtr pNative) { if (pNative != IntPtr.Zero) @@ -188,7 +180,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class UTF8BufferMarshaler { - [System.Security.SecurityCritical] static internal unsafe IntPtr ConvertToNative(StringBuilder sb, IntPtr pNativeBuffer, int flags) { if (null == sb) @@ -210,7 +201,6 @@ namespace System.StubHelpers { return (IntPtr)pbNativeBuffer; } - [System.Security.SecurityCritical] static internal unsafe void ConvertToManaged(StringBuilder sb, IntPtr pNative) { if (pNative == null) @@ -241,7 +231,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class BSTRMarshaler { - [System.Security.SecurityCritical] // auto-generated static internal unsafe IntPtr ConvertToNative(string strManaged, IntPtr pNativeBuffer) { if (null == strManaged) @@ -311,7 +300,6 @@ namespace System.StubHelpers { } } - [System.Security.SecurityCritical] // auto-generated static internal unsafe string ConvertToManaged(IntPtr bstr) { if (IntPtr.Zero == bstr) @@ -356,7 +344,6 @@ namespace System.StubHelpers { } } - [System.Security.SecurityCritical] // auto-generated static internal void ClearNative(IntPtr pNative) { if (IntPtr.Zero != pNative) @@ -372,7 +359,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class VBByValStrMarshaler { - [System.Security.SecurityCritical] // auto-generated static internal unsafe IntPtr ConvertToNative(string strManaged, bool fBestFit, bool fThrowOnUnmappableChar, ref int cch) { if (null == strManaged) @@ -414,7 +400,6 @@ namespace System.StubHelpers { return new IntPtr(pNative); } - [System.Security.SecurityCritical] // auto-generated static internal unsafe string ConvertToManaged(IntPtr pNative, int cch) { if (IntPtr.Zero == pNative) @@ -425,7 +410,6 @@ namespace System.StubHelpers { return new String((sbyte*)pNative, 0, cch); } - [System.Security.SecurityCritical] // auto-generated static internal unsafe void ClearNative(IntPtr pNative) { if (IntPtr.Zero != pNative) @@ -441,7 +425,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class AnsiBSTRMarshaler { - [System.Security.SecurityCritical] // auto-generated static internal unsafe IntPtr ConvertToNative(int flags, string strManaged) { if (null == strManaged) @@ -464,7 +447,6 @@ namespace System.StubHelpers { return Win32Native.SysAllocStringByteLen(bytes, (uint)nb); } - [System.Security.SecurityCritical] // auto-generated static internal unsafe string ConvertToManaged(IntPtr bstr) { if (IntPtr.Zero == bstr) @@ -480,7 +462,6 @@ namespace System.StubHelpers { } } - [System.Security.SecurityCritical] // auto-generated static internal unsafe void ClearNative(IntPtr pNative) { if (IntPtr.Zero != pNative) @@ -531,14 +512,12 @@ namespace System.StubHelpers { // You can get this through: (new DateTimeOffset(1601, 1, 1, 0, 0, 1, TimeSpan.Zero)).Ticks; private const Int64 ManagedUtcTicksAtNativeZero = 504911232000000000; - [SecurityCritical] internal static void ConvertToNative(ref DateTimeOffset managedDTO, out DateTimeNative dateTime) { Int64 managedUtcTicks = managedDTO.UtcTicks; dateTime.UniversalTime = managedUtcTicks - ManagedUtcTicksAtNativeZero; } - [SecurityCritical] internal static void ConvertToManaged(out DateTimeOffset managedLocalDTO, ref DateTimeNative nativeTicks) { Int64 managedUtcTicks = ManagedUtcTicksAtNativeZero + nativeTicks.UniversalTime; @@ -558,7 +537,6 @@ namespace System.StubHelpers { internal static class HStringMarshaler { // Slow-path, which requires making a copy of the managed string into the resulting HSTRING - [SecurityCritical] internal static unsafe IntPtr ConvertToNative(string managed) { if (!Environment.IsWinRTSupported) @@ -578,7 +556,6 @@ namespace System.StubHelpers { // Note that the managed string input to this method MUST be pinned, and stay pinned for the lifetime of // the returned HSTRING object. If the string is not pinned, or becomes unpinned before the HSTRING's // lifetime ends, the HSTRING instance will be corrupted. - [SecurityCritical] internal static unsafe IntPtr ConvertToNativeReference(string managed, [Out] HSTRING_HEADER *hstringHeader) { @@ -598,7 +575,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static string ConvertToManaged(IntPtr hstring) { if (!Environment.IsWinRTSupported) @@ -609,7 +585,6 @@ namespace System.StubHelpers { return WindowsRuntimeMarshal.HStringToString(hstring); } - [SecurityCritical] internal static void ClearNative(IntPtr hstring) { Contract.Assert(Environment.IsWinRTSupported); @@ -639,7 +614,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class ValueClassMarshaler { - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern void ConvertToNative(IntPtr dst, IntPtr src, IntPtr pMT, ref CleanupWorkList pCleanupWorkList); @@ -672,7 +646,6 @@ namespace System.StubHelpers { [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern object ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, int flags); - [SecurityCritical] [DllImport(JitHelpers.QCall), SuppressUnmanagedCodeSecurity] static internal extern void ClearNative(IntPtr pUnk); @@ -690,10 +663,8 @@ namespace System.StubHelpers { static internal extern string GetRawUriFromNative(IntPtr pUri); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecurityCritical] static unsafe internal extern IntPtr CreateNativeUriInstanceHelper(char* rawUri, int strLen); - [System.Security.SecurityCritical] static unsafe internal IntPtr CreateNativeUriInstance(string rawUri) { fixed(char* pManaged = rawUri) @@ -707,7 +678,6 @@ namespace System.StubHelpers { [FriendAccessAllowed] internal static class EventArgsMarshaler { - [SecurityCritical] [FriendAccessAllowed] static internal IntPtr CreateNativeNCCEventArgsInstance(int action, object newItems, object oldItems, int newIndex, int oldIndex) { @@ -733,12 +703,10 @@ namespace System.StubHelpers { } } - [SecurityCritical] [FriendAccessAllowed] [DllImport(JitHelpers.QCall), SuppressUnmanagedCodeSecurity] static extern internal IntPtr CreateNativePCEventArgsInstance([MarshalAs(UnmanagedType.HString)]string name); - [SecurityCritical] [DllImport(JitHelpers.QCall), SuppressUnmanagedCodeSecurity] static extern internal IntPtr CreateNativeNCCEventArgsInstanceHelper(int action, IntPtr newItem, IntPtr oldItem, int newIndex, int oldIndex); } @@ -796,19 +764,15 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class MngdHiddenLengthArrayMarshaler { - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern void CreateMarshaler(IntPtr pMarshalState, IntPtr pMT, IntPtr cbElementSize, ushort vt); - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ConvertSpaceToNative(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome); - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ConvertContentsToNative(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome); - [SecurityCritical] internal static unsafe void ConvertContentsToNative_DateTime(ref DateTimeOffset[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -821,7 +785,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToNative_Type(ref System.Type[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -834,7 +797,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToNative_Exception(ref Exception[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -847,7 +809,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToNative_Nullable(ref Nullable[] managedArray, IntPtr pNativeHome) where T : struct { @@ -861,7 +822,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToNative_KeyValuePair(ref KeyValuePair[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -874,15 +834,12 @@ namespace System.StubHelpers { } } - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ConvertSpaceToManaged(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome, int elementCount); - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ConvertContentsToManaged(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome); - [SecurityCritical] internal static unsafe void ConvertContentsToManaged_DateTime(ref DateTimeOffset[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -895,7 +852,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToManaged_Type(ref System.Type[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -908,7 +864,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToManaged_Exception(ref Exception[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -921,7 +876,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToManaged_Nullable(ref Nullable[] managedArray, IntPtr pNativeHome) where T : struct { @@ -935,7 +889,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ConvertContentsToManaged_KeyValuePair(ref KeyValuePair[] managedArray, IntPtr pNativeHome) { if (managedArray != null) @@ -948,11 +901,9 @@ namespace System.StubHelpers { } } - [SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ClearNativeContents(IntPtr pMarshalState, IntPtr pNativeHome, int cElements); - [SecurityCritical] internal static unsafe void ClearNativeContents_Type(IntPtr pNativeHome, int cElements) { Contract.Assert(Environment.IsWinRTSupported); @@ -991,7 +942,6 @@ namespace System.StubHelpers { } // class MngdRefCustomMarshaler [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - [System.Security.SecurityCritical] internal struct AsAnyMarshaler { private const ushort VTHACK_ANSICHAR = 253; @@ -1037,7 +987,6 @@ namespace System.StubHelpers { #region ConvertToNative helpers - [System.Security.SecurityCritical] private unsafe IntPtr ConvertArrayToNative(object pManagedHome, int dwFlags) { Type elementType = pManagedHome.GetType().GetElementType(); @@ -1109,7 +1058,6 @@ namespace System.StubHelpers { return pNativeHome; } - [System.Security.SecurityCritical] private static IntPtr ConvertStringToNative(string pManagedHome, int dwFlags) { IntPtr pNativeHome; @@ -1137,7 +1085,6 @@ namespace System.StubHelpers { return pNativeHome; } - [System.Security.SecurityCritical] private unsafe IntPtr ConvertStringBuilderToNative(StringBuilder pManagedHome, int dwFlags) { IntPtr pNativeHome; @@ -1211,7 +1158,6 @@ namespace System.StubHelpers { return pNativeHome; } - [System.Security.SecurityCritical] private unsafe IntPtr ConvertLayoutToNative(object pManagedHome, int dwFlags) { // Note that the following call will not throw exception if the type @@ -1237,7 +1183,6 @@ namespace System.StubHelpers { #endregion - [System.Security.SecurityCritical] internal IntPtr ConvertToNative(object pManagedHome, int dwFlags) { if (pManagedHome == null) @@ -1283,7 +1228,6 @@ namespace System.StubHelpers { return pNativeHome; } - [System.Security.SecurityCritical] internal unsafe void ConvertToManaged(object pManagedHome, IntPtr pNativeHome) { switch (backPropAction) @@ -1321,7 +1265,6 @@ namespace System.StubHelpers { } } - [System.Security.SecurityCritical] internal void ClearNative(IntPtr pNativeHome) { if (pNativeHome != IntPtr.Zero) @@ -1341,7 +1284,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class NullableMarshaler { - [SecurityCritical] static internal IntPtr ConvertToNative(ref Nullable pManaged) where T : struct { if (pManaged.HasValue) @@ -1355,14 +1297,12 @@ namespace System.StubHelpers { } } - [SecurityCritical] static internal void ConvertToManagedRetVoid(IntPtr pNative, ref Nullable retObj) where T : struct { retObj = ConvertToManaged(pNative); } - [SecurityCritical] static internal Nullable ConvertToManaged(IntPtr pNative) where T : struct { if (pNative != IntPtr.Zero) @@ -1406,7 +1346,6 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class SystemTypeMarshaler { - [SecurityCritical] internal static unsafe void ConvertToNative(System.Type managedType, TypeNameNative *pNativeType) { if (!Environment.IsWinRTSupported) @@ -1450,7 +1389,6 @@ namespace System.StubHelpers { Marshal.ThrowExceptionForHR(hrCreate, new IntPtr(-1)); } - [SecurityCritical] internal static unsafe void ConvertToManaged(TypeNameNative *pNativeType, ref System.Type managedType) { if (!Environment.IsWinRTSupported) @@ -1480,7 +1418,6 @@ namespace System.StubHelpers { } } - [SecurityCritical] internal static unsafe void ClearNative(TypeNameNative *pNativeType) { Contract.Assert(Environment.IsWinRTSupported); @@ -1509,7 +1446,6 @@ namespace System.StubHelpers { return ex._HResult; } - [SecuritySafeCritical] static internal unsafe Exception ConvertToManaged(int hr) { Contract.Ensures(Contract.Result() != null || hr >= 0); @@ -1535,14 +1471,12 @@ namespace System.StubHelpers { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal static class KeyValuePairMarshaler { - [SecurityCritical] internal static IntPtr ConvertToNative([In] ref KeyValuePair pair) { IKeyValuePair impl = new CLRIKeyValuePairImpl(ref pair); return Marshal.GetComInterfaceForObject(impl, typeof(IKeyValuePair)); } - [SecurityCritical] internal static KeyValuePair ConvertToManaged(IntPtr pInsp) { object obj = InterfaceMarshaler.ConvertToManagedWithoutUnboxing(pInsp); @@ -1552,7 +1486,6 @@ namespace System.StubHelpers { } // Called from COMInterfaceMarshaler - [SecurityCritical] internal static object ConvertToManagedBox(IntPtr pInsp) { return (object)ConvertToManaged(pInsp); @@ -1624,7 +1557,6 @@ namespace System.StubHelpers { // Aggregates SafeHandle and the "owned" bit which indicates whether the SafeHandle // has been successfully AddRef'ed. This allows us to do realiable cleanup (Release) // if and only if it is needed. - [System.Security.SecurityCritical] internal sealed class CleanupWorkListElement { public CleanupWorkListElement(SafeHandle handle) @@ -1640,7 +1572,6 @@ namespace System.StubHelpers { } // class CleanupWorkListElement [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - [System.Security.SecurityCritical] internal sealed class CleanupWorkList { private List m_list = new List(); @@ -1662,7 +1593,6 @@ namespace System.StubHelpers { } } // class CleanupWorkList - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [SuppressUnmanagedCodeSecurityAttribute()] internal static class StubHelpers @@ -1713,7 +1643,6 @@ namespace System.StubHelpers { [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern void ThrowInteropParamException(int resID, int paramIdx); - [System.Security.SecurityCritical] static internal IntPtr AddToCleanupList(ref CleanupWorkList pCleanupWorkList, SafeHandle handle) { if (pCleanupWorkList == null) @@ -1726,7 +1655,6 @@ namespace System.StubHelpers { return SafeHandleAddRef(handle, ref element.m_owned); } - [System.Security.SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] static internal void DestroyCleanupList(ref CleanupWorkList pCleanupWorkList) { @@ -1775,7 +1703,6 @@ namespace System.StubHelpers { //------------------------------------------------------- // AddRefs the SH and returns the underlying unmanaged handle. - [System.Security.SecurityCritical] // auto-generated static internal IntPtr SafeHandleAddRef(SafeHandle pHandle, ref bool success) { if (pHandle == null) @@ -1790,7 +1717,6 @@ namespace System.StubHelpers { } // Releases the SH (to be called from finally block). - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] static internal void SafeHandleRelease(SafeHandle pHandle) { @@ -1848,15 +1774,12 @@ namespace System.StubHelpers { static internal extern IntPtr GetDelegateInvokeMethod(Delegate pThis); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecurityCritical] static internal extern object GetWinRTFactoryObject(IntPtr pCPCMD); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecurityCritical] static internal extern IntPtr GetWinRTFactoryReturnValue(object pThis, IntPtr pCtorEntry); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecurityCritical] static internal extern IntPtr GetOuterInspectable(object pThis, IntPtr pCtorMD); #if MDA_SUPPORTED diff --git a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs index 2f653e4..ac85801 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs @@ -70,7 +70,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, chars); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetByteCount(char* chars, int count) @@ -99,7 +98,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) @@ -115,7 +113,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetCharCount(byte* bytes, int count) @@ -129,7 +126,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) @@ -150,7 +146,6 @@ namespace System.Text // GetByteCount // Note: We start by assuming that the output will be the same as count. Having // an encoder or fallback may change that assumption - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int charCount, EncoderNLS encoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already @@ -285,7 +280,6 @@ namespace System.Text return byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -502,7 +496,6 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS decoder) { // Just assert, we're called internally so these should be safe, checked already @@ -575,7 +568,6 @@ namespace System.Text return charCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS decoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/BaseCodePageEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/BaseCodePageEncoding.cs index 4c9ca6e..f80f8e6 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/BaseCodePageEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/BaseCodePageEncoding.cs @@ -72,7 +72,6 @@ namespace System.Text [NonSerialized] protected bool m_bUseMlangTypeForSerialization = false; - [System.Security.SecuritySafeCritical] // static constructors should be safe to call static BaseCodePageEncoding() { } @@ -136,32 +135,26 @@ namespace System.Text } // Initialize our global stuff - [SecurityCritical] unsafe static CodePageDataFileHeader* m_pCodePageFileHeader = (CodePageDataFileHeader*)GlobalizationAssembly.GetGlobalizationResourceBytePtr( typeof(CharUnicodeInfo).Assembly, CODE_PAGE_DATA_FILE_NAME); // Real variables [NonSerialized] - [SecurityCritical] unsafe protected CodePageHeader* pCodePage = null; // Safe handle wrapper around section map view - [System.Security.SecurityCritical] // auto-generated [NonSerialized] protected SafeViewOfFileHandle safeMemorySectionHandle = null; // Safe handle wrapper around mapped file handle - [System.Security.SecurityCritical] // auto-generated [NonSerialized] protected SafeFileMappingHandle safeFileMappingHandle = null; - [System.Security.SecurityCritical] // auto-generated internal BaseCodePageEncoding(int codepage) : this(codepage, codepage) { } - [System.Security.SecurityCritical] // auto-generated internal BaseCodePageEncoding(int codepage, int dataCodePage) : base(codepage == 0? Microsoft.Win32.Win32Native.GetACP(): codepage) { @@ -171,7 +164,6 @@ namespace System.Text } // Constructor called by serialization. - [System.Security.SecurityCritical] // auto-generated internal BaseCodePageEncoding(SerializationInfo info, StreamingContext context) : base(0) { // We cannot ever call this, we've proxied ourselved to CodePageEncoding @@ -179,7 +171,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Make sure to get the base stuff too This throws if info is null @@ -196,7 +187,6 @@ namespace System.Text } // We need to load tables for our code page - [System.Security.SecurityCritical] // auto-generated private unsafe void LoadCodePageTables() { CodePageHeader* pCodePage = FindCodePage(dataTableCodePage); @@ -217,7 +207,6 @@ namespace System.Text } // Look up the code page pointer - [System.Security.SecurityCritical] // auto-generated private static unsafe CodePageHeader* FindCodePage(int codePage) { // We'll have to loop through all of the m_pCodePageIndex[] items to find our code page, this isn't @@ -240,7 +229,6 @@ namespace System.Text } // Get our code page byte count - [System.Security.SecurityCritical] // auto-generated internal static unsafe int GetCodePageByteSize(int codePage) { // Get our code page info @@ -257,11 +245,9 @@ namespace System.Text } // We have a managed code page entry, so load our tables - [System.Security.SecurityCritical] protected abstract unsafe void LoadManagedCodePage(); // Allocate memory to load our code page - [System.Security.SecurityCritical] // auto-generated protected unsafe byte* GetSharedMemory(int iSize) { // Build our name @@ -291,7 +277,6 @@ namespace System.Text return pMemorySection; } - [System.Security.SecurityCritical] // auto-generated protected unsafe virtual String GetMemorySectionName() { int iUseCodePage = this.bFlagDataTable ? dataTableCodePage : CodePage; @@ -303,10 +288,8 @@ namespace System.Text return strName; } - [System.Security.SecurityCritical] protected abstract unsafe void ReadBestFitTable(); - [System.Security.SecuritySafeCritical] internal override char[] GetBestFitUnicodeToBytesData() { // Read in our best fit table if necessary @@ -319,7 +302,6 @@ namespace System.Text return arrayUnicodeBestFit; } - [System.Security.SecuritySafeCritical] internal override char[] GetBestFitBytesToUnicodeData() { // Read in our best fit table if necessary @@ -336,7 +318,6 @@ namespace System.Text // is invalid. so we detect that by validating the memory section handle then re-initialize the memory // section by calling LoadManagedCodePage() method and eventually the mapped file handle and // the memory section pointer will get finalized one more time. - [System.Security.SecurityCritical] // auto-generated internal unsafe void CheckMemorySection() { if (safeMemorySectionHandle != null && safeMemorySectionHandle.DangerousGetHandle() == IntPtr.Zero) diff --git a/src/coreclr/src/mscorlib/src/System/Text/CodePageEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/CodePageEncoding.cs index 5ab73fc..5e76946 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/CodePageEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/CodePageEncoding.cs @@ -74,7 +74,6 @@ namespace System.Text } // Just get it from GetEncoding - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { // Get our encoding (Note: This has default fallbacks for readonly and everett cases) @@ -93,7 +92,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. @@ -120,14 +118,12 @@ namespace System.Text } // Just get it from GetDecider - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { return this.realEncoding.GetDecoder(); } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. diff --git a/src/coreclr/src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs index 1503ef7..5d2f68f 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs @@ -20,13 +20,10 @@ namespace System.Text { // Pointers to our memory section parts [NonSerialized] - [SecurityCritical] protected unsafe char* mapBytesToUnicode = null; // char 65536 [NonSerialized] - [SecurityCritical] protected unsafe ushort* mapUnicodeToBytes = null; // byte 65536 [NonSerialized] - [SecurityCritical] protected unsafe int* mapCodePageCached = null; // to remember which CP is cached [NonSerialized] @@ -45,19 +42,16 @@ namespace System.Text [NonSerialized] protected char charUnknown = (char)0; - [System.Security.SecurityCritical] // auto-generated public DBCSCodePageEncoding(int codePage) : this(codePage, codePage) { } - [System.Security.SecurityCritical] // auto-generated internal DBCSCodePageEncoding(int codePage, int dataCodePage) : base(codePage, dataCodePage) { } // Constructor called by serialization. // Note: We use the base GetObjectData however - [System.Security.SecurityCritical] // auto-generated internal DBCSCodePageEncoding(SerializationInfo info, StreamingContext context) : base(0) { // Actually this can't ever get called, CodePageEncoding is our proxy @@ -93,7 +87,6 @@ namespace System.Text // corrospond to those unicode code points. // We have a managed code page entry, so load our tables // - [System.Security.SecurityCritical] // auto-generated protected override unsafe void LoadManagedCodePage() { // Should be loading OUR code page @@ -235,7 +228,6 @@ namespace System.Text } // Any special processing for this code page - [System.Security.SecurityCritical] // auto-generated protected virtual unsafe void CleanUpEndBytes(char* chars) { } @@ -256,7 +248,6 @@ namespace System.Text } // Read in our best fit table - [System.Security.SecurityCritical] // auto-generated protected unsafe override void ReadBestFitTable() { // Lock so we don't confuse ourselves. @@ -534,7 +525,6 @@ namespace System.Text // GetByteCount // Note: We start by assuming that the output will be the same as count. Having // an encoder or fallback may change that assumption - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS encoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already @@ -625,7 +615,6 @@ namespace System.Text return (int)byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -779,7 +768,6 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { // Just assert, we're called internally so these should be safe, checked already @@ -925,7 +913,6 @@ namespace System.Text return charCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs b/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs index 6c1b7e2..3a6e877 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs @@ -124,7 +124,6 @@ namespace System.Text // We expect this to be the workhorse for NLS Encodings, but for existing // ones we need a working (if slow) default implimentation) - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetCharCount(byte* bytes, int count, bool flush) @@ -189,7 +188,6 @@ namespace System.Text // the char[] to our char* output buffer. If the result count was wrong, we // could easily overflow our output buffer. Therefore we do an extra test // when we copy the buffer so that we don't overflow charCount either. - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetChars(byte* bytes, int byteCount, @@ -306,7 +304,6 @@ namespace System.Text // Note that if all of the input bytes are not consumed, then we'll do a /2, which means // that its likely that we didn't consume as many bytes as we could have. For some // applications this could be slow. (Like trying to exactly fill an output buffer from a bigger stream) - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe void Convert(byte* bytes, int byteCount, diff --git a/src/coreclr/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs index 5c1dcd9..0537379 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs @@ -155,7 +155,6 @@ namespace System.Text } // Clear the buffer - [System.Security.SecuritySafeCritical] // overrides public transparent member public override unsafe void Reset() { iCount = -1; @@ -163,7 +162,6 @@ namespace System.Text } // This version just counts the fallback and doesn't actually copy anything. - [System.Security.SecurityCritical] // auto-generated internal unsafe override int InternalFallback(byte[] bytes, byte* pBytes) // Right now this has both bytes and bytes[], since we might have extra bytes, hence the // array, and we might need the index, hence the byte* diff --git a/src/coreclr/src/mscorlib/src/System/Text/DecoderFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/DecoderFallback.cs index 24f33b9..cd7fbbc 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/DecoderFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/DecoderFallback.cs @@ -115,13 +115,10 @@ namespace System.Text // Internal items to help us figure out what we're doing as far as error messages, etc. // These help us with our performance and messages internally - [SecurityCritical] internal unsafe byte* byteStart; - [SecurityCritical] internal unsafe char* charEnd; // Internal Reset - [System.Security.SecurityCritical] // auto-generated internal unsafe void InternalReset() { byteStart = null; @@ -130,7 +127,6 @@ namespace System.Text // Set the above values // This can't be part of the constructor because DecoderFallbacks would have to know how to impliment these. - [System.Security.SecurityCritical] // auto-generated internal unsafe void InternalInitialize(byte* byteStart, char* charEnd) { this.byteStart = byteStart; @@ -145,7 +141,6 @@ namespace System.Text // Right now this has both bytes and bytes[], since we might have extra bytes, hence the // array, and we might need the index, hence the byte* // Don't touch ref chars unless we succeed - [System.Security.SecurityCritical] // auto-generated internal unsafe virtual bool InternalFallback(byte[] bytes, byte* pBytes, ref char* chars) { // Copy bytes to array (slow, but right now that's what we get to do. @@ -204,7 +199,6 @@ namespace System.Text } // This version just counts the fallback and doesn't actually copy anything. - [System.Security.SecurityCritical] // auto-generated internal unsafe virtual int InternalFallback(byte[] bytes, byte* pBytes) // Right now this has both bytes and bytes[], since we might have extra bytes, hence the // array, and we might need the index, hence the byte* diff --git a/src/coreclr/src/mscorlib/src/System/Text/DecoderNLS.cs b/src/coreclr/src/mscorlib/src/System/Text/DecoderNLS.cs index 56c95de..e44c43a 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/DecoderNLS.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/DecoderNLS.cs @@ -42,7 +42,6 @@ namespace System.Text } // ISerializable implementation. called during serialization. - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { SerializeDecoder(info); @@ -77,7 +76,6 @@ namespace System.Text return GetCharCount(bytes, index, count, false); } - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe int GetCharCount(byte[] bytes, int index, int count, bool flush) { // Validate Parameters @@ -104,7 +102,6 @@ namespace System.Text return GetCharCount(pBytes + index, count, flush); } - [System.Security.SecurityCritical] // auto-generated public unsafe override int GetCharCount(byte* bytes, int count, bool flush) { // Validate parameters @@ -131,7 +128,6 @@ namespace System.Text return GetChars(bytes, byteIndex, byteCount, chars, charIndex, false); } - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush) { @@ -170,7 +166,6 @@ namespace System.Text pChars + charIndex, charCount, flush); } - [System.Security.SecurityCritical] // auto-generated public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush) { @@ -194,7 +189,6 @@ namespace System.Text // This method is used when the output buffer might not be big enough. // Just call the pointer version. (This gets chars) - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) @@ -241,7 +235,6 @@ namespace System.Text // This is the version that used pointers. We call the base encoding worker function // after setting our appropriate internal variables. This is getting chars - [System.Security.SecurityCritical] // auto-generated public unsafe override void Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) diff --git a/src/coreclr/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs index 44a34c1..c19479de 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs @@ -187,7 +187,6 @@ namespace System.Text } // Clear the buffer - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe void Reset() { fallbackCount = -1; @@ -196,7 +195,6 @@ namespace System.Text } // This version just counts the fallback and doesn't actually copy anything. - [System.Security.SecurityCritical] // auto-generated internal unsafe override int InternalFallback(byte[] bytes, byte* pBytes) // Right now this has both bytes and bytes[], since we might have extra bytes, hence the // array, and we might need the index, hence the byte* diff --git a/src/coreclr/src/mscorlib/src/System/Text/EUCJPEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/EUCJPEncoding.cs index 7c90cae..44345b2 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EUCJPEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EUCJPEncoding.cs @@ -50,13 +50,11 @@ namespace System.Text internal class EUCJPEncoding : DBCSCodePageEncoding { // This pretends to be CP 932 as far as memory tables are concerned. - [System.Security.SecurityCritical] // auto-generated public EUCJPEncoding() : base(51932, 932) { this.m_bUseMlangTypeForSerialization = true; } - [System.Security.SecurityCritical] // auto-generated protected unsafe override String GetMemorySectionName() { int iUseCodePage = this.bFlagDataTable ? dataTableCodePage : CodePage; @@ -165,7 +163,6 @@ namespace System.Text return true; } - [System.Security.SecurityCritical] // auto-generated protected override unsafe void CleanUpEndBytes(char* chars) { // Need to special case CP 51932 diff --git a/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs b/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs index e965c3a..82a22f4 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs @@ -120,7 +120,6 @@ namespace System.Text // We expect this to be the workhorse for NLS encodings // unfortunately for existing overrides, it has to call the [] version, // which is really slow, so avoid this method if you might be calling external encodings. - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetByteCount(char* chars, int count, bool flush) @@ -182,7 +181,6 @@ namespace System.Text // the byte[] to our byte* output buffer. If the result count was wrong, we // could easily overflow our output buffer. Therefore we do an extra test // when we copy the buffer so that we don't overflow byteCount either. - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetBytes(char* chars, int charCount, @@ -299,7 +297,6 @@ namespace System.Text // Note that if all of the input chars are not consumed, then we'll do a /2, which means // that its likely that we didn't consume as many chars as we could have. For some // applications this could be slow. (Like trying to exactly fill an output buffer from a bigger stream) - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe void Convert(char* chars, int charCount, diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs index 92eff37..f22d318 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs @@ -183,7 +183,6 @@ namespace System.Text } // Clear the buffer - [System.Security.SecuritySafeCritical] // overrides public transparent member public override unsafe void Reset() { iCount = -1; diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncoderFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/EncoderFallback.cs index 4b17041..8b2510d 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncoderFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncoderFallback.cs @@ -111,9 +111,7 @@ namespace System.Text // Internal items to help us figure out what we're doing as far as error messages, etc. // These help us with our performance and messages internally - [SecurityCritical] internal unsafe char* charStart; - [SecurityCritical] internal unsafe char* charEnd; internal EncoderNLS encoder; internal bool setEncoder; @@ -124,7 +122,6 @@ namespace System.Text // Internal Reset // For example, what if someone fails a conversion and wants to reset one of our fallback buffers? - [System.Security.SecurityCritical] // auto-generated internal unsafe void InternalReset() { charStart = null; @@ -135,7 +132,6 @@ namespace System.Text // Set the above values // This can't be part of the constructor because EncoderFallbacks would have to know how to impliment these. - [System.Security.SecurityCritical] // auto-generated internal unsafe void InternalInitialize(char* charStart, char* charEnd, EncoderNLS encoder, bool setEncoder) { this.charStart = charStart; @@ -163,7 +159,6 @@ namespace System.Text // Note that this could also change the contents of this.encoder, which is the same // object that the caller is using, so the caller could mess up the encoder for us // if they aren't careful. - [System.Security.SecurityCritical] // auto-generated internal unsafe virtual bool InternalFallback(char ch, ref char* chars) { // Shouldn't have null charStart diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncoderNLS.cs b/src/coreclr/src/mscorlib/src/System/Text/EncoderNLS.cs index eef9c46..2add017 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncoderNLS.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncoderNLS.cs @@ -45,7 +45,6 @@ namespace System.Text } // ISerializable implementation. called during serialization. - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { SerializeEncoder(info); @@ -77,7 +76,6 @@ namespace System.Text m_fallbackBuffer.Reset(); } - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe int GetByteCount(char[] chars, int index, int count, bool flush) { // Validate input parameters @@ -107,7 +105,6 @@ namespace System.Text return result; } - [System.Security.SecurityCritical] // auto-generated public unsafe override int GetByteCount(char* chars, int count, bool flush) { // Validate input parameters @@ -125,7 +122,6 @@ namespace System.Text return m_encoding.GetByteCount(chars, count, this); } - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush) { @@ -163,7 +159,6 @@ namespace System.Text pBytes + byteIndex, byteCount, flush); } - [System.Security.SecurityCritical] // auto-generated public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush) { // Validate parameters @@ -183,7 +178,6 @@ namespace System.Text // This method is used when your output buffer might not be large enough for the entire result. // Just call the pointer version. (This gets bytes) - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) @@ -230,7 +224,6 @@ namespace System.Text // This is the version that uses pointers. We call the base encoding worker function // after setting our appropriate internal variables. This is getting bytes - [System.Security.SecurityCritical] // auto-generated public override unsafe void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs b/src/coreclr/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs index c9e0c6c..84dbd90 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs @@ -220,7 +220,6 @@ namespace System.Text } // Clear the buffer - [System.Security.SecuritySafeCritical] // auto-generated public override unsafe void Reset() { fallbackCount = -1; diff --git a/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs index 93ea30b..13073f8 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs @@ -510,7 +510,6 @@ namespace System.Text return fallbackEncoding; } #if FEATURE_CODEPAGES_FILE - [System.Security.SecurityCritical] // auto-generated private static Encoding GetEncodingRare(int codepage) { Contract.Assert(codepage != 0 && codepage != 1200 && codepage != 1201 && codepage != 65001, @@ -579,7 +578,6 @@ namespace System.Text return result; } - [System.Security.SecurityCritical] // auto-generated private static Encoding GetEncodingCodePage(int CodePage) { // Single Byte or Double Byte Code Page? (0 if not found) @@ -890,7 +888,6 @@ namespace System.Text // which is really slow, so this method should be avoided if you're calling // a 3rd party encoding. [Pure] - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetByteCount(char* chars, int count) @@ -916,7 +913,6 @@ namespace System.Text // For NLS Encodings, workhorse takes an encoder (may be null) // Always validate parameters before calling internal version, which will only assert. - [System.Security.SecurityCritical] // auto-generated internal virtual unsafe int GetByteCount(char* chars, int count, EncoderNLS encoder) { Contract.Requires(chars != null); @@ -992,7 +988,6 @@ namespace System.Text // This is our internal workhorse // Always validate parameters before calling internal version, which will only assert. - [System.Security.SecurityCritical] // auto-generated internal virtual unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -1016,7 +1011,6 @@ namespace System.Text // could easily overflow our output buffer. Therefore we do an extra test // when we copy the buffer so that we don't overflow byteCount either. - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetBytes(char* chars, int charCount, @@ -1086,7 +1080,6 @@ namespace System.Text // We expect this to be the workhorse for NLS Encodings, but for existing // ones we need a working (if slow) default implimentation) [Pure] - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetCharCount(byte* bytes, int count) @@ -1112,7 +1105,6 @@ namespace System.Text // This is our internal workhorse // Always validate parameters before calling internal version, which will only assert. - [System.Security.SecurityCritical] // auto-generated internal virtual unsafe int GetCharCount(byte* bytes, int count, DecoderNLS decoder) { return GetCharCount(bytes, count); @@ -1175,7 +1167,6 @@ namespace System.Text // could easily overflow our output buffer. Therefore we do an extra test // when we copy the buffer so that we don't overflow charCount either. - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public virtual unsafe int GetChars(byte* bytes, int byteCount, @@ -1224,7 +1215,6 @@ namespace System.Text // This is our internal workhorse // Always validate parameters before calling internal version, which will only assert. - [System.Security.SecurityCritical] // auto-generated internal virtual unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS decoder) { @@ -1232,7 +1222,6 @@ namespace System.Text } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public unsafe string GetString(byte* bytes, int byteCount) @@ -1300,7 +1289,6 @@ namespace System.Text return new DefaultDecoder(this); } - [System.Security.SecuritySafeCritical] private static Encoding CreateDefaultEncoding() { // defaultEncoding should be null if we get here, but we can't @@ -1476,7 +1464,6 @@ namespace System.Text EncodingName, EncoderFallback.GetType()), "bytes"); } - [System.Security.SecurityCritical] // auto-generated internal void ThrowBytesOverflow(EncoderNLS encoder, bool nothingEncoded) { if (encoder == null || encoder.m_throwOnOverflow || nothingEncoded) @@ -1501,7 +1488,6 @@ namespace System.Text EncodingName, DecoderFallback.GetType()), "chars"); } - [System.Security.SecurityCritical] // auto-generated internal void ThrowCharsOverflow(DecoderNLS decoder, bool nothingDecoded) { if (decoder == null || decoder.m_throwOnOverflow || nothingDecoded) @@ -1552,7 +1538,6 @@ namespace System.Text } // Just get it from GetEncoding - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { // upon deserialization since the DefaultEncoder implement IObjectReference the @@ -1578,7 +1563,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? @@ -1602,7 +1586,6 @@ namespace System.Text return m_encoding.GetByteCount(chars, index, count); } - [System.Security.SecurityCritical] // auto-generated [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. public unsafe override int GetByteCount(char* chars, int count, bool flush) { @@ -1635,7 +1618,6 @@ namespace System.Text return m_encoding.GetBytes(chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush) @@ -1678,7 +1660,6 @@ namespace System.Text } // Just get it from GetEncoding - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { // upon deserialization since the DefaultEncoder implement IObjectReference the @@ -1699,7 +1680,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? @@ -1727,7 +1707,6 @@ namespace System.Text return m_encoding.GetCharCount(bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. public unsafe override int GetCharCount(byte* bytes, int count, bool flush) { @@ -1764,7 +1743,6 @@ namespace System.Text return m_encoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems. public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush) @@ -1776,24 +1754,17 @@ namespace System.Text internal class EncodingCharBuffer { - [SecurityCritical] unsafe char* chars; - [SecurityCritical] unsafe char* charStart; - [SecurityCritical] unsafe char* charEnd; int charCountResult = 0; Encoding enc; DecoderNLS decoder; - [SecurityCritical] unsafe byte* byteStart; - [SecurityCritical] unsafe byte* byteEnd; - [SecurityCritical] unsafe byte* bytes; DecoderFallbackBuffer fallbackBuffer; - [System.Security.SecurityCritical] // auto-generated internal unsafe EncodingCharBuffer(Encoding enc, DecoderNLS decoder, char* charStart, int charCount, byte* byteStart, int byteCount) { @@ -1820,7 +1791,6 @@ namespace System.Text fallbackBuffer.InternalInitialize(bytes, charEnd); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddChar(char ch, int numBytes) { if (chars != null) @@ -1839,14 +1809,12 @@ namespace System.Text return true; } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddChar(char ch) { return AddChar(ch,1); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddChar(char ch1, char ch2, int numBytes) { // Need room for 2 chars @@ -1860,7 +1828,6 @@ namespace System.Text return AddChar(ch1, numBytes) && AddChar(ch2, numBytes); } - [System.Security.SecurityCritical] // auto-generated internal unsafe void AdjustBytes(int count) { bytes += count; @@ -1868,7 +1835,6 @@ namespace System.Text internal unsafe bool MoreData { - [System.Security.SecurityCritical] // auto-generated get { return bytes < byteEnd; @@ -1876,7 +1842,6 @@ namespace System.Text } // Do we have count more bytes? - [System.Security.SecurityCritical] // auto-generated internal unsafe bool EvenMoreData(int count) { return (bytes <= byteEnd - count); @@ -1884,7 +1849,6 @@ namespace System.Text // GetNextByte shouldn't be called unless the caller's already checked more data or even more data, // but we'll double check just to make sure. - [System.Security.SecurityCritical] // auto-generated internal unsafe byte GetNextByte() { Contract.Assert(bytes < byteEnd, "[EncodingCharBuffer.GetNextByte]Expected more date"); @@ -1895,14 +1859,12 @@ namespace System.Text internal unsafe int BytesUsed { - [System.Security.SecurityCritical] // auto-generated get { return (int)(bytes - byteStart); } } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Fallback(byte fallbackByte) { // Build our buffer @@ -1912,7 +1874,6 @@ namespace System.Text return Fallback(byteBuffer); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Fallback(byte byte1, byte byte2) { // Build our buffer @@ -1922,7 +1883,6 @@ namespace System.Text return Fallback(byteBuffer); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Fallback(byte byte1, byte byte2, byte byte3, byte byte4) { // Build our buffer @@ -1932,7 +1892,6 @@ namespace System.Text return Fallback(byteBuffer); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Fallback(byte[] byteBuffer) { // Do the fallback and add the data. @@ -1968,24 +1927,17 @@ namespace System.Text internal class EncodingByteBuffer { - [SecurityCritical] unsafe byte* bytes; - [SecurityCritical] unsafe byte* byteStart; - [SecurityCritical] unsafe byte* byteEnd; - [SecurityCritical] unsafe char* chars; - [SecurityCritical] unsafe char* charStart; - [SecurityCritical] unsafe char* charEnd; int byteCountResult = 0; Encoding enc; EncoderNLS encoder; internal EncoderFallbackBuffer fallbackBuffer; - [System.Security.SecurityCritical] // auto-generated internal unsafe EncodingByteBuffer(Encoding inEncoding, EncoderNLS inEncoder, byte* inByteStart, int inByteCount, char* inCharStart, int inCharCount) { @@ -2014,7 +1966,6 @@ namespace System.Text fallbackBuffer.InternalInitialize(chars, charEnd, encoder, bytes != null); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b, int moreBytesExpected) { Contract.Assert(moreBytesExpected >= 0, "[EncodingByteBuffer.AddByte]expected non-negative moreBytesExpected"); @@ -2033,31 +1984,26 @@ namespace System.Text return true; } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1) { return (AddByte(b1, 0)); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1, byte b2) { return (AddByte(b1, b2, 0)); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1, byte b2, int moreBytesExpected) { return (AddByte(b1, 1 + moreBytesExpected) && AddByte(b2, moreBytesExpected)); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1, byte b2, byte b3) { return AddByte(b1, b2, b3, (int)0); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1, byte b2, byte b3, int moreBytesExpected) { return (AddByte(b1, 2 + moreBytesExpected) && @@ -2065,7 +2011,6 @@ namespace System.Text AddByte(b3, moreBytesExpected)); } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool AddByte(byte b1, byte b2, byte b3, byte b4) { return (AddByte(b1, 3) && @@ -2074,7 +2019,6 @@ namespace System.Text AddByte(b4, 0)); } - [System.Security.SecurityCritical] // auto-generated internal unsafe void MovePrevious(bool bThrow) { if (fallbackBuffer.bFallingBack) @@ -2092,7 +2036,6 @@ namespace System.Text enc.ThrowBytesOverflow(encoder, bytes == byteStart); // Throw? (and reset fallback if not converting) } - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Fallback(char charFallback) { // Do the fallback @@ -2101,7 +2044,6 @@ namespace System.Text internal unsafe bool MoreData { - [System.Security.SecurityCritical] // auto-generated get { // See if fallbackBuffer is not empty or if there's data left in chars buffer. @@ -2109,7 +2051,6 @@ namespace System.Text } } - [System.Security.SecurityCritical] // auto-generated internal unsafe char GetNextChar() { // See if there's something in our fallback buffer @@ -2127,7 +2068,6 @@ namespace System.Text internal unsafe int CharsUsed { - [System.Security.SecurityCritical] // auto-generated get { return (int)(chars - charStart); diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncodingForwarder.cs b/src/coreclr/src/mscorlib/src/System/Text/EncodingForwarder.cs index 5579f6d..6a0db2b 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncodingForwarder.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncodingForwarder.cs @@ -31,7 +31,6 @@ namespace System.Text // the parameter, it will call the same method again, which will eventually // lead to a StackOverflowException. - [SecuritySafeCritical] public unsafe static int GetByteCount(Encoding encoding, char[] chars, int index, int count) { // Validate parameters @@ -60,7 +59,6 @@ namespace System.Text return encoding.GetByteCount(pChars + index, count, encoder: null); } - [SecuritySafeCritical] public unsafe static int GetByteCount(Encoding encoding, string s) { Contract.Assert(encoding != null); @@ -84,7 +82,6 @@ namespace System.Text return encoding.GetByteCount(pChars, s.Length, encoder: null); } - [SecurityCritical] public unsafe static int GetByteCount(Encoding encoding, char* chars, int count) { Contract.Assert(encoding != null); @@ -102,7 +99,6 @@ namespace System.Text return encoding.GetByteCount(chars, count, encoder: null); } - [SecuritySafeCritical] public unsafe static int GetBytes(Encoding encoding, string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { Contract.Assert(encoding != null); @@ -139,7 +135,6 @@ namespace System.Text } } - [SecuritySafeCritical] public unsafe static int GetBytes(Encoding encoding, char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { Contract.Assert(encoding != null); @@ -180,7 +175,6 @@ namespace System.Text } } - [SecurityCritical] public unsafe static int GetBytes(Encoding encoding, char* chars, int charCount, byte* bytes, int byteCount) { Contract.Assert(encoding != null); @@ -197,7 +191,6 @@ namespace System.Text return encoding.GetBytes(chars, charCount, bytes, byteCount, encoder: null); } - [SecuritySafeCritical] public unsafe static int GetCharCount(Encoding encoding, byte[] bytes, int index, int count) { Contract.Assert(encoding != null); @@ -224,7 +217,6 @@ namespace System.Text return encoding.GetCharCount(pBytes + index, count, decoder: null); } - [SecurityCritical] public unsafe static int GetCharCount(Encoding encoding, byte* bytes, int count) { Contract.Assert(encoding != null); @@ -241,7 +233,6 @@ namespace System.Text return encoding.GetCharCount(bytes, count, decoder: null); } - [SecuritySafeCritical] public unsafe static int GetChars(Encoding encoding, byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { Contract.Assert(encoding != null); @@ -280,7 +271,6 @@ namespace System.Text } } - [SecurityCritical] public unsafe static int GetChars(Encoding encoding, byte* bytes, int byteCount, char* chars, int charCount) { Contract.Assert(encoding != null); @@ -297,7 +287,6 @@ namespace System.Text return encoding.GetChars(bytes, byteCount, chars, charCount, decoder: null); } - [SecuritySafeCritical] public unsafe static string GetString(Encoding encoding, byte[] bytes, int index, int count) { Contract.Assert(encoding != null); diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs b/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs index d670d6d..fbddf37 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs @@ -50,7 +50,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, s); } - [System.Security.SecurityCritical] // auto-generated public override unsafe int GetByteCount(char* chars, int count) { return EncodingForwarder.GetByteCount(this, chars, count); @@ -77,7 +76,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { return EncodingForwarder.GetBytes(this, chars, charCount, bytes, byteCount); @@ -91,7 +89,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated public override unsafe int GetCharCount(byte* bytes, int count) { return EncodingForwarder.GetCharCount(this, bytes, count); @@ -103,7 +100,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { return EncodingForwarder.GetChars(this, bytes, byteCount, chars, charCount); diff --git a/src/coreclr/src/mscorlib/src/System/Text/GB18030Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/GB18030Encoding.cs index 324d034..da5ea84 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/GB18030Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/GB18030Encoding.cs @@ -107,10 +107,8 @@ namespace System.Text // This is the table of 4 byte conversions. private const int GBLast4ByteCode = 0x99FB; [NonSerialized] - [SecurityCritical] unsafe internal char* map4BytesToUnicode = null; // new char[GBLast4ByteCode + 1]; // Need to map all 4 byte sequences to Unicode [NonSerialized] - [SecurityCritical] unsafe internal byte* mapUnicodeTo4BytesFlags = null; // new byte[0x10000 / 8]; // Need 1 bit for each code point to say if its 4 byte or not private const int GB18030 = 54936; @@ -120,13 +118,11 @@ namespace System.Text private const int GBLastSurrogateOffset = 0x12E247; // GBE3329A35 // We have to load the 936 code page tables, so impersonate 936 as our base - [System.Security.SecurityCritical] // auto-generated internal GB18030Encoding() : base(GB18030, 936) { } // Constructor called by serialization. - [System.Security.SecurityCritical] // auto-generated internal GB18030Encoding(SerializationInfo info, StreamingContext context) : base(GB18030, 936) { @@ -138,7 +134,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Make sure to get the base stuff too This throws if info is null @@ -150,7 +145,6 @@ namespace System.Text // This loads our base 936 code page and then applys the changes from the tableUnicodeToGBDiffs table. // See table comments for table format. - [System.Security.SecurityCritical] // auto-generated protected override unsafe void LoadManagedCodePage() { // Use base code page loading algorithm. @@ -238,7 +232,6 @@ namespace System.Text // Is4Byte // Checks the 4 byte table and returns true if this is a 4 byte code. // Its a 4 byte code if the flag is set in mapUnicodeTo4BytesFlags - [System.Security.SecurityCritical] // auto-generated internal unsafe bool Is4Byte(char charTest) { // See what kind it is @@ -247,14 +240,12 @@ namespace System.Text } // GetByteCount - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS encoder) { // Just call GetBytes() with null bytes return GetBytes(chars, count, null, 0, encoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -436,14 +427,12 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { // Just call GetChars() with null chars to count return GetChars(bytes, count, null, 0, baseDecoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { @@ -852,7 +841,6 @@ namespace System.Text } // Constructor called by serialization, have to handle deserializing from Everett - [System.Security.SecurityCritical] // auto-generated internal GB18030Decoder(SerializationInfo info, StreamingContext context) { // Any info? @@ -879,7 +867,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? diff --git a/src/coreclr/src/mscorlib/src/System/Text/ISCIIEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/ISCIIEncoding.cs index 83ca500..42a7eb7 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/ISCIIEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/ISCIIEncoding.cs @@ -91,7 +91,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Make sure to get the base stuff too This throws if info is null @@ -155,7 +154,6 @@ namespace System.Text } // Our workhorse version - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS baseEncoder) { // Use null pointer to ask GetBytes for count @@ -163,7 +161,6 @@ namespace System.Text } // Workhorse - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char *chars, int charCount, byte* bytes, int byteCount, EncoderNLS baseEncoder) { @@ -341,7 +338,6 @@ namespace System.Text } // Workhorse - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { // Just call GetChars with null chars saying we want count @@ -354,7 +350,6 @@ namespace System.Text // Devenagari F0, B8 -> \u0952 // Devenagari F0, BF -> \u0970 // Some characters followed by E9 become a different character instead. - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/ISO2022Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/ISO2022Encoding.cs index f7e0616..46b1803 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/ISO2022Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/ISO2022Encoding.cs @@ -53,7 +53,6 @@ namespace System.Text // We have to load the 936 code page tables, so impersonate 936 as our base // This pretends to be other code pages as far as memory sections are concerned. - [System.Security.SecurityCritical] // auto-generated internal ISO2022Encoding(int codePage) : base(codePage, tableBaseCodePages[codePage % 10]) { this.m_bUseMlangTypeForSerialization = true; @@ -61,7 +60,6 @@ namespace System.Text // Constructor called by serialization. // Note: We use the base GetObjectData however - [System.Security.SecurityCritical] // auto-generated internal ISO2022Encoding(SerializationInfo info, StreamingContext context) : base(info, context) { // Actually this can't ever get called, CodePageEncoding is our proxy @@ -102,7 +100,6 @@ namespace System.Text ModeNOOP = -3 } - [System.Security.SecurityCritical] // auto-generated protected unsafe override String GetMemorySectionName() { int iUseCodePage = this.bFlagDataTable ? dataTableCodePage : CodePage; @@ -263,7 +260,6 @@ namespace System.Text } // GetByteCount - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS baseEncoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already @@ -274,7 +270,6 @@ namespace System.Text return GetBytes(chars, count, null, 0, baseEncoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS baseEncoder) { @@ -316,7 +311,6 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { // Just assert, we're called internally so these should be safe, checked already @@ -327,7 +321,6 @@ namespace System.Text return GetChars(bytes, count, null, 0, baseDecoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { @@ -399,7 +392,6 @@ namespace System.Text // undefined, so we maintain that behavior when decoding. We will never generate characters using // that technique, but the decoder will process them. // - [System.Security.SecurityCritical] // auto-generated private unsafe int GetBytesCP5022xJP(char* chars, int charCount, byte* bytes, int byteCount, ISO2022Encoder encoder) { @@ -642,7 +634,6 @@ namespace System.Text // Also Mlang always assumed KR mode, even if the designator wasn't found yet, so we do that as // well. So basically we just ignore $)C when decoding. // - [System.Security.SecurityCritical] // auto-generated private unsafe int GetBytesCP50225KR(char* chars, int charCount, byte* bytes, int byteCount, ISO2022Encoder encoder) { @@ -793,7 +784,6 @@ namespace System.Text // // This encoding is designed for transmission by e-mail and news. No bytes should have high bit set. // (all bytes <= 0x7f) - [System.Security.SecurityCritical] // auto-generated private unsafe int GetBytesCP52936(char* chars, int charCount, byte* bytes, int byteCount, ISO2022Encoder encoder) { @@ -928,7 +918,6 @@ namespace System.Text return buffer.Count; } - [System.Security.SecurityCritical] // auto-generated private unsafe int GetCharsCP5022xJP(byte* bytes, int byteCount, char* chars, int charCount, ISO2022Decoder decoder) { @@ -1256,7 +1245,6 @@ namespace System.Text // Note that in DBCS mode mlang passed through ' ', '\t' and '\n' as SBCS characters // probably to allow mailer formatting without too much extra work. - [System.Security.SecurityCritical] // auto-generated private unsafe int GetCharsCP50225KR(byte* bytes, int byteCount, char* chars, int charCount, ISO2022Decoder decoder) { @@ -1496,7 +1484,6 @@ namespace System.Text // // This encoding is designed for transmission by e-mail and news. No bytes should have high bit set. // (all bytes <= 0x7f) - [System.Security.SecurityCritical] // auto-generated private unsafe int GetCharsCP52936(byte* bytes, int byteCount, char* chars, int charCount, ISO2022Decoder decoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/Latin1Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/Latin1Encoding.cs index a4b863d..5872583 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Latin1Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Latin1Encoding.cs @@ -43,7 +43,6 @@ namespace System.Text } // ISerializable implementation, serialize it as a CodePageEncoding - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Make sure to get the base stuff too This throws if info is null @@ -61,7 +60,6 @@ namespace System.Text // GetByteCount // Note: We start by assuming that the output will be the same as count. Having // an encoder or fallback may change that assumption - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int charCount, EncoderNLS encoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already @@ -177,7 +175,6 @@ namespace System.Text return byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -392,7 +389,6 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS decoder) { // Just assert, we're called internally so these should be safe, checked already @@ -404,7 +400,6 @@ namespace System.Text return count; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS decoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/MLangCodePageEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/MLangCodePageEncoding.cs index e65bcee..f83bd41 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/MLangCodePageEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/MLangCodePageEncoding.cs @@ -76,7 +76,6 @@ namespace System.Text } // Just get it from GetEncoding - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { // Get our encoding (Note: This has default fallbacks for readonly and everett cases) @@ -95,7 +94,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. @@ -122,14 +120,12 @@ namespace System.Text } // Just get it from GetEncoder - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { return this.realEncoding.GetEncoder(); } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. @@ -158,14 +154,12 @@ namespace System.Text } // Just get it from GetDecoder - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { return this.realEncoding.GetDecoder(); } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. diff --git a/src/coreclr/src/mscorlib/src/System/Text/Normalization.Windows.cs b/src/coreclr/src/mscorlib/src/System/Text/Normalization.Windows.cs index 7820bbe..60e0764 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Normalization.Windows.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Normalization.Windows.cs @@ -43,7 +43,6 @@ namespace System.Text private const int ERROR_INSUFFICIENT_BUFFER = 122; private const int ERROR_NO_UNICODE_TRANSLATION = 1113; - [System.Security.SecurityCritical] // auto-generated static private unsafe void InitializeForm(NormalizationForm form, String strDataFile) { byte* pTables = null; @@ -73,7 +72,6 @@ namespace System.Text nativeNormalizationInitNormalization(form, pTables); } - [System.Security.SecurityCritical] // auto-generated static private void EnsureInitialized(NormalizationForm form) { switch ((ExtendedNormalizationForms)form) @@ -150,7 +148,6 @@ namespace System.Text } } - [System.Security.SecurityCritical] internal static bool IsNormalized(String strInput, NormalizationForm normForm) { Contract.Requires(strInput != null); @@ -187,7 +184,6 @@ namespace System.Text return result; } - [System.Security.SecurityCritical] internal static String Normalize(String strInput, NormalizationForm normForm) { Contract.Requires(strInput != null); @@ -270,20 +266,17 @@ namespace System.Text return new String(cBuffer, 0, iLength); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe private static extern int nativeNormalizationNormalizeString( NormalizationForm normForm, ref int iError, String lpSrcString, int cwSrcLength, char[] lpDstString, int cwDstLength); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe private static extern bool nativeNormalizationIsNormalizedString( NormalizationForm normForm, ref int iError, String lpString, int cwLength); - [System.Security.SecurityCritical] // auto-generated [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] unsafe private static extern void nativeNormalizationInitNormalization( diff --git a/src/coreclr/src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs index b21ba78..7211911 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs @@ -20,13 +20,10 @@ namespace System.Text { // Pointers to our memory section parts [NonSerialized] - [SecurityCritical] unsafe char* mapBytesToUnicode = null; // char 256 [NonSerialized] - [SecurityCritical] unsafe byte* mapUnicodeToBytes = null; // byte 65536 [NonSerialized] - [SecurityCritical] unsafe int* mapCodePageCached = null; // to remember which CP is cached const char UNKNOWN_CHAR=(char)0xFFFD; @@ -37,19 +34,16 @@ namespace System.Text [NonSerialized] char charUnknown; - [System.Security.SecurityCritical] // auto-generated public SBCSCodePageEncoding(int codePage) : this(codePage, codePage) { } - [System.Security.SecurityCritical] // auto-generated internal SBCSCodePageEncoding(int codePage, int dataCodePage) : base(codePage, dataCodePage) { } // Constructor called by serialization. // Note: We use the base GetObjectData however - [System.Security.SecurityCritical] // auto-generated internal SBCSCodePageEncoding(SerializationInfo info, StreamingContext context) : base(0) { // Actually this can't ever get called, CodePageEncoding is our proxy @@ -69,7 +63,6 @@ namespace System.Text // byte < 0x20 means skip the next n positions. (Where n is the byte #) // byte == 1 means that next word is another unicode code point # // byte == 0 is unknown. (doesn't override initial WCHAR[256] table! - [System.Security.SecurityCritical] // auto-generated protected override unsafe void LoadManagedCodePage() { // Should be loading OUR code page @@ -151,7 +144,6 @@ namespace System.Text } // Read in our best fit table - [System.Security.SecurityCritical] // auto-generated protected unsafe override void ReadBestFitTable() { // Lock so we don't confuse ourselves. @@ -299,7 +291,6 @@ namespace System.Text // GetByteCount // Note: We start by assuming that the output will be the same as count. Having // an encoder or fallback may change that assumption - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS encoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already @@ -420,7 +411,6 @@ namespace System.Text return (int)byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -652,7 +642,6 @@ namespace System.Text } // This is internal and called by something else, - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS decoder) { // Just assert, we're called internally so these should be safe, checked already @@ -736,7 +725,6 @@ namespace System.Text return charCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS decoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/StringBuilder.cs b/src/coreclr/src/mscorlib/src/System/Text/StringBuilder.cs index e81d90c..5504fd2 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/StringBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/StringBuilder.cs @@ -118,7 +118,6 @@ namespace System.Text { // Creates a new string builder from the specifed substring with the specified // capacity. The maximum number of characters is set by capacity. // - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder(String value, int startIndex, int length, int capacity) { if (capacity<0) { throw new ArgumentOutOfRangeException(nameof(capacity), @@ -178,7 +177,6 @@ namespace System.Text { m_ChunkChars = new char[capacity]; } - [System.Security.SecurityCritical] // auto-generated private StringBuilder(SerializationInfo info, StreamingContext context) { if (info == null) throw new ArgumentNullException(nameof(info)); @@ -241,7 +239,6 @@ namespace System.Text { VerifyClassInvariant(); } - [System.Security.SecurityCritical] // auto-generated void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { @@ -327,7 +324,6 @@ namespace System.Text { return Capacity; } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); @@ -371,7 +367,6 @@ namespace System.Text { // Converts a substring of this string builder to a String. - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(int startIndex, int length) { Contract.Ensures(Contract.Result() != null); @@ -592,7 +587,6 @@ namespace System.Text { } // Appends an array of characters at the end of this string builder. The capacity is adjusted as needed. - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(char[] value, int startIndex, int charCount) { if (startIndex < 0) { throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive")); @@ -629,7 +623,6 @@ namespace System.Text { // Appends a copy of this string at the end of this string builder. - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(String value) { Contract.Ensures(Contract.Result() != null); @@ -668,7 +661,6 @@ namespace System.Text { // We put this fixed in its own helper to avoid the cost zero initing valueChars in the // case we don't actually use it. - [System.Security.SecuritySafeCritical] // auto-generated private void AppendHelper(string value) { unsafe { fixed (char* valueChars = value) @@ -677,16 +669,13 @@ namespace System.Text { } [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecurityCritical] internal unsafe extern void ReplaceBufferInternal(char* newBuffer, int newLength); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecurityCritical] internal unsafe extern void ReplaceBufferAnsiInternal(sbyte* newBuffer, int newLength); // Appends a copy of the characters in value from startIndex to startIndex + // count at the end of this string builder. - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(String value, int startIndex, int count) { if (startIndex < 0) { throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index")); @@ -739,7 +728,6 @@ namespace System.Text { } [System.Runtime.InteropServices.ComVisible(false)] - [SecuritySafeCritical] public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { if (destination == null) { throw new ArgumentNullException(nameof(destination)); @@ -803,7 +791,6 @@ namespace System.Text { // The capacity is adjusted as needed. If value equals String.Empty, this // string builder is not changed. // - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Insert(int index, String value, int count) { if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); @@ -998,7 +985,6 @@ namespace System.Text { } // Appends all of the characters in value to the current instance. - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(char[] value) { Contract.Ensures(Contract.Result() != null); @@ -1103,7 +1089,6 @@ namespace System.Text { // The capacity is adjusted as needed. If value equals String.Empty, the // StringBuilder is not changed. // - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Insert(int index, String value) { if ((uint)index > (uint)Length) { throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index")); @@ -1166,7 +1151,6 @@ namespace System.Text { // the buffer at index. Existing characters are shifted to make room for the new text. // The capacity is adjusted as needed. If value equals String.Empty, the // StringBuilder is not changed. - [SecuritySafeCritical] public StringBuilder Insert(int index, char value) { Contract.Ensures(Contract.Result() != null); @@ -1197,7 +1181,6 @@ namespace System.Text { // value inserted into the buffer at index. Existing characters are shifted // to make room for the new text and capacity is adjusted as required. If value is null, the StringBuilder // is unchanged. Characters are taken from value starting at position startIndex. - [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Insert(int index, char[] value, int startIndex, int charCount) { Contract.Ensures(Contract.Result() != null); @@ -1793,7 +1776,6 @@ namespace System.Text { /// /// Appends 'value' of length 'count' to the stringBuilder. /// - [SecurityCritical] [System.CLSCompliantAttribute(false)] public unsafe StringBuilder Append(char* value, int valueCount) { @@ -1843,7 +1825,6 @@ namespace System.Text { /// /// Inserts 'value' of length 'cou /// - [SecurityCritical] unsafe private void Insert(int index, char* value, int valueCount) { if ((uint)index > (uint)Length) @@ -1866,7 +1847,6 @@ namespace System.Text { /// replacements in bulk (and therefore very efficiently. /// with the string 'value'. /// - [System.Security.SecuritySafeCritical] // auto-generated private void ReplaceAllInChunk(int[] replacements, int replacementsCount, StringBuilder sourceChunk, int removeCount, string value) { if (replacementsCount <= 0) @@ -1953,7 +1933,6 @@ namespace System.Text { /// point at the end of the characters just copyied (thus you can splice in strings from multiple /// places by calling this mulitple times. /// - [SecurityCritical] unsafe private void ReplaceInPlaceAtChunk(ref StringBuilder chunk, ref int indexInChunk, char* value, int count) { if (count != 0) @@ -1986,7 +1965,6 @@ namespace System.Text { /// The only way to do this is to copy all interesting variables out of the heap and then do the /// bounds check. This is what we do here. /// - [SecurityCritical] unsafe private static void ThreadSafeCopy(char* sourcePtr, char[] destination, int destinationIndex, int count) { if (count > 0) @@ -2002,7 +1980,6 @@ namespace System.Text { } } } - [SecurityCritical] private static void ThreadSafeCopy(char[] source, int sourceIndex, char[] destination, int destinationIndex, int count) { if (count > 0) @@ -2022,7 +1999,6 @@ namespace System.Text { } // Copies the source StringBuilder to the destination IntPtr memory allocated with len bytes. - [System.Security.SecurityCritical] // auto-generated internal unsafe void InternalCopy(IntPtr dest, int len) { if(len ==0) return; @@ -2161,7 +2137,6 @@ namespace System.Text { /// If dontMoveFollowingChars is true, then the room must be made by inserting a chunk BEFORE the /// current chunk (this is what it does most of the time anyway) /// - [System.Security.SecuritySafeCritical] // auto-generated private void MakeRoom(int index, int count, out StringBuilder chunk, out int indexInChunk, bool doneMoveFollowingChars) { VerifyClassInvariant(); @@ -2245,7 +2220,6 @@ namespace System.Text { /// Removes 'count' characters from the logical index 'startIndex' and returns the chunk and /// index in the chunk of that logical index in the out parameters. /// - [SecuritySafeCritical] private void Remove(int startIndex, int count, out StringBuilder chunk, out int indexInChunk) { VerifyClassInvariant(); diff --git a/src/coreclr/src/mscorlib/src/System/Text/SurrogateEncoder.cs b/src/coreclr/src/mscorlib/src/System/Text/SurrogateEncoder.cs index 8ee41a30..8d5073c 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/SurrogateEncoder.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/SurrogateEncoder.cs @@ -38,7 +38,6 @@ namespace System.Text } // Just get it from GetEncoding - [System.Security.SecurityCritical] // auto-generated public Object GetRealObject(StreamingContext context) { // Need to get our Encoding's Encoder @@ -46,7 +45,6 @@ namespace System.Text } // ISerializable implementation - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // We cannot ever call this. diff --git a/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs index 6973bb7..cf612b8 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs @@ -109,7 +109,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, s); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public override unsafe int GetByteCount(char* chars, int count) { @@ -137,7 +136,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { @@ -152,7 +150,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public override unsafe int GetCharCount(byte* bytes, int count) { @@ -165,7 +162,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { @@ -182,7 +178,6 @@ namespace System.Text // End of overridden methods which use EncodingForwarder - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char *chars, int count, EncoderNLS encoder) { Contract.Assert(chars!=null, "[UTF32Encoding.GetByteCount]chars!=null"); @@ -308,7 +303,6 @@ namespace System.Text return byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char *chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -503,7 +497,6 @@ namespace System.Text return (int)(bytes - byteStart); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { Contract.Assert(bytes!=null, "[UTF32Encoding.GetCharCount]bytes!=null"); @@ -646,7 +639,6 @@ namespace System.Text return charCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { diff --git a/src/coreclr/src/mscorlib/src/System/Text/UTF7Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/UTF7Encoding.cs index 3270ca6..d9a7484 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UTF7Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/UTF7Encoding.cs @@ -175,7 +175,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, s); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetByteCount(char* chars, int count) @@ -205,7 +204,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) @@ -221,7 +219,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetCharCount(byte* bytes, int count) @@ -235,7 +232,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) @@ -254,7 +250,6 @@ namespace System.Text // End of overridden methods which use EncodingForwarder - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS baseEncoder) { Contract.Assert(chars!=null, "[UTF7Encoding.GetByteCount]chars!=null"); @@ -264,7 +259,6 @@ namespace System.Text return GetBytes(chars, count, null, 0, baseEncoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS baseEncoder) { @@ -405,7 +399,6 @@ namespace System.Text return buffer.Count; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { Contract.Assert(count >=0, "[UTF7Encoding.GetCharCount]count >=0"); @@ -415,7 +408,6 @@ namespace System.Text return GetChars(bytes, count, null, 0, baseDecoder); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { @@ -674,7 +666,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? @@ -737,7 +728,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? @@ -872,7 +862,6 @@ namespace System.Text } // Clear the buffer - [System.Security.SecuritySafeCritical] // overrides public transparent member public override unsafe void Reset() { iCount = -1; @@ -880,7 +869,6 @@ namespace System.Text } // This version just counts the fallback and doesn't actually copy anything. - [System.Security.SecurityCritical] // auto-generated internal unsafe override int InternalFallback(byte[] bytes, byte* pBytes) // Right now this has both bytes and bytes[], since we might have extra bytes, hence the // array, and we might need the index, hence the byte* diff --git a/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs index ddf8017..7d05092 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs @@ -129,7 +129,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, chars); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetByteCount(char* chars, int count) @@ -158,7 +157,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) @@ -174,7 +172,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetCharCount(byte* bytes, int count) @@ -188,7 +185,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) @@ -209,7 +205,6 @@ namespace System.Text // To simplify maintenance, the structure of GetByteCount and GetBytes should be // kept the same as much as possible - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char *chars, int count, EncoderNLS baseEncoder) { // For fallback we may need a fallback buffer. @@ -566,14 +561,12 @@ namespace System.Text // diffs two char pointers using unsigned arithmetic. The unsigned arithmetic // is good enough for us, and it tends to generate better code than the signed // arithmetic generated by default - [System.Security.SecurityCritical] // auto-generated unsafe private static int PtrDiff(char *a, char* b) { return (int)(((uint)((byte*)a - (byte*)b)) >> 1); } // byte* flavor just for parity - [System.Security.SecurityCritical] // auto-generated unsafe private static int PtrDiff(byte* a, byte* b) { return (int)(a - b); @@ -586,7 +579,6 @@ namespace System.Text // Our workhorse // Note: We ignore mismatched surrogates, unless the exception flag is set in which case we throw - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS baseEncoder) { @@ -1029,7 +1021,6 @@ namespace System.Text // // To simplify maintenance, the structure of GetCharCount and GetChars should be // kept the same as much as possible - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { Contract.Assert(count >=0, "[UTF8Encoding.GetCharCount]count >=0"); @@ -1424,7 +1415,6 @@ namespace System.Text // // To simplify maintenance, the structure of GetCharCount and GetChars should be // kept the same as much as possible - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { @@ -1959,7 +1949,6 @@ namespace System.Text // During GetChars we had an invalid byte sequence // pSrc is backed up to the start of the bad sequence if we didn't have room to // fall it back. Otherwise pSrc remains wher it is. - [System.Security.SecurityCritical] // auto-generated private unsafe bool FallbackInvalidByteSequence( ref byte* pSrc, int ch, DecoderFallbackBuffer fallback, ref char* pTarget) { @@ -1982,7 +1971,6 @@ namespace System.Text // During GetCharCount we had an invalid byte sequence // pSrc is used to find the index that points to the invalid bytes, // however the byte[] contains the fallback bytes (in case the index is -1) - [System.Security.SecurityCritical] // auto-generated private unsafe int FallbackInvalidByteSequence( byte* pSrc, int ch, DecoderFallbackBuffer fallback) { @@ -2001,7 +1989,6 @@ namespace System.Text // Note that some of these bytes may have come from a previous fallback, so we cannot // just decrement the pointer and use the values we read. In those cases we have // to regenerate the original values. - [System.Security.SecurityCritical] // auto-generated private unsafe byte[] GetBytesUnknown(ref byte* pSrc, int ch) { // Get our byte[] @@ -2194,7 +2181,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? @@ -2268,7 +2254,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? diff --git a/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs b/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs index 4cb1d24..43caf57 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs @@ -109,7 +109,6 @@ namespace System.Text return EncodingForwarder.GetByteCount(this, s); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetByteCount(char* chars, int count) @@ -138,7 +137,6 @@ namespace System.Text return EncodingForwarder.GetBytes(this, chars, charIndex, charCount, bytes, byteIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) @@ -154,7 +152,6 @@ namespace System.Text return EncodingForwarder.GetCharCount(this, bytes, index, count); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public override unsafe int GetCharCount(byte* bytes, int count) @@ -168,7 +165,6 @@ namespace System.Text return EncodingForwarder.GetChars(this, bytes, byteIndex, byteCount, chars, charIndex); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(false)] public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) @@ -187,7 +183,6 @@ namespace System.Text // End of overridden methods which use EncodingForwarder - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetByteCount(char* chars, int count, EncoderNLS encoder) { Contract.Assert(chars!=null, "[UnicodeEncoding.GetByteCount]chars!=null"); @@ -480,7 +475,6 @@ namespace System.Text return byteCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS encoder) { @@ -901,7 +895,6 @@ namespace System.Text return (int)(bytes - byteStart); } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { Contract.Assert(bytes!=null, "[UnicodeEncoding.GetCharCount]bytes!=null"); @@ -1240,7 +1233,6 @@ namespace System.Text return charCount; } - [System.Security.SecurityCritical] // auto-generated internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder ) { @@ -1803,7 +1795,6 @@ namespace System.Text } // ISerializable implementation, get data for this object - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { // Any info? diff --git a/src/coreclr/src/mscorlib/src/System/Threading/AsyncLocal.cs b/src/coreclr/src/mscorlib/src/System/Threading/AsyncLocal.cs index bbfb203..cd2fc4e 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/AsyncLocal.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/AsyncLocal.cs @@ -40,7 +40,6 @@ namespace System.Threading // public sealed class AsyncLocal : IAsyncLocal { - [SecurityCritical] // critical because this action will terminate the process if it throws. private readonly Action> m_valueChangedHandler; // @@ -54,7 +53,6 @@ namespace System.Threading // Constructs an AsyncLocal with a delegate that is called whenever the current value changes // on any thread. // - [SecurityCritical] public AsyncLocal(Action> valueChangedHandler) { m_valueChangedHandler = valueChangedHandler; @@ -62,20 +60,17 @@ namespace System.Threading public T Value { - [SecuritySafeCritical] get { object obj = ExecutionContext.GetLocalValue(this); return (obj == null) ? default(T) : (T)obj; } - [SecuritySafeCritical] set { ExecutionContext.SetLocalValue(this, value, m_valueChangedHandler != null); } } - [SecurityCritical] void IAsyncLocal.OnValueChanged(object previousValueObj, object currentValueObj, bool contextChanged) { Contract.Assert(m_valueChangedHandler != null); @@ -90,7 +85,6 @@ namespace System.Threading // internal interface IAsyncLocal { - [SecurityCritical] void OnValueChanged(object previousValue, object currentValue, bool contextChanged); } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/CancellationToken.cs b/src/coreclr/src/mscorlib/src/System/Threading/CancellationToken.cs index 7f744f8..4009982 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/CancellationToken.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/CancellationToken.cs @@ -318,7 +318,6 @@ namespace System.Threading } // the real work.. - [SecuritySafeCritical] [MethodImpl(MethodImplOptions.NoInlining)] private CancellationTokenRegistration Register(Action callback, Object state, bool useSynchronizationContext, bool useExecutionContext) { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/CancellationTokenSource.cs b/src/coreclr/src/mscorlib/src/System/Threading/CancellationTokenSource.cs index 961c808c..a0b82db 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/CancellationTokenSource.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/CancellationTokenSource.cs @@ -1029,14 +1029,12 @@ namespace System.Threading } // Cached callback delegate that's lazily initialized due to ContextCallback being SecurityCritical - [SecurityCritical] private static ContextCallback s_executionContextCallback; /// /// InternalExecuteCallbackSynchronously_GeneralPath /// This will be called on the target synchronization context, however, we still need to restore the required execution context /// - [SecuritySafeCritical] internal void ExecuteCallback() { if (TargetExecutionContext != null) @@ -1059,7 +1057,6 @@ namespace System.Threading // the worker method to actually run the callback // The signature is such that it can be used as a 'ContextCallback' - [SecurityCritical] private static void ExecutionContextCallback(object obj) { CancellationCallbackInfo callbackInfo = obj as CancellationCallbackInfo; diff --git a/src/coreclr/src/mscorlib/src/System/Threading/EventWaitHandle.cs b/src/coreclr/src/mscorlib/src/System/Threading/EventWaitHandle.cs index 9937bd9..faaafff 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/EventWaitHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/EventWaitHandle.cs @@ -41,10 +41,8 @@ namespace System.Threading [ComVisibleAttribute(true)] public class EventWaitHandle : WaitHandle { - [System.Security.SecuritySafeCritical] // auto-generated public EventWaitHandle(bool initialState, EventResetMode mode) : this(initialState,mode,null) { } - [System.Security.SecurityCritical] // auto-generated_required public EventWaitHandle(bool initialState, EventResetMode mode, string name) { if(name != null) @@ -87,13 +85,11 @@ namespace System.Threading SetHandleInternal(_handle); } - [System.Security.SecurityCritical] // auto-generated_required public EventWaitHandle(bool initialState, EventResetMode mode, string name, out bool createdNew) : this(initialState, mode, name, out createdNew, null) { } - [System.Security.SecurityCritical] // auto-generated_required public unsafe EventWaitHandle(bool initialState, EventResetMode mode, string name, out bool createdNew, EventWaitHandleSecurity eventSecurity) { if(name != null) @@ -141,19 +137,16 @@ namespace System.Threading SetHandleInternal(_handle); } - [System.Security.SecurityCritical] // auto-generated private EventWaitHandle(SafeWaitHandle handle) { SetHandleInternal(handle); } - [System.Security.SecurityCritical] // auto-generated_required public static EventWaitHandle OpenExisting(string name) { return OpenExisting(name, (EventWaitHandleRights)0); } - [System.Security.SecurityCritical] // auto-generated_required public static EventWaitHandle OpenExisting(string name, EventWaitHandleRights rights) { EventWaitHandle result; @@ -174,19 +167,16 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated_required public static bool TryOpenExisting(string name, out EventWaitHandle result) { return OpenExistingWorker(name, (EventWaitHandleRights)0, out result) == OpenExistingResult.Success; } - [System.Security.SecurityCritical] // auto-generated_required public static bool TryOpenExisting(string name, EventWaitHandleRights rights, out EventWaitHandle result) { return OpenExistingWorker(name, rights, out result) == OpenExistingResult.Success; } - [System.Security.SecurityCritical] // auto-generated_required private static OpenExistingResult OpenExistingWorker(string name, EventWaitHandleRights rights, out EventWaitHandle result) { #if PLATFORM_UNIX @@ -230,7 +220,6 @@ namespace System.Threading return OpenExistingResult.Success; #endif } - [System.Security.SecuritySafeCritical] // auto-generated public bool Reset() { bool res = Win32Native.ResetEvent(safeWaitHandle); @@ -238,7 +227,6 @@ namespace System.Threading __Error.WinIOError(); return res; } - [System.Security.SecuritySafeCritical] // auto-generated public bool Set() { bool res = Win32Native.SetEvent(safeWaitHandle); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/ExecutionContext.cs b/src/coreclr/src/mscorlib/src/System/Threading/ExecutionContext.cs index 7adfca8..b5c92f7 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/ExecutionContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/ExecutionContext.cs @@ -26,11 +26,9 @@ namespace System.Threading using System.Diagnostics.Contracts; using System.Diagnostics.CodeAnalysis; - [System.Security.SecurityCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] public delegate void ContextCallback(Object state); - [SecurityCritical] internal struct ExecutionContextSwitcher { internal ExecutionContext m_ec; @@ -91,7 +89,6 @@ namespace System.Threading { } - [SecuritySafeCritical] public static ExecutionContext Capture() { ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext; @@ -156,7 +153,6 @@ namespace System.Threading return executionContext != null && executionContext.m_isFlowSuppressed; } - [SecurityCritical] [HandleProcessCorruptedStateExceptions] public static void Run(ExecutionContext executionContext, ContextCallback callback, Object state) { @@ -183,7 +179,6 @@ namespace System.Threading ecsw.Undo(currentThread); } - [SecurityCritical] internal static void Restore(Thread currentThread, ExecutionContext executionContext) { Contract.Assert(currentThread == Thread.CurrentThread); @@ -201,7 +196,6 @@ namespace System.Threading } } - [SecurityCritical] static internal void EstablishCopyOnWriteScope(Thread currentThread, ref ExecutionContextSwitcher ecsw) { Contract.Assert(currentThread == Thread.CurrentThread); @@ -210,7 +204,6 @@ namespace System.Threading ecsw.m_sc = currentThread.SynchronizationContext; } - [SecurityCritical] [HandleProcessCorruptedStateExceptions] private static void OnContextChanged(ExecutionContext previous, ExecutionContext current) { @@ -257,7 +250,6 @@ namespace System.Threading } } - [SecurityCritical] internal static object GetLocalValue(IAsyncLocal local) { ExecutionContext current = Thread.CurrentThread.ExecutionContext; @@ -269,7 +261,6 @@ namespace System.Threading return value; } - [SecurityCritical] internal static void SetLocalValue(IAsyncLocal local, object newValue, bool needChangeNotifications) { ExecutionContext current = Thread.CurrentThread.ExecutionContext ?? ExecutionContext.Default; @@ -319,33 +310,28 @@ namespace System.Threading OptimizeDefaultCase = 0x02, } - [SecurityCritical] internal static ExecutionContext Capture(ref StackCrawlMark stackMark, CaptureOptions captureOptions) { return Capture(); } - [SecuritySafeCritical] [FriendAccessAllowed] internal static ExecutionContext FastCapture() { return Capture(); } - [SecurityCritical] [FriendAccessAllowed] internal static void Run(ExecutionContext executionContext, ContextCallback callback, Object state, bool preserveSyncCtx) { Run(executionContext, callback, state); } - [SecurityCritical] internal bool IsDefaultFTContext(bool ignoreSyncCtx) { return this == Default; } - [SecuritySafeCritical] public ExecutionContext CreateCopy() { return this; // since CoreCLR's ExecutionContext is immutable, we don't need to create copies. @@ -358,7 +344,6 @@ namespace System.Threading internal static ExecutionContext PreAllocatedDefault { - [SecuritySafeCritical] get { return ExecutionContext.Default; } } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Interlocked.cs b/src/coreclr/src/mscorlib/src/System/Threading/Interlocked.cs index 50cc766..8a0b527 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Interlocked.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Interlocked.cs @@ -66,34 +66,27 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern int Exchange(ref int location1, int value); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern long Exchange(ref long location1, long value); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern float Exchange(ref float location1, float value); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern double Exchange(ref double location1, double value); [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern Object Exchange(ref Object location1, Object value); [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern IntPtr Exchange(ref IntPtr location1, IntPtr value); [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.InteropServices.ComVisible(false)] - [System.Security.SecuritySafeCritical] public static T Exchange(ref T location1, T value) where T : class { _Exchange(__makeref(location1), __makeref(value)); @@ -106,7 +99,6 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] private static extern void _Exchange(TypedReference location1, TypedReference value); /****************************** @@ -121,29 +113,23 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern int CompareExchange(ref int location1, int value, int comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern long CompareExchange(ref long location1, long value, long comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern float CompareExchange(ref float location1, float value, float comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] public static extern double CompareExchange(ref double location1, double value, double comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern Object CompareExchange(ref Object location1, Object value, Object comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] public static extern IntPtr CompareExchange(ref IntPtr location1, IntPtr value, IntPtr comparand); /***************************************************************** @@ -172,7 +158,6 @@ namespace System.Threading [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [System.Runtime.InteropServices.ComVisible(false)] - [System.Security.SecuritySafeCritical] public static T CompareExchange(ref T location1, T value, T comparand) where T : class { // _CompareExchange() passes back the value read from location1 via local named 'value' @@ -182,13 +167,11 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] private static extern void _CompareExchange(TypedReference location1, TypedReference value, Object comparand); // BCL-internal overload that returns success via a ref bool param, useful for reliable spin locks. [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [System.Security.SecuritySafeCritical] internal static extern int CompareExchange(ref int location1, int value, int comparand, ref bool succeeded); /****************************** diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs b/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs index 92176fa..610be48 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs @@ -38,7 +38,6 @@ namespace System.Threading { ** ** Exceptions: ArgumentNullException if object is null. =========================================================================*/ - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void Enter(Object obj); @@ -62,7 +61,6 @@ namespace System.Threading { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeFalse"), "lockTaken"); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ReliableEnter(Object obj, ref bool lockTaken); @@ -77,7 +75,6 @@ namespace System.Threading { ** SynchronizationLockException if the current thread does not ** own the lock. =========================================================================*/ - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern void Exit(Object obj); @@ -154,11 +151,9 @@ namespace System.Threading { ReliableEnterTimeout(obj, MillisecondsTimeoutFromTimeSpan(timeout), ref lockTaken); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ReliableEnterTimeout(Object obj, int timeout, ref bool lockTaken); - [System.Security.SecuritySafeCritical] public static bool IsEntered(object obj) { if (obj == null) @@ -167,7 +162,6 @@ namespace System.Threading { return IsEnteredNative(obj); } - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool IsEnteredNative(Object obj); @@ -182,11 +176,9 @@ namespace System.Threading { ** ** Exceptions: ArgumentNullException if object is null. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool ObjWait(bool exitContext, int millisecondsTimeout, Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static bool Wait(Object obj, int millisecondsTimeout, bool exitContext) { if (obj == null) @@ -219,11 +211,9 @@ namespace System.Threading { * Exceptions: SynchronizationLockException if this method is not called inside * a synchronized block of code. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ObjPulse(Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static void Pulse(Object obj) { if (obj == null) @@ -237,11 +227,9 @@ namespace System.Threading { /*======================================================================== ** Sends a notification to all waiting objects. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ObjPulseAll(Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static void PulseAll(Object obj) { if (obj == null) diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs b/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs index 7ea08e4..1e893ea 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs @@ -36,14 +36,12 @@ namespace System.Threading { } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned, String name, out bool createdNew) : this(initiallyOwned, name, out createdNew, (MutexSecurity)null) { } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public unsafe Mutex(bool initiallyOwned, String name, out bool createdNew, MutexSecurity mutexSecurity) { @@ -64,7 +62,6 @@ namespace System.Threading CreateMutexWithGuaranteedCleanup(initiallyOwned, name, out createdNew, secAttrs); } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal Mutex(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs) { @@ -84,7 +81,6 @@ namespace System.Threading CreateMutexWithGuaranteedCleanup(initiallyOwned, name, out createdNew, secAttrs); } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal void CreateMutexWithGuaranteedCleanup(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs) { @@ -105,11 +101,9 @@ namespace System.Threading MutexCleanupInfo m_cleanupInfo; internal bool m_newMutex; String m_name; - [System.Security.SecurityCritical] // auto-generated Win32Native.SECURITY_ATTRIBUTES m_secAttrs; Mutex m_mutex; - [System.Security.SecurityCritical] // auto-generated [PrePrepareMethod] internal MutexTryCodeHelper(bool initiallyOwned,MutexCleanupInfo cleanupInfo, String name, Win32Native.SECURITY_ATTRIBUTES secAttrs, Mutex mutex) { @@ -122,7 +116,6 @@ namespace System.Threading m_mutex = mutex; } - [System.Security.SecurityCritical] // auto-generated [PrePrepareMethod] internal void MutexTryCode(object userData) { @@ -177,7 +170,6 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated [PrePrepareMethod] private void MutexCleanupCode(Object userData, bool exceptionThrown) { @@ -205,10 +197,8 @@ namespace System.Threading internal class MutexCleanupInfo { - [System.Security.SecurityCritical] // auto-generated internal SafeWaitHandle mutexHandle; internal bool inCriticalRegion; - [System.Security.SecurityCritical] // auto-generated internal MutexCleanupInfo(SafeWaitHandle mutexHandle, bool inCriticalRegion) { this.mutexHandle = mutexHandle; @@ -216,24 +206,20 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated_required [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned, String name) : this(initiallyOwned, name, out dummyBool) { } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex(bool initiallyOwned) : this(initiallyOwned, null, out dummyBool) { } - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public Mutex() : this(false, null, out dummyBool) { } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private Mutex(SafeWaitHandle handle) { @@ -241,7 +227,6 @@ namespace System.Threading hasThreadAffinity = true; } - [System.Security.SecurityCritical] // auto-generated_required public static Mutex OpenExisting(string name) { return OpenExisting(name, (MutexRights) 0); @@ -251,7 +236,6 @@ namespace System.Threading { } - [System.Security.SecurityCritical] // auto-generated_required public static Mutex OpenExisting(string name, MutexRights rights) { Mutex result; @@ -272,19 +256,16 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated_required public static bool TryOpenExisting(string name, out Mutex result) { return OpenExistingWorker(name, (MutexRights)0, out result) == OpenExistingResult.Success; } - [System.Security.SecurityCritical] // auto-generated_required public static bool TryOpenExisting(string name, MutexRights rights, out Mutex result) { return OpenExistingWorker(name, rights, out result) == OpenExistingResult.Success; } - [System.Security.SecurityCritical] private static OpenExistingResult OpenExistingWorker(string name, MutexRights rights, out Mutex result) { if (name == null) @@ -343,7 +324,6 @@ namespace System.Threading // Note: To call ReleaseMutex, you must have an ACL granting you // MUTEX_MODIFY_STATE rights (0x0001). The other interesting value // in a Mutex's ACL is MUTEX_ALL_ACCESS (0x1F0001). - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public void ReleaseMutex() { @@ -356,7 +336,6 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] static int CreateMutexHandle(bool initiallyOwned, String name, Win32Native.SECURITY_ATTRIBUTES securityAttribute, out SafeWaitHandle mutexHandle) { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs b/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs index 7b27464..c02f14e 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs @@ -60,20 +60,16 @@ namespace System.Threading unsafe internal class _IOCompletionCallback { - [System.Security.SecurityCritical] // auto-generated IOCompletionCallback _ioCompletionCallback; ExecutionContext _executionContext; uint _errorCode; // Error code uint _numBytes; // No. of bytes transferred - [SecurityCritical] NativeOverlapped* _pOVERLAP; - [System.Security.SecuritySafeCritical] // auto-generated static _IOCompletionCallback() { } - [System.Security.SecurityCritical] // auto-generated internal _IOCompletionCallback(IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark) { _ioCompletionCallback = ioCompletionCallback; @@ -83,11 +79,7 @@ namespace System.Threading ExecutionContext.CaptureOptions.IgnoreSyncCtx | ExecutionContext.CaptureOptions.OptimizeDefaultCase); } // Context callback: same sig for SendOrPostCallback and ContextCallback - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #endif static internal ContextCallback _ccb = new ContextCallback(IOCompletionCallback_Context); - [System.Security.SecurityCritical] static internal void IOCompletionCallback_Context(Object state) { _IOCompletionCallback helper = (_IOCompletionCallback)state; @@ -97,7 +89,6 @@ namespace System.Threading // call back helper - [System.Security.SecurityCritical] // auto-generated static unsafe internal void PerformIOCompletionCallback(uint errorCode, // Error code uint numBytes, // No. of bytes transferred NativeOverlapped* pOVERLAP // ptr to OVERLAP structure @@ -146,7 +137,6 @@ namespace System.Threading // ! If you make any change to the layout here, you need to make matching change // ! to OverlappedObject in vm\nativeoverlapped.h internal IAsyncResult m_asyncResult; - [System.Security.SecurityCritical] // auto-generated internal IOCompletionCallback m_iocb; internal _IOCompletionCallback m_iocbHelper; internal Overlapped m_overlapped; @@ -164,12 +154,10 @@ namespace System.Threading #if FEATURE_CORECLR // Adding an empty default ctor for annotation purposes - [System.Security.SecuritySafeCritical] // auto-generated internal OverlappedData(){} #endif // FEATURE_CORECLR - [System.Security.SecurityCritical] internal void ReInitialize() { m_asyncResult = null; @@ -188,7 +176,6 @@ namespace System.Threading m_nativeOverlapped.InternalHigh = (IntPtr)0; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable unsafe internal NativeOverlapped* Pack(IOCompletionCallback iocb, Object userData) { @@ -222,7 +209,6 @@ namespace System.Threading return AllocateNativeOverlapped(); } - [System.Security.SecurityCritical] // auto-generated_required unsafe internal NativeOverlapped* UnsafePack(IOCompletionCallback iocb, Object userData) { if (!m_pinSelf.IsNull()) { @@ -252,19 +238,15 @@ namespace System.Threading set { m_nativeOverlapped.EventHandle = value; } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe private extern NativeOverlapped* AllocateNativeOverlapped(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe internal static extern void FreeNativeOverlapped(NativeOverlapped* nativeOverlappedPtr); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe internal static extern OverlappedData GetOverlappedFromNative(NativeOverlapped* nativeOverlappedPtr); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe internal static extern void CheckVMForIOPacket(out NativeOverlapped* pOVERLAP, out uint errorCode, out uint numBytes); } @@ -281,9 +263,6 @@ namespace System.Threading private OverlappedData m_overlappedData; private static PinnableBufferCache s_overlappedDataCache = new PinnableBufferCache("System.Threading.OverlappedData", ()=> new OverlappedData()); -#if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated -#endif public Overlapped() { m_overlappedData = (OverlappedData) s_overlappedDataCache.Allocate(); @@ -344,7 +323,6 @@ namespace System.Threading internal IOCompletionCallback UserCallback { - [System.Security.SecurityCritical] get { return m_overlappedData.m_iocb; } } @@ -353,7 +331,6 @@ namespace System.Threading * Roots the iocb and stores it in the ReservedCOR field of native Overlapped * Pins the native Overlapped struct and returns the pinned index. ====================================================================*/ - [System.Security.SecurityCritical] // auto-generated [Obsolete("This method is not safe. Use Pack (iocb, userData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] [CLSCompliant(false)] unsafe public NativeOverlapped* Pack(IOCompletionCallback iocb) @@ -361,14 +338,12 @@ namespace System.Threading return Pack (iocb, null); } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false),ComVisible(false)] unsafe public NativeOverlapped* Pack(IOCompletionCallback iocb, Object userData) { return m_overlappedData.Pack(iocb, userData); } - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("This method is not safe. Use UnsafePack (iocb, userData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] [CLSCompliant(false)] unsafe public NativeOverlapped* UnsafePack(IOCompletionCallback iocb) @@ -376,7 +351,6 @@ namespace System.Threading return UnsafePack (iocb, null); } - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false), ComVisible(false)] unsafe public NativeOverlapped* UnsafePack(IOCompletionCallback iocb, Object userData) { @@ -387,7 +361,6 @@ namespace System.Threading * Unpacks an unmanaged native Overlapped struct. * Unpins the native Overlapped struct ====================================================================*/ - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] unsafe public static Overlapped Unpack(NativeOverlapped* nativeOverlappedPtr) { @@ -400,7 +373,6 @@ namespace System.Threading return overlapped; } - [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] unsafe public static void Free(NativeOverlapped* nativeOverlappedPtr) { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/ReaderWriterLock.cs b/src/coreclr/src/mscorlib/src/System/Threading/ReaderWriterLock.cs index dc1b2fb..65127fb 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/ReaderWriterLock.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/ReaderWriterLock.cs @@ -32,7 +32,6 @@ namespace System.Threading { /* * Constructor */ - [System.Security.SecuritySafeCritical] // auto-generated public ReaderWriterLock() { PrivateInitialize(); @@ -41,7 +40,6 @@ namespace System.Threading { /* * Destructor */ - [System.Security.SecuritySafeCritical] // auto-generated ~ReaderWriterLock() { PrivateDestruct(); @@ -52,7 +50,6 @@ namespace System.Threading { * by the current thread */ public bool IsReaderLockHeld { - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] get { return(PrivateGetIsReaderLockHeld()); @@ -64,7 +61,6 @@ namespace System.Threading { * by the current thread */ public bool IsWriterLockHeld { - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] get { return(PrivateGetIsWriterLockHeld()); @@ -77,7 +73,6 @@ namespace System.Threading { * meaningful results */ public int WriterSeqNum { - [System.Security.SecuritySafeCritical] // auto-generated get { return(PrivateGetWriterSeqNum()); } @@ -87,18 +82,15 @@ namespace System.Threading { * Acquires reader lock. The thread will block if a different * thread has writer lock. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void AcquireReaderLockInternal(int millisecondsTimeout); - [System.Security.SecuritySafeCritical] // auto-generated public void AcquireReaderLock(int millisecondsTimeout) { AcquireReaderLockInternal(millisecondsTimeout); } - [System.Security.SecuritySafeCritical] // auto-generated public void AcquireReaderLock(TimeSpan timeout) { long tm = (long)timeout.TotalMilliseconds; @@ -113,17 +105,14 @@ namespace System.Threading { * has reader lock. Use UpgardeToWriterLock when you are not * sure if the thread has reader lock */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void AcquireWriterLockInternal(int millisecondsTimeout); - [System.Security.SecuritySafeCritical] // auto-generated public void AcquireWriterLock(int millisecondsTimeout) { AcquireWriterLockInternal(millisecondsTimeout); } - [System.Security.SecuritySafeCritical] // auto-generated public void AcquireWriterLock(TimeSpan timeout) { long tm = (long)timeout.TotalMilliseconds; @@ -136,12 +125,10 @@ namespace System.Threading { /* * Releases reader lock. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private extern void ReleaseReaderLockInternal(); - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void ReleaseReaderLock() { @@ -151,12 +138,10 @@ namespace System.Threading { /* * Releases writer lock. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private extern void ReleaseWriterLockInternal(); - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public void ReleaseWriterLock() { @@ -168,7 +153,6 @@ namespace System.Threading { * reader, it is possible that the reader lock was * released before writer lock was acquired. */ - [System.Security.SecuritySafeCritical] // auto-generated public LockCookie UpgradeToWriterLock(int millisecondsTimeout) { LockCookie result = new LockCookie (); @@ -176,7 +160,6 @@ namespace System.Threading { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void FCallUpgradeToWriterLock(ref LockCookie result, int millisecondsTimeout); @@ -192,11 +175,9 @@ namespace System.Threading { * Restores the lock status of the thread to the one it was * in when it called UpgradeToWriterLock. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void DowngradeFromWriterLockInternal(ref LockCookie lockCookie); - [System.Security.SecuritySafeCritical] // auto-generated public void DowngradeFromWriterLock(ref LockCookie lockCookie) { DowngradeFromWriterLockInternal(ref lockCookie); @@ -206,7 +187,6 @@ namespace System.Threading { * Releases the lock irrespective of the number of times the thread * acquired the lock */ - [System.Security.SecuritySafeCritical] // auto-generated public LockCookie ReleaseLock() { LockCookie result = new LockCookie (); @@ -214,7 +194,6 @@ namespace System.Threading { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void FCallReleaseLock(ref LockCookie result); @@ -222,11 +201,9 @@ namespace System.Threading { * Restores the lock status of the thread to the one it was * in when it called ReleaseLock. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void RestoreLockInternal(ref LockCookie lockCookie); - [System.Security.SecuritySafeCritical] // auto-generated public void RestoreLock(ref LockCookie lockCookie) { RestoreLockInternal(ref lockCookie); @@ -236,7 +213,6 @@ namespace System.Threading { * Internal helper that returns TRUE if the reader lock is held * by the current thread */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private extern bool PrivateGetIsReaderLockHeld(); @@ -245,7 +221,6 @@ namespace System.Threading { * Internal helper that returns TRUE if the writer lock is held * by the current thread */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private extern bool PrivateGetIsWriterLockHeld(); @@ -255,7 +230,6 @@ namespace System.Threading { * number. The caller should be a reader or writer for getting * meaningful results */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern int PrivateGetWriterSeqNum(); @@ -264,17 +238,14 @@ namespace System.Threading { * sequence number was obtained. The caller should be * a reader or writer for getting meaningful results */ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern bool AnyWritersSince(int seqNum); // Initialize state kept inside the lock - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void PrivateInitialize(); // Destruct resource associated with the lock - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void PrivateDestruct(); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Semaphore.cs b/src/coreclr/src/mscorlib/src/System/Threading/Semaphore.cs index b0ad4f6..ca6008c 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Semaphore.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Semaphore.cs @@ -13,10 +13,8 @@ namespace System.Threading { public sealed partial class Semaphore : WaitHandle { - [SecuritySafeCritical] public Semaphore(int initialCount, int maximumCount) : this(initialCount, maximumCount, null) { } - [SecurityCritical] public Semaphore(int initialCount, int maximumCount, string name) { if (initialCount < 0) @@ -49,7 +47,6 @@ namespace System.Threading this.SafeWaitHandle = myHandle; } - [SecurityCritical] public Semaphore(int initialCount, int maximumCount, string name, out bool createdNew) { if (initialCount < 0) @@ -81,13 +78,11 @@ namespace System.Threading this.SafeWaitHandle = myHandle; } - [SecurityCritical] private Semaphore(SafeWaitHandle handle) { this.SafeWaitHandle = handle; } - [SecurityCritical] private static SafeWaitHandle CreateSemaphone(int initialCount, int maximumCount, string name) { if (name != null) @@ -107,8 +102,6 @@ namespace System.Threading return Win32Native.CreateSemaphore(null, initialCount, maximumCount, name); } - [SecurityCritical] - public static Semaphore OpenExisting(string name) { Semaphore result; @@ -125,13 +118,11 @@ namespace System.Threading } } - [SecurityCritical] public static bool TryOpenExisting(string name, out Semaphore result) { return OpenExistingWorker(name, out result) == OpenExistingResult.Success; } - [SecurityCritical] private static OpenExistingResult OpenExistingWorker(string name, out Semaphore result) { #if PLATFORM_UNIX @@ -177,7 +168,6 @@ namespace System.Threading } // increase the count on a semaphore, returns previous count - [SecuritySafeCritical] public int Release(int releaseCount) { if (releaseCount < 1) diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreSlim.cs b/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreSlim.cs index c47ca02..ef120f8 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreSlim.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreSlim.cs @@ -89,14 +89,12 @@ namespace System.Threading internal TaskNode Prev, Next; internal TaskNode() : base() {} - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { bool setSuccessfully = TrySetResult(true); Contract.Assert(setSuccessfully, "Should have been able to complete task"); } - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { /* nop */ } } #endregion @@ -842,7 +840,6 @@ namespace System.Threading /// Queues a waiter task to the ThreadPool. We use this small helper method so that /// the larger Release(count) method does not need to be SecuritySafeCritical. /// - [SecuritySafeCritical] // for ThreadPool.UnsafeQueueCustomWorkItem private static void QueueWaiterTask(TaskNode waiterTask) { ThreadPool.UnsafeQueueCustomWorkItem(waiterTask, forceGlobal: false); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs b/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs index a9422c1..63e60ba 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs @@ -43,16 +43,13 @@ namespace System.Threading // I'd like this to be an interface, or at least an abstract class - but neither seems to play nice with FriendAccessAllowed. // [FriendAccessAllowed] - [SecurityCritical] internal class WinRTSynchronizationContextFactoryBase { - [SecurityCritical] public virtual SynchronizationContext Create(object coreDispatcher) {return null;} } #endif //FEATURE_COMINTEROP #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags =SecurityPermissionFlag.ControlPolicy|SecurityPermissionFlag.ControlEvidence)] #endif public class SynchronizationContext { @@ -76,7 +73,6 @@ namespace System.Threading static Type s_cachedPreparedType5; // protected so that only the derived sync context class can enable these flags - [System.Security.SecuritySafeCritical] // auto-generated [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "We never dereference s_cachedPreparedType*, so ordering is unimportant")] protected void SetWaitNotificationRequired() { @@ -144,7 +140,6 @@ namespace System.Threading #if FEATURE_SYNCHRONIZATIONCONTEXT_WAIT // Method called when the CLR does a wait operation - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] [PrePrepareMethod] public virtual int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) @@ -153,7 +148,6 @@ namespace System.Threading } // Method that can be called by Wait overrides - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] [PrePrepareMethod] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -170,7 +164,6 @@ namespace System.Threading // Static helper to which the above method can delegate to in order to get the default // COM behavior. - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] [PrePrepareMethod] [MethodImplAttribute(MethodImplOptions.InternalCall)] @@ -180,13 +173,11 @@ namespace System.Threading #if FEATURE_CORECLR - [System.Security.SecurityCritical] public static void SetSynchronizationContext(SynchronizationContext syncContext) { Thread.CurrentThread.SynchronizationContext = syncContext; } - [System.Security.SecurityCritical] public static void SetThreadStaticContext(SynchronizationContext syncContext) { Thread.CurrentThread.SynchronizationContext = syncContext; @@ -220,7 +211,6 @@ namespace System.Threading #else //FEATURE_CORECLR // set SynchronizationContext on the current thread - [System.Security.SecurityCritical] // auto-generated_required public static void SetSynchronizationContext(SynchronizationContext syncContext) { ExecutionContext ec = Thread.CurrentThread.GetMutableExecutionContext(); @@ -262,7 +252,6 @@ namespace System.Threading #endif //FEATURE_CORECLR #if FEATURE_APPX - [SecuritySafeCritical] private static SynchronizationContext GetWinRTContext() { Contract.Assert(Environment.IsWinRTSupported); @@ -285,10 +274,8 @@ namespace System.Threading return null; } - [SecurityCritical] static WinRTSynchronizationContextFactoryBase s_winRTContextFactory; - [SecurityCritical] private static WinRTSynchronizationContextFactoryBase GetWinRTSynchronizationContextFactory() { // @@ -306,7 +293,6 @@ namespace System.Threading } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SecurityCritical] [SuppressUnmanagedCodeSecurity] [return: MarshalAs(UnmanagedType.Interface)] private static extern object GetWinRTDispatcherForCurrentThread(); @@ -321,7 +307,6 @@ namespace System.Threading } #if FEATURE_SYNCHRONIZATIONCONTEXT_WAIT - [System.Security.SecurityCritical] // auto-generated private static int InvokeWaitMethodHelper(SynchronizationContext syncContext, IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { return syncContext.Wait(waitHandles, waitAll, millisecondsTimeout); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs index c29b11a..a356412 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs @@ -131,7 +131,6 @@ namespace System.Threading.Tasks private static Loggers f_LoggingOn; //assumes false by default // The precise static constructor will run first time somebody attempts to access this class - [SecuritySafeCritical] static AsyncCausalityTracer() { if (!Environment.IsWinRTSupported) return; @@ -165,7 +164,6 @@ namespace System.Threading.Tasks } - [SecuritySafeCritical] private static void TracingStatusChangedHandler(Object sender, WFD.TracingStatusChangedEventArgs args) { if (args.Enabled) diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs index 05e6dbf..fb00789 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs @@ -108,7 +108,6 @@ internal sealed class BeginEndAwaitableAdapter : ICriticalNotifyCompletion { /// Schedules the continuation to run when the operation completes. /// The continuation. - [SecurityCritical] public void UnsafeOnCompleted(Action continuation) { Contract.Assert(continuation != null); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs index dcf73fa..4086191 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs @@ -524,7 +524,6 @@ namespace System.Threading.Tasks /// Queues a task to the scheduler. /// The task to be queued. - [SecurityCritical] protected internal override void QueueTask(Task task) { Contract.Assert(task != null, "Infrastructure should have provided a non-null task."); @@ -541,7 +540,6 @@ namespace System.Threading.Tasks /// Executes a task on this scheduler. /// The task to be executed. - [SecuritySafeCritical] internal void ExecuteTask(Task task) { Contract.Assert(task != null, "Infrastructure should have provided a non-null task."); @@ -552,7 +550,6 @@ namespace System.Threading.Tasks /// The task to execute. /// Whether the task was previously queued to the scheduler. /// true if the task could be executed; otherwise, false. - [SecurityCritical] protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { Contract.Assert(task != null, "Infrastructure should have provided a non-null task."); @@ -642,7 +639,6 @@ namespace System.Threading.Tasks /// This method is separated out not because of performance reasons but so that /// the SecuritySafeCritical attribute may be employed. /// - [SecuritySafeCritical] private static bool TryExecuteTaskShim(object state) { var tuple = (Tuple)state; @@ -651,7 +647,6 @@ namespace System.Threading.Tasks /// Gets for debugging purposes the tasks scheduled to this scheduler. /// An enumerable of the tasks queued. - [SecurityCritical] protected override IEnumerable GetScheduledTasks() { return m_tasks; } /// Gets the number of tasks queued to this scheduler. diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs index 5f79f30..325aa91 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs @@ -216,7 +216,6 @@ namespace System.Threading.Tasks /// The kind of fork/join operation. /// The lower bound of the loop. /// The upper bound of the loop. - [SecuritySafeCritical] [Event(PARALLELLOOPBEGIN_ID, Level = EventLevel.Informational, ActivityOptions=EventActivityOptions.Recursive, Task = TplEtwProvider.Tasks.Loop, Opcode = EventOpcode.Start)] public void ParallelLoopBegin( @@ -261,7 +260,6 @@ namespace System.Threading.Tasks /// The task ID. /// The loop ID. /// the total number of iterations processed. - [SecuritySafeCritical] [Event(PARALLELLOOPEND_ID, Level = EventLevel.Informational, Task = TplEtwProvider.Tasks.Loop, Opcode = EventOpcode.Stop)] public void ParallelLoopEnd( int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER @@ -298,7 +296,6 @@ namespace System.Threading.Tasks /// The invoke ID. /// The kind of fork/join operation. /// The number of actions being invoked. - [SecuritySafeCritical] [Event(PARALLELINVOKEBEGIN_ID, Level = EventLevel.Informational, ActivityOptions=EventActivityOptions.Recursive, Task = TplEtwProvider.Tasks.Invoke, Opcode = EventOpcode.Start)] public void ParallelInvokeBegin( @@ -412,7 +409,6 @@ namespace System.Threading.Tasks /// The task ID. /// The task ID /// The options used to create the task. - [SecuritySafeCritical] [Event(TASKSCHEDULED_ID, Task = Tasks.TaskScheduled, Version=1, Opcode = EventOpcode.Send, Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer|Keywords.Tasks)] public void TaskScheduled( @@ -475,7 +471,6 @@ namespace System.Threading.Tasks /// The task ID. /// The task ID. /// Whether the task completed due to an error. - [SecuritySafeCritical] [Event(TASKCOMPLETED_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.TaskStops)] public void TaskCompleted( @@ -513,7 +508,6 @@ namespace System.Threading.Tasks /// If known, if 'TaskID' has a 'continueWith' task, mention give its ID here. /// 0 means unknown. This allows better visualization of the common sequential chaining case. /// - [SecuritySafeCritical] [Event(TASKWAITBEGIN_ID, Version=3, Task = TplEtwProvider.Tasks.TaskWait, Opcode = EventOpcode.Send, Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer|Keywords.Tasks)] public void TaskWaitBegin( @@ -600,7 +594,6 @@ namespace System.Threading.Tasks /// The scheduler ID. /// The task ID. /// The activityId for the continuation. - [SecuritySafeCritical] [Event(AWAITTASKCONTINUATIONSCHEDULED_ID, Task = Tasks.AwaitTaskContinuationScheduled, Opcode = EventOpcode.Send, Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer|Keywords.Tasks)] public void AwaitTaskContinuationScheduled( @@ -629,7 +622,6 @@ namespace System.Threading.Tasks } } - [SecuritySafeCritical] [Event(TRACEOPERATIONSTART_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalityOperation)] public void TraceOperationBegin(int TaskID, string OperationName, long RelatedContext) @@ -655,7 +647,6 @@ namespace System.Threading.Tasks } } - [SecuritySafeCritical] [Event(TRACEOPERATIONRELATION_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalityRelation)] public void TraceOperationRelation(int TaskID, CausalityRelation Relation) @@ -664,7 +655,6 @@ namespace System.Threading.Tasks WriteEvent(TRACEOPERATIONRELATION_ID, TaskID,(int) Relation); // optmized overload for this exists } - [SecuritySafeCritical] [Event(TRACEOPERATIONSTOP_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalityOperation)] public void TraceOperationEnd(int TaskID, AsyncCausalityStatus Status) @@ -673,7 +663,6 @@ namespace System.Threading.Tasks WriteEvent(TRACEOPERATIONSTOP_ID, TaskID,(int) Status); // optmized overload for this exists } - [SecuritySafeCritical] [Event(TRACESYNCHRONOUSWORKSTART_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalitySynchronousWork)] public void TraceSynchronousWorkBegin(int TaskID, CausalitySynchronousWork Work) @@ -682,7 +671,6 @@ namespace System.Threading.Tasks WriteEvent(TRACESYNCHRONOUSWORKSTART_ID, TaskID,(int) Work); // optmized overload for this exists } - [SecuritySafeCritical] [Event(TRACESYNCHRONOUSWORKSTOP_ID, Version=1, Level = EventLevel.Informational, Keywords = Keywords.AsyncCausalitySynchronousWork)] public void TraceSynchronousWorkEnd(CausalitySynchronousWork Work) diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs index c48d3c4..8ba126f 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs @@ -764,7 +764,6 @@ namespace System.Threading.Tasks /// /// A stack crawl mark pointing to the frame of the caller. - [SecuritySafeCritical] internal void PossiblyCaptureContext(ref StackCrawlMark stackMark) { Contract.Assert(m_contingentProperties == null || m_contingentProperties.m_capturedContext == null, @@ -1161,7 +1160,6 @@ namespace System.Threading.Tasks // // Internal version of RunSynchronously that allows not waiting for completion. // - [SecuritySafeCritical] // Needed for QueueTask internal void InternalRunSynchronously(TaskScheduler scheduler, bool waitForCompletion) { Contract.Requires(scheduler != null, "Task.InternalRunSynchronously(): null TaskScheduler"); @@ -1884,7 +1882,6 @@ namespace System.Threading.Tasks /// underneath us. If false, TASK_STATE_STARTED bit is OR-ed right in. This /// allows us to streamline things a bit for StartNew(), where competing cancellations /// are not a problem. - [SecuritySafeCritical] // Needed for QueueTask internal void ScheduleAndStart(bool needsProtection) { Contract.Assert(m_taskScheduler != null, "expected a task scheduler to have been selected"); @@ -2671,7 +2668,6 @@ namespace System.Threading.Tasks /// IThreadPoolWorkItem override, which is the entry function for this task when the TP scheduler decides to run it. /// /// - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { ExecuteEntry(false); @@ -2681,7 +2677,6 @@ namespace System.Threading.Tasks /// The ThreadPool calls this if a ThreadAbortException is thrown while trying to execute this workitem. This may occur /// before Task would otherwise be able to observe it. /// - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { // If the task has marked itself as Completed, then it either a) already observed this exception (so we shouldn't handle it here) @@ -2700,7 +2695,6 @@ namespace System.Threading.Tasks /// /// Performs atomic updates to prevent double execution. Should only be set to true /// in codepaths servicing user provided TaskSchedulers. The ConcRT or ThreadPool schedulers don't need this. - [SecuritySafeCritical] internal bool ExecuteEntry(bool bPreventDoubleExecution) { if (bPreventDoubleExecution || ((Options & (TaskCreationOptions)InternalTaskOptions.SelfReplicating) != 0)) @@ -2742,7 +2736,6 @@ namespace System.Threading.Tasks } // A trick so we can refer to the TLS slot with a byref. - [SecurityCritical] private void ExecuteWithThreadLocal(ref Task currentTaskSlot) { // Remember the current task so we can restore it after running, and then @@ -2819,10 +2812,8 @@ namespace System.Threading.Tasks } // Cached callback delegate that's lazily initialized due to ContextCallback being SecurityCritical - [SecurityCritical] private static ContextCallback s_ecCallback; - [SecurityCritical] private static void ExecutionContextCallback(object obj) { Task task = obj as Task; @@ -2929,7 +2920,6 @@ namespace System.Threading.Tasks /// Whether to flow ExecutionContext across the await. /// A stack crawl mark tied to execution context. /// The awaiter was not properly initialized. - [SecurityCritical] internal void SetContinuationForAwait( Action continuationAction, bool continueOnCapturedContext, bool flowExecutionContext, ref StackCrawlMark stackMark) { @@ -3358,7 +3348,6 @@ namespace System.Threading.Tasks /// For custom schedulers we also attempt an atomic state transition. /// /// true if the task was successfully canceled; otherwise, false. - [SecuritySafeCritical] internal bool InternalCancel(bool bCancelNonExecutingOnly) { Contract.Requires((Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) == 0, "Task.InternalCancel() did not expect promise-style task"); @@ -3558,7 +3547,6 @@ namespace System.Threading.Tasks /// /// Runs all of the continuations, as appropriate. /// - [SecuritySafeCritical] // for AwaitTaskContinuation.RunOrScheduleAction internal void FinishContinuations() { // Atomically store the fact that this task is completing. From this point on, the adding of continuations will @@ -6677,13 +6665,11 @@ namespace System.Threading.Tasks m_completingTask = completingTask; } - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { m_action.Invoke(m_completingTask); } - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { /* NOP */ @@ -7017,7 +7003,6 @@ namespace System.Threading.Tasks /// Each call to TryBeginInliningScope() that returns true must be matched with a /// call to EndInliningScope() regardless of whether inlining actually took place. /// - [SecuritySafeCritical] internal bool TryBeginInliningScope() { // If we're still under the 'safe' limit we'll just skip the stack probe to save p/invoke calls @@ -7043,7 +7028,6 @@ namespace System.Threading.Tasks if (m_inliningDepth < 0) m_inliningDepth = 0; } - [SecurityCritical] private unsafe bool CheckForSufficientStack() { #if FEATURE_CORECLR @@ -7213,7 +7197,6 @@ namespace System.Threading.Tasks } // Calls InvokeCore asynchronously. - [SecuritySafeCritical] private void InvokeCoreAsync(Task completingTask) { // Queue a call to Invoke. If we're so deep on the stack that we're at risk of overflowing, diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs index b078d27..5c3657f 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs @@ -235,7 +235,6 @@ namespace System.Threading.Tasks /// /// true if we need to protect against multiple threads racing to start/cancel the task; otherwise, false. /// - [SecuritySafeCritical] protected static void InlineIfPossibleOrElseQueue(Task task, bool needsProtection) { Contract.Requires(task != null); @@ -384,7 +383,6 @@ namespace System.Threading.Tasks /// SendOrPostCallback delegate to invoke the action. private readonly static SendOrPostCallback s_postCallback = state => ((Action)state)(); // can't use InvokeAction as it's SecurityCritical /// Cached delegate for PostAction - [SecurityCritical] private static ContextCallback s_postActionCallback; /// The context with which to run the action. private readonly SynchronizationContext m_syncContext; @@ -394,7 +392,6 @@ namespace System.Threading.Tasks /// The action to invoke. Must not be null. /// Whether to capture and restore ExecutionContext. /// The captured stack mark. - [SecurityCritical] internal SynchronizationContextAwaitTaskContinuation( SynchronizationContext context, Action action, bool flowExecutionContext, ref StackCrawlMark stackMark) : base(action, flowExecutionContext, ref stackMark) @@ -406,7 +403,6 @@ namespace System.Threading.Tasks /// Inlines or schedules the continuation. /// The antecedent task, which is ignored. /// true if inlining is permitted; otherwise, false. - [SecuritySafeCritical] internal sealed override void Run(Task task, bool canInlineContinuationTask) { // If we're allowed to inline, run the action on this thread. @@ -431,7 +427,6 @@ namespace System.Threading.Tasks /// Calls InvokeOrPostAction(false) on the supplied SynchronizationContextAwaitTaskContinuation. /// The SynchronizationContextAwaitTaskContinuation. - [SecurityCritical] private static void PostAction(object state) { var c = (SynchronizationContextAwaitTaskContinuation)state; @@ -465,7 +460,6 @@ namespace System.Threading.Tasks /// to be passed as state. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - [SecurityCritical] private static ContextCallback GetPostActionCallback() { ContextCallback callback = s_postActionCallback; @@ -485,7 +479,6 @@ namespace System.Threading.Tasks /// The action to invoke. Must not be null. /// Whether to capture and restore ExecutionContext. /// The captured stack mark. - [SecurityCritical] internal TaskSchedulerAwaitTaskContinuation( TaskScheduler scheduler, Action action, bool flowExecutionContext, ref StackCrawlMark stackMark) : base(action, flowExecutionContext, ref stackMark) @@ -550,7 +543,6 @@ namespace System.Threading.Tasks /// The action to invoke. Must not be null. /// Whether to capture and restore ExecutionContext. /// The captured stack mark with which to construct an ExecutionContext. - [SecurityCritical] internal AwaitTaskContinuation(Action action, bool flowExecutionContext, ref StackCrawlMark stackMark) { Contract.Requires(action != null); @@ -566,7 +558,6 @@ namespace System.Threading.Tasks /// Initializes the continuation. /// The action to invoke. Must not be null. /// Whether to capture and restore ExecutionContext. - [SecurityCritical] internal AwaitTaskContinuation(Action action, bool flowExecutionContext) { Contract.Requires(action != null); @@ -598,7 +589,6 @@ namespace System.Threading.Tasks /// Inlines or schedules the continuation onto the default scheduler. /// The antecedent task, which is ignored. /// true if inlining is permitted; otherwise, false. - [SecuritySafeCritical] internal override void Run(Task task, bool canInlineContinuationTask) { // For the base AwaitTaskContinuation, we allow inlining if our caller allows it @@ -657,7 +647,6 @@ namespace System.Threading.Tasks } /// IThreadPoolWorkItem override, which is the entry function for this when the ThreadPool scheduler decides to run it. - [SecurityCritical] void ExecuteWorkItemHelper() { var etwLog = TplEtwProvider.Log; @@ -696,7 +685,6 @@ namespace System.Threading.Tasks } } - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { // inline the fast path @@ -714,20 +702,16 @@ namespace System.Threading.Tasks /// /// The ThreadPool calls this if a ThreadAbortException is thrown while trying to execute this workitem. /// - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { /* nop */ } /// Cached delegate that invokes an Action passed as an object parameter. - [SecurityCritical] private static ContextCallback s_invokeActionCallback; /// Runs an action provided as an object parameter. /// The Action to invoke. - [SecurityCritical] private static void InvokeAction(object state) { ((Action)state)(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - [SecurityCritical] protected static ContextCallback GetInvokeActionCallback() { ContextCallback callback = s_invokeActionCallback; @@ -739,7 +723,6 @@ namespace System.Threading.Tasks /// The callback to run. /// The state to pass to the callback. /// A reference to Task.t_currentTask. - [SecurityCritical] protected void RunCallback(ContextCallback callback, object state, ref Task currentTask) { Contract.Requires(callback != null); @@ -787,7 +770,6 @@ namespace System.Threading.Tasks /// only happens in Task.SetContinuationForAwait if execution context flow was disabled /// via using TaskAwaiter.UnsafeOnCompleted or a similar path. /// - [SecurityCritical] internal static void RunOrScheduleAction(Action action, bool allowInlining, ref Task currentTask) { Contract.Assert(currentTask == Task.t_currentTask); @@ -818,7 +800,6 @@ namespace System.Threading.Tasks /// Schedules the action to be executed. No ExecutionContext work is performed used. /// The action to invoke or queue. - [SecurityCritical] internal static void UnsafeScheduleAction(Action action, Task task) { AwaitTaskContinuation atc = new AwaitTaskContinuation(action, flowExecutionContext: false); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs index 30fa54c..5ed67d4 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs @@ -62,7 +62,6 @@ namespace System.Threading.Tasks EnsureADUnloadCallbackRegistered(); } - [SecuritySafeCritical] private static bool ShouldFailFastOnUnobservedException() { bool shouldFailFast = false; diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs index f824924..f778698 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs @@ -42,9 +42,6 @@ namespace System.Threading.Tasks [DebuggerDisplay("Id={Id}")] [DebuggerTypeProxy(typeof(SystemThreadingTasks_TaskSchedulerDebugView))] [HostProtection(Synchronization = true, ExternalThreading = true)] -#pragma warning disable 618 - [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)] -#pragma warning restore 618 public abstract class TaskScheduler { //////////////////////////////////////////////////////////// @@ -70,7 +67,6 @@ namespace System.Threading.Tasks /// /// The Task to be queued. /// The argument is null. - [SecurityCritical] protected internal abstract void QueueTask(Task task); /// @@ -113,7 +109,6 @@ namespace System.Threading.Tasks /// null. /// The was already /// executed. - [SecurityCritical] protected abstract bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued); /// @@ -157,7 +152,6 @@ namespace System.Threading.Tasks /// /// This scheduler is unable to generate a list of queued tasks at this time. /// - [SecurityCritical] protected abstract IEnumerable GetScheduledTasks(); /// @@ -185,7 +179,6 @@ namespace System.Threading.Tasks /// True if the task may have been previously queued, /// false if the task was absolutely not previously queued. /// True if it ran, false otherwise. - [SecuritySafeCritical] internal bool TryRunInline(Task task, bool taskWasPreviouslyQueued) { // Do not inline unstarted tasks (i.e., task.ExecutingTaskScheduler == null). @@ -237,7 +230,6 @@ namespace System.Threading.Tasks /// The Task to be dequeued. /// A Boolean denoting whether the argument was successfully dequeued. /// The argument is null. - [SecurityCritical] protected internal virtual bool TryDequeue(Task task) { return false; @@ -262,7 +254,6 @@ namespace System.Threading.Tasks /// /// Calls QueueTask() after performing any needed firing of events /// - [SecurityCritical] internal void InternalQueueTask(Task task) { Contract.Requires(task != null); @@ -444,7 +435,6 @@ namespace System.Threading.Tasks /// A Boolean that is true if was successfully executed, false if it /// was not. A common reason for execution failure is that the task had previously been executed or /// is in the process of being executed by another thread. - [SecurityCritical] protected bool TryExecuteTask(Task task) { if (task.ExecutingTaskScheduler != this) @@ -475,7 +465,6 @@ namespace System.Threading.Tasks /// public static event EventHandler UnobservedTaskException { - [System.Security.SecurityCritical] add { if (value != null) @@ -485,7 +474,6 @@ namespace System.Threading.Tasks } } - [System.Security.SecurityCritical] remove { lock (_unobservedTaskExceptionLockObject) _unobservedTaskException -= value; @@ -531,7 +519,6 @@ namespace System.Threading.Tasks /// /// This scheduler is unable to generate a list of queued tasks at this time. /// - [SecurityCritical] internal Task[] GetScheduledTasksForDebugger() { // this can throw InvalidOperationException indicating that they are unable to provide the info @@ -566,7 +553,6 @@ namespace System.Threading.Tasks /// It should not be called by any other codepaths. /// /// An array of TaskScheduler instances. - [SecurityCritical] internal static TaskScheduler[] GetTaskSchedulersForDebugger() { if (s_activeTaskSchedulers == null) @@ -613,7 +599,6 @@ namespace System.Threading.Tasks // returns the schedulerÂ’s GetScheduledTasks public IEnumerable ScheduledTasks { - [SecurityCritical] get { return m_taskScheduler.GetScheduledTasks(); } } } @@ -656,7 +641,6 @@ namespace System.Threading.Tasks /// Simply posts the tasks to be executed on the associated . /// /// - [SecurityCritical] protected internal override void QueueTask(Task task) { m_synchronizationContext.Post(s_postCallback, (object)task); @@ -670,7 +654,6 @@ namespace System.Threading.Tasks /// /// /// - [SecurityCritical] protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { if (SynchronizationContext.Current == m_synchronizationContext) @@ -682,7 +665,6 @@ namespace System.Threading.Tasks } // not implemented - [SecurityCritical] protected override IEnumerable GetScheduledTasks() { return null; diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs index dd4cbc9..892c611 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs @@ -47,7 +47,6 @@ namespace System.Threading.Tasks /// Schedules a task to the ThreadPool. /// /// The task to schedule. - [SecurityCritical] protected internal override void QueueTask(Task task) { if ((task.Options & TaskCreationOptions.LongRunning) != 0) @@ -73,7 +72,6 @@ namespace System.Threading.Tasks /// IMPORTANT NOTE: TryExecuteTaskInline will NOT throw task exceptions itself. Any wait code path using this function needs /// to account for exceptions that need to be propagated, and throw themselves accordingly. /// - [SecurityCritical] protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { // If the task was previously scheduled, and we can't pop it, then return false. @@ -95,14 +93,12 @@ namespace System.Threading.Tasks return rval; } - [SecurityCritical] protected internal override bool TryDequeue(Task task) { // just delegate to TP return ThreadPool.TryPopCustomWorkItem(task); } - [SecurityCritical] protected override IEnumerable GetScheduledTasks() { return FilterTasksFromWorkItems(ThreadPool.GetQueuedWorkItems()); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs b/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs index 5b476cc..0795d53 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs @@ -35,7 +35,6 @@ namespace System.Threading { internal class ThreadHelper { - [System.Security.SecuritySafeCritical] static ThreadHelper() {} Delegate _start; @@ -51,10 +50,8 @@ namespace System.Threading { _executionContext = ec; } - [System.Security.SecurityCritical] static internal ContextCallback _ccb = new ContextCallback(ThreadStart_Context); - [System.Security.SecurityCritical] static private void ThreadStart_Context(Object state) { ThreadHelper t = (ThreadHelper)state; @@ -69,11 +66,6 @@ namespace System.Threading { } // call back helper - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - #else - [System.Security.SecurityCritical] - #endif internal void ThreadStart(object obj) { _startArg = obj; @@ -88,11 +80,6 @@ namespace System.Threading { } // call back helper - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - #else - [System.Security.SecurityCritical] - #endif internal void ThreadStart() { if (_executionContext != null) @@ -207,7 +194,6 @@ namespace System.Threading { #if FEATURE_CORECLR // Adding an empty default ctor for annotation purposes - [System.Security.SecuritySafeCritical] // auto-generated internal Thread(){} #endif // FEATURE_CORECLR @@ -217,7 +203,6 @@ namespace System.Threading { ** ** Exceptions: ArgumentNullException if start == null. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public Thread(ThreadStart start) { if (start == null) { throw new ArgumentNullException(nameof(start)); @@ -226,7 +211,6 @@ namespace System.Threading { SetStartHelper((Delegate)start,0); //0 will setup Thread with default stackSize } - [System.Security.SecuritySafeCritical] // auto-generated public Thread(ThreadStart start, int maxStackSize) { if (start == null) { throw new ArgumentNullException(nameof(start)); @@ -236,7 +220,6 @@ namespace System.Threading { Contract.EndContractBlock(); SetStartHelper((Delegate)start, maxStackSize); } - [System.Security.SecuritySafeCritical] // auto-generated public Thread(ParameterizedThreadStart start) { if (start == null) { throw new ArgumentNullException(nameof(start)); @@ -245,7 +228,6 @@ namespace System.Threading { SetStartHelper((Delegate)start, 0); } - [System.Security.SecuritySafeCritical] // auto-generated public Thread(ParameterizedThreadStart start, int maxStackSize) { if (start == null) { throw new ArgumentNullException(nameof(start)); @@ -266,7 +248,6 @@ namespace System.Threading { { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] - [System.Security.SecuritySafeCritical] // auto-generated get; } @@ -318,7 +299,6 @@ namespace System.Threading { Start(ref stackMark); } - [System.Security.SecuritySafeCritical] private void Start(ref StackCrawlMark stackMark) { #if FEATURE_COMINTEROP_APARTMENT_SUPPORT @@ -379,7 +359,6 @@ namespace System.Threading { // note: please don't access this directly from mscorlib. Use GetMutableExecutionContext or GetExecutionContextReader instead. public ExecutionContext ExecutionContext { - [SecuritySafeCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] get { @@ -393,7 +372,6 @@ namespace System.Threading { } } - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal ExecutionContext GetMutableExecutionContext() { @@ -415,7 +393,6 @@ namespace System.Threading { return m_ExecutionContext; } - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal void SetExecutionContext(ExecutionContext value, bool belongsToCurrentScope) { @@ -423,7 +400,6 @@ namespace System.Threading { ExecutionContextBelongsToCurrentScope = belongsToCurrentScope; } - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal void SetExecutionContext(ExecutionContext.Reader value, bool belongsToCurrentScope) { @@ -432,12 +408,10 @@ namespace System.Threading { } #endif //!FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void StartInternal(IPrincipal principal, ref StackCrawlMark stackMark); #if FEATURE_COMPRESSEDSTACK /// - [System.Security.SecurityCritical] // auto-generated_required [DynamicSecurityMethodAttribute()] [Obsolete("Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")] public void SetCompressedStack( CompressedStack stack ) @@ -445,17 +419,14 @@ namespace System.Threading { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadAPIsNotSupported")); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern IntPtr SetAppDomainStack( SafeCompressedStackHandle csHandle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern void RestoreAppDomainStack( IntPtr appDomainStack); /// - [System.Security.SecurityCritical] // auto-generated_required [Obsolete("Thread.GetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")] public CompressedStack GetCompressedStack() { @@ -467,7 +438,6 @@ namespace System.Threading { // Helper method to get a logical thread ID for StringBuilder (for // correctness) and for FileStream's async code path (for perf, to // avoid creating a Thread instance). - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static IntPtr InternalGetCurrentThread(); @@ -488,8 +458,6 @@ namespace System.Threading { =========================================================================*/ #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread=true)] public void Abort(Object stateInfo) { // If two aborts come at the same time, it is possible that the state info @@ -509,14 +477,6 @@ namespace System.Threading { } #endif - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)] -#pragma warning restore 618 public void Abort() { AbortInternal(); @@ -524,7 +484,6 @@ namespace System.Threading { // Internal helper (since we can't place security demands on // ecalls/fcalls). - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void AbortInternal(); @@ -533,8 +492,6 @@ namespace System.Threading { ** Resets a thread abort. ** Should be called by trusted code only =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread=true)] public static void ResetAbort() { Thread thread = Thread.CurrentThread; @@ -544,7 +501,6 @@ namespace System.Threading { thread.ClearAbortReason(); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void ResetAbortNative(); @@ -555,14 +511,10 @@ namespace System.Threading { ** Exceptions: ThreadStateException if the thread has not been started or ** it is dead. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated - [Obsolete("Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)][SecurityPermission(SecurityAction.Demand, ControlThread=true)] - [SecurityPermission(SecurityAction.Demand, ControlThread=true)] public void Suspend() { SuspendInternal(); } // Internal helper (since we can't place security demands on // ecalls/fcalls). - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void SuspendInternal(); @@ -572,14 +524,11 @@ namespace System.Threading { ** Exceptions: ThreadStateException if the thread has not been started or ** it is dead or it isn't in the suspended state. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)] - [SecurityPermission(SecurityAction.Demand, ControlThread=true)] public void Resume() { ResumeInternal(); } // Internal helper (since we can't place security demands on // ecalls/fcalls). - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void ResumeInternal(); @@ -588,8 +537,6 @@ namespace System.Threading { ** thread is not currently blocked in that manner, it will be interrupted ** when it next begins to block. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermission(SecurityAction.Demand, ControlThread = true)] public new void Interrupt() => base.Interrupt(); /*========================================================================= @@ -600,12 +547,10 @@ namespace System.Threading { public new ThreadPriority Priority { - [System.Security.SecuritySafeCritical] // auto-generated get { return base.Priority; } - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(SelfAffectingThreading = true)] set { @@ -618,7 +563,6 @@ namespace System.Threading { =========================================================================*/ public new bool IsAlive { - [System.Security.SecuritySafeCritical] // auto-generated get { return base.IsAlive; @@ -630,7 +574,6 @@ namespace System.Threading { =========================================================================*/ public new bool IsThreadPoolThread { - [System.Security.SecuritySafeCritical] // auto-generated get { return base.IsThreadPoolThread; @@ -646,11 +589,9 @@ namespace System.Threading { ** ThreadInterruptedException if the thread is interrupted while waiting. ** ThreadStateException if the thread has not been started yet. =========================================================================*/ - [System.Security.SecuritySafeCritical] [HostProtection(Synchronization = true, ExternalThreading = true)] public new void Join() => base.Join(); - [System.Security.SecuritySafeCritical] [HostProtection(Synchronization = true, ExternalThreading = true)] public new bool Join(int millisecondsTimeout) => base.Join(millisecondsTimeout); #endif // !FEATURE_CORECLR @@ -673,11 +614,9 @@ namespace System.Threading { ** Exceptions: ArgumentException if timeout < 0. ** ThreadInterruptedException if the thread is interrupted while sleeping. =========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void SleepInternal(int millisecondsTimeout); - [System.Security.SecuritySafeCritical] // auto-generated public static new void Sleep(int millisecondsTimeout) { SleepInternal(millisecondsTimeout); @@ -699,13 +638,11 @@ namespace System.Threading { only take a few machine instructions. Calling this API is preferable to coding a explict busy loop because the hardware can be informed that it is busy waiting. */ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [HostProtection(Synchronization=true,ExternalThreading=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern void SpinWaitInternal(int iterations); - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true,ExternalThreading=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static new void SpinWait(int iterations) @@ -713,14 +650,12 @@ namespace System.Threading { SpinWaitInternal(iterations); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [HostProtection(Synchronization = true, ExternalThreading = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool YieldInternal(); - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization = true, ExternalThreading = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static new bool Yield() @@ -729,18 +664,15 @@ namespace System.Threading { } public static new Thread CurrentThread { - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] get { Contract.Ensures(Contract.Result() != null); return GetCurrentThreadNative(); } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern Thread GetCurrentThreadNative(); - [System.Security.SecurityCritical] // auto-generated private void SetStartHelper(Delegate start, int maxStackSize) { #if FEATURE_CORECLR @@ -774,7 +706,6 @@ namespace System.Threading { } } - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern ulong GetProcessDefaultStackSize(); @@ -783,14 +714,12 @@ namespace System.Threading { ** PRIVATE Sets the IThreadable interface for the thread. Assumes that ** start != null. =========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void SetStart(Delegate start, int maxStackSize); /*========================================================================= ** Clean up the thread when it goes away. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] ~Thread() { @@ -798,14 +727,12 @@ namespace System.Threading { InternalFinalize(); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void InternalFinalize(); #if !FEATURE_CORECLR #if FEATURE_COMINTEROP - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public new void DisableComObjectEagerCleanup() { @@ -821,12 +748,10 @@ namespace System.Threading { =========================================================================*/ public new bool IsBackground { - [System.Security.SecuritySafeCritical] // auto-generated get { return base.IsBackground; } - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(SelfAffectingThreading = true)] set { @@ -840,7 +765,6 @@ namespace System.Threading { =========================================================================*/ public new ThreadState ThreadState { - [System.Security.SecuritySafeCritical] // auto-generated get { return base.ThreadState; @@ -859,13 +783,11 @@ namespace System.Threading { [Obsolete("The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)] public ApartmentState ApartmentState { - [System.Security.SecuritySafeCritical] // auto-generated get { return (ApartmentState)GetApartmentStateNative(); } - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true, SelfAffectingThreading=true)] set { @@ -874,15 +796,12 @@ namespace System.Threading { } #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated public new ApartmentState GetApartmentState() => base.GetApartmentState(); - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true, SelfAffectingThreading=true)] public new bool TrySetApartmentState(ApartmentState state) => base.TrySetApartmentState(state); #endif // !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true, SelfAffectingThreading=true)] public void SetApartmentState(ApartmentState state) { @@ -891,7 +810,6 @@ namespace System.Threading { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ApartmentStateSwitchFailed")); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void StartupSetApartmentStateInternal(); #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT @@ -1000,7 +918,6 @@ namespace System.Threading { // default domain to lookup resources. See Environment.cs for more details. // #if FEATURE_LEAK_CULTURE_INFO - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern private bool nativeGetSafeCulture(Thread t, int appDomainId, bool isUI, ref CultureInfo safeCulture); #endif // FEATURE_LEAK_CULTURE_INFO @@ -1031,7 +948,6 @@ namespace System.Threading { } } - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(ExternalThreading=true)] set { if (value == null) { @@ -1075,7 +991,6 @@ namespace System.Threading { } #if FEATURE_LEAK_CULTURE_INFO - [System.Security.SecuritySafeCritical] // auto-generated #endif internal CultureInfo GetCurrentUICultureNoAppX() { @@ -1108,7 +1023,6 @@ namespace System.Threading { // This returns the exposed context for a given context ID. #if FEATURE_LEAK_CULTURE_INFO - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern private bool nativeSetThreadUILocale(String locale); #endif @@ -1140,9 +1054,7 @@ namespace System.Threading { } } - [System.Security.SecuritySafeCritical] // auto-generated #if FEATURE_LEAK_CULTURE_INFO - [SecurityPermission(SecurityAction.Demand, ControlThread = true)] #endif set { if (null==value) { @@ -1181,7 +1093,6 @@ namespace System.Threading { } #if FEATURE_LEAK_CULTURE_INFO - [System.Security.SecuritySafeCritical] // auto-generated #endif private CultureInfo GetCurrentCultureNoAppX() { @@ -1212,7 +1123,6 @@ namespace System.Threading { } #if !FEATURE_LEAK_CULTURE_INFO - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void nativeInitCultureAccessors(); @@ -1222,14 +1132,11 @@ namespace System.Threading { ** Returns the current domain in which current thread is running. ======================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern AppDomain GetDomainInternal(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern AppDomain GetFastDomainInternal(); - [System.Security.SecuritySafeCritical] // auto-generated public static AppDomain GetDomain() { Contract.Ensures(Contract.Result() != null); @@ -1259,7 +1166,6 @@ namespace System.Threading { get { return m_Name; } - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(ExternalThreading=true)] set { lock(this) { @@ -1272,13 +1178,11 @@ namespace System.Threading { } } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void InformThreadNameChange(ThreadHandle t, String name, int len); internal Object AbortReason { - [System.Security.SecurityCritical] // auto-generated get { object result = null; try @@ -1291,7 +1195,6 @@ namespace System.Threading { } return result; } - [System.Security.SecurityCritical] // auto-generated set { SetAbortReason(value); } } @@ -1299,7 +1202,6 @@ namespace System.Threading { /* * This marks the beginning of a critical code region. */ - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true, ExternalThreading=true)] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] @@ -1308,7 +1210,6 @@ namespace System.Threading { /* * This marks the end of a critical code region. */ - [System.Security.SecuritySafeCritical] // auto-generated [HostProtection(Synchronization=true, ExternalThreading=true)] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -1317,7 +1218,6 @@ namespace System.Threading { /* * This marks the beginning of a code region that requires thread affinity. */ - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static extern void BeginThreadAffinity(); @@ -1325,7 +1225,6 @@ namespace System.Threading { /* * This marks the end of a code region that requires thread affinity. */ - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static extern void EndThreadAffinity(); @@ -1542,7 +1441,6 @@ namespace System.Threading { address = value; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void MemoryBarrier(); @@ -1584,20 +1482,17 @@ namespace System.Threading { // Helper function to set the AbortReason for a thread abort. // Checks that they're not alredy set, and then atomically updates // the reason info (object + ADID). - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetAbortReason(Object o); // Helper function to retrieve the AbortReason from a thread // abort. Will perform cross-AppDomain marshalling if the object // lives in a different AppDomain from the requester. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern Object GetAbortReason(); // Helper function to clear the AbortReason. Takes care of // AppDomain related cleanup if required. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void ClearAbortReason(); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/ThreadAbortException.cs b/src/coreclr/src/mscorlib/src/System/Threading/ThreadAbortException.cs index 11c8744..09ad4e1 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/ThreadAbortException.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/ThreadAbortException.cs @@ -39,7 +39,6 @@ namespace System.Threading public Object ExceptionState { - [System.Security.SecuritySafeCritical] // auto-generated get {return Thread.CurrentThread.AbortReason;} } } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs b/src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs index ba8c61a..7ab8fb3 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs @@ -53,10 +53,8 @@ namespace System.Threading public static volatile bool vmTpInitialized; public static bool enableWorkerTracking; - [SecurityCritical] public static readonly ThreadPoolWorkQueue workQueue = new ThreadPoolWorkQueue(); - [System.Security.SecuritySafeCritical] // static constructors should be safe to call static ThreadPoolGlobals() { } @@ -554,7 +552,6 @@ namespace System.Threading loggingEnabled = FrameworkEventSource.Log.IsEnabled(EventLevel.Verbose, FrameworkEventSource.Keywords.ThreadPool|FrameworkEventSource.Keywords.ThreadTransfer); } - [SecurityCritical] public ThreadPoolWorkQueueThreadLocals EnsureCurrentThreadHasQueue() { if (null == ThreadPoolWorkQueueThreadLocals.threadLocals) @@ -562,7 +559,6 @@ namespace System.Threading return ThreadPoolWorkQueueThreadLocals.threadLocals; } - [SecurityCritical] internal void EnsureThreadRequested() { // @@ -583,7 +579,6 @@ namespace System.Threading } } - [SecurityCritical] internal void MarkThreadRequestSatisfied() { // @@ -604,7 +599,6 @@ namespace System.Threading } } - [SecurityCritical] public void Enqueue(IThreadPoolWorkItem callback, bool forceGlobal) { ThreadPoolWorkQueueThreadLocals tl = null; @@ -637,7 +631,6 @@ namespace System.Threading EnsureThreadRequested(); } - [SecurityCritical] internal bool LocalFindAndPop(IThreadPoolWorkItem callback) { ThreadPoolWorkQueueThreadLocals tl = ThreadPoolWorkQueueThreadLocals.threadLocals; @@ -647,7 +640,6 @@ namespace System.Threading return tl.workStealingQueue.LocalFindAndPop(callback); } - [SecurityCritical] public void Dequeue(ThreadPoolWorkQueueThreadLocals tl, out IThreadPoolWorkItem callback, out bool missedSteal) { callback = null; @@ -702,7 +694,6 @@ namespace System.Threading } } - [SecurityCritical] static internal bool Dispatch() { var workQueue = ThreadPoolGlobals.workQueue; @@ -862,7 +853,6 @@ namespace System.Threading internal sealed class ThreadPoolWorkQueueThreadLocals { [ThreadStatic] - [SecurityCritical] public static ThreadPoolWorkQueueThreadLocals threadLocals; public readonly ThreadPoolWorkQueue workQueue; @@ -876,7 +866,6 @@ namespace System.Threading ThreadPoolWorkQueue.allThreadQueues.Add(workStealingQueue); } - [SecurityCritical] private void CleanUp() { if (null != workStealingQueue) @@ -908,7 +897,6 @@ namespace System.Threading } } - [SecuritySafeCritical] ~ThreadPoolWorkQueueThreadLocals() { // Since the purpose of calling CleanUp is to transfer any pending workitems into the global @@ -925,7 +913,6 @@ namespace System.Threading { private static IntPtr InvalidHandle { - [System.Security.SecuritySafeCritical] // auto-generated get { return Win32Native.INVALID_HANDLE_VALUE; @@ -936,9 +923,6 @@ namespace System.Threading private bool bReleaseNeeded = false; private volatile int m_lock = 0; - #if FEATURE_CORECLR - [System.Security.SecuritySafeCritical] // auto-generated - #endif internal RegisteredWaitHandleSafe() { registeredWaitHandle = InvalidHandle; @@ -954,7 +938,6 @@ namespace System.Threading registeredWaitHandle = handle; } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal void SetWaitObject(WaitHandle waitObject) { @@ -973,7 +956,6 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] internal bool Unregister( WaitHandle waitObject // object to be notified when all callbacks to delegates have completed @@ -1031,7 +1013,6 @@ namespace System.Threading return (registeredWaitHandle != InvalidHandle && registeredWaitHandle != IntPtr.Zero); } - [System.Security.SecuritySafeCritical] // auto-generated ~RegisteredWaitHandleSafe() { // if the app has already unregistered the wait, there is nothing to cleanup @@ -1082,11 +1063,9 @@ namespace System.Threading } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void WaitHandleCleanupNative(IntPtr handle); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool UnregisterWaitNative(IntPtr handle, SafeHandle waitObject); } @@ -1105,14 +1084,12 @@ namespace System.Threading internalRegisteredWait.SetHandle(handle); } - [System.Security.SecurityCritical] // auto-generated internal void SetWaitObject(WaitHandle waitObject) { internalRegisteredWait.SetWaitObject(waitObject); } -[System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.InteropServices.ComVisible(true)] // This is the only public method on this class public bool Unregister( @@ -1137,7 +1114,6 @@ namespace System.Threading // internal static class _ThreadPoolWaitCallback { - [System.Security.SecurityCritical] static internal bool PerformWaitCallback() { return ThreadPoolWorkQueue.Dispatch(); @@ -1155,15 +1131,12 @@ namespace System.Threading // internal interface IThreadPoolWorkItem { - [SecurityCritical] void ExecuteWorkItem(); - [SecurityCritical] void MarkAborted(ThreadAbortException tae); } internal sealed class QueueUserWorkItemCallback : IThreadPoolWorkItem { - [System.Security.SecuritySafeCritical] static QueueUserWorkItemCallback() {} private WaitCallback callback; @@ -1189,7 +1162,6 @@ namespace System.Threading } #endif - [SecurityCritical] internal QueueUserWorkItemCallback(WaitCallback waitCallback, Object stateObj, ExecutionContext ec) { callback = waitCallback; @@ -1197,7 +1169,6 @@ namespace System.Threading context = ec; } - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { #if DEBUG @@ -1216,7 +1187,6 @@ namespace System.Threading } } - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { #if DEBUG @@ -1226,10 +1196,8 @@ namespace System.Threading #endif } - [System.Security.SecurityCritical] static internal ContextCallback ccb = new ContextCallback(WaitCallback_Context); - [System.Security.SecurityCritical] static private void WaitCallback_Context(Object state) { QueueUserWorkItemCallback obj = (QueueUserWorkItemCallback)state; @@ -1241,7 +1209,6 @@ namespace System.Threading internal sealed class QueueUserWorkItemCallbackDefaultContext : IThreadPoolWorkItem { - [System.Security.SecuritySafeCritical] static QueueUserWorkItemCallbackDefaultContext() { } private WaitCallback callback; @@ -1266,14 +1233,12 @@ namespace System.Threading } #endif - [SecurityCritical] internal QueueUserWorkItemCallbackDefaultContext(WaitCallback waitCallback, Object stateObj) { callback = waitCallback; state = stateObj; } - [SecurityCritical] void IThreadPoolWorkItem.ExecuteWorkItem() { #if DEBUG @@ -1282,7 +1247,6 @@ namespace System.Threading ExecutionContext.Run(ExecutionContext.PreAllocatedDefault, ccb, this, true); } - [SecurityCritical] void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae) { #if DEBUG @@ -1292,10 +1256,8 @@ namespace System.Threading #endif } - [System.Security.SecurityCritical] static internal ContextCallback ccb = new ContextCallback(WaitCallback_Context); - [System.Security.SecurityCritical] static private void WaitCallback_Context(Object state) { QueueUserWorkItemCallbackDefaultContext obj = (QueueUserWorkItemCallbackDefaultContext)state; @@ -1308,18 +1270,14 @@ namespace System.Threading internal class _ThreadPoolWaitOrTimerCallback { - [System.Security.SecuritySafeCritical] static _ThreadPoolWaitOrTimerCallback() {} WaitOrTimerCallback _waitOrTimerCallback; ExecutionContext _executionContext; Object _state; - [System.Security.SecurityCritical] static private ContextCallback _ccbt = new ContextCallback(WaitOrTimerCallback_Context_t); - [System.Security.SecurityCritical] static private ContextCallback _ccbf = new ContextCallback(WaitOrTimerCallback_Context_f); - [System.Security.SecurityCritical] // auto-generated internal _ThreadPoolWaitOrTimerCallback(WaitOrTimerCallback waitOrTimerCallback, Object state, bool compressStack, ref StackCrawlMark stackMark) { _waitOrTimerCallback = waitOrTimerCallback; @@ -1334,13 +1292,11 @@ namespace System.Threading } } - [System.Security.SecurityCritical] static private void WaitOrTimerCallback_Context_t(Object state) { WaitOrTimerCallback_Context(state, true); } - [System.Security.SecurityCritical] static private void WaitOrTimerCallback_Context_f(Object state) { WaitOrTimerCallback_Context(state, false); @@ -1353,7 +1309,6 @@ namespace System.Threading } // call back helper - [System.Security.SecurityCritical] // auto-generated static internal void PerformWaitOrTimerCallback(Object state, bool timedOut) { _ThreadPoolWaitOrTimerCallback helper = (_ThreadPoolWaitOrTimerCallback)state; @@ -1378,7 +1333,6 @@ namespace System.Threading } - [System.Security.SecurityCritical] [CLSCompliant(false)] [System.Runtime.InteropServices.ComVisible(true)] unsafe public delegate void IOCompletionCallback(uint errorCode, // Error code @@ -1390,51 +1344,31 @@ namespace System.Threading public static class ThreadPool { - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)] -#pragma warning restore 618 public static bool SetMaxThreads(int workerThreads, int completionPortThreads) { return SetMaxThreadsNative(workerThreads, completionPortThreads); } - [System.Security.SecuritySafeCritical] // auto-generated public static void GetMaxThreads(out int workerThreads, out int completionPortThreads) { GetMaxThreadsNative(out workerThreads, out completionPortThreads); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)] -#pragma warning restore 618 public static bool SetMinThreads(int workerThreads, int completionPortThreads) { return SetMinThreadsNative(workerThreads, completionPortThreads); } - [System.Security.SecuritySafeCritical] // auto-generated public static void GetMinThreads(out int workerThreads, out int completionPortThreads) { GetMinThreadsNative(out workerThreads, out completionPortThreads); } - [System.Security.SecuritySafeCritical] // auto-generated public static void GetAvailableThreads(out int workerThreads, out int completionPortThreads) { GetAvailableThreadsNative(out workerThreads, out completionPortThreads); } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException @@ -1449,7 +1383,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,millisecondsTimeOutInterval,executeOnlyOnce,ref stackMark,true); } - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException @@ -1465,7 +1398,6 @@ namespace System.Threading } - [System.Security.SecurityCritical] // auto-generated private static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, @@ -1502,7 +1434,6 @@ namespace System.Threading } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, @@ -1519,7 +1450,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)millisecondsTimeOutInterval,executeOnlyOnce,ref stackMark,true); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, @@ -1536,7 +1466,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)millisecondsTimeOutInterval,executeOnlyOnce,ref stackMark,false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, @@ -1553,7 +1482,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)millisecondsTimeOutInterval,executeOnlyOnce,ref stackMark,true); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, @@ -1570,7 +1498,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)millisecondsTimeOutInterval,executeOnlyOnce,ref stackMark,false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle RegisterWaitForSingleObject( WaitHandle waitObject, @@ -1589,7 +1516,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)tm,executeOnlyOnce,ref stackMark,true); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( WaitHandle waitObject, @@ -1608,7 +1534,6 @@ namespace System.Threading return RegisterWaitForSingleObject(waitObject,callBack,state,(UInt32)tm,executeOnlyOnce,ref stackMark,false); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static bool QueueUserWorkItem( WaitCallback callBack, // NOTE: we do not expose options that allow the callback to be queued as an APC @@ -1619,7 +1544,6 @@ namespace System.Threading return QueueUserWorkItemHelper(callBack,state,ref stackMark,true); } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static bool QueueUserWorkItem( WaitCallback callBack // NOTE: we do not expose options that allow the callback to be queued as an APC @@ -1629,7 +1553,6 @@ namespace System.Threading return QueueUserWorkItemHelper(callBack,null,ref stackMark,true); } - [System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static bool UnsafeQueueUserWorkItem( WaitCallback callBack, // NOTE: we do not expose options that allow the callback to be queued as an APC @@ -1643,7 +1566,6 @@ namespace System.Threading //ThreadPool has per-appdomain managed queue of work-items. The VM is //responsible for just scheduling threads into appdomains. After that //work-items are dispatched from the managed queue. - [System.Security.SecurityCritical] // auto-generated private static bool QueueUserWorkItemHelper(WaitCallback callBack, Object state, ref StackCrawlMark stackMark, bool compressStack ) { bool success = true; @@ -1683,7 +1605,6 @@ namespace System.Threading return success; } - [SecurityCritical] internal static void UnsafeQueueCustomWorkItem(IThreadPoolWorkItem workItem, bool forceGlobal) { Contract.Assert(null != workItem); @@ -1700,7 +1621,6 @@ namespace System.Threading } // This method tries to take the target callback out of the current thread's queue. - [SecurityCritical] internal static bool TryPopCustomWorkItem(IThreadPoolWorkItem workItem) { Contract.Assert(null != workItem); @@ -1710,7 +1630,6 @@ namespace System.Threading } // Get all workitems. Called by TaskScheduler in its debugger hooks. - [SecurityCritical] internal static IEnumerable GetQueuedWorkItems() { return EnumerateQueuedWorkItems(ThreadPoolWorkQueue.allThreadQueues.Current, ThreadPoolGlobals.workQueue.queueTail); @@ -1754,13 +1673,11 @@ namespace System.Threading } } - [SecurityCritical] internal static IEnumerable GetLocallyQueuedWorkItems() { return EnumerateQueuedWorkItems(new ThreadPoolWorkQueue.WorkStealingQueue[] { ThreadPoolWorkQueueThreadLocals.threadLocals.workStealingQueue }, null); } - [SecurityCritical] internal static IEnumerable GetGloballyQueuedWorkItems() { return EnumerateQueuedWorkItems(null, ThreadPoolGlobals.workQueue.queueTail); @@ -1788,41 +1705,34 @@ namespace System.Threading // This is the method the debugger will actually call, if it ends up calling // into ThreadPool directly. Tests can use this to simulate a debugger, as well. - [SecurityCritical] internal static object[] GetQueuedWorkItemsForDebugger() { return ToObjectArray(GetQueuedWorkItems()); } - [SecurityCritical] internal static object[] GetGloballyQueuedWorkItemsForDebugger() { return ToObjectArray(GetGloballyQueuedWorkItems()); } - [SecurityCritical] internal static object[] GetLocallyQueuedWorkItemsForDebugger() { return ToObjectArray(GetLocallyQueuedWorkItems()); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal static extern bool RequestWorkerThread(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe private static extern bool PostQueuedCompletionStatus(NativeOverlapped* overlapped); - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] unsafe public static bool UnsafeQueueNativeOverlapped(NativeOverlapped* overlapped) { return PostQueuedCompletionStatus(overlapped); } - [SecurityCritical] private static void EnsureVMInitialized() { if (!ThreadPoolGlobals.vmTpInitialized) @@ -1834,35 +1744,27 @@ namespace System.Threading // Native methods: - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool SetMinThreadsNative(int workerThreads, int completionPortThreads); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool SetMaxThreadsNative(int workerThreads, int completionPortThreads); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetMinThreadsNative(out int workerThreads, out int completionPortThreads); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetMaxThreadsNative(out int workerThreads, out int completionPortThreads); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetAvailableThreadsNative(out int workerThreads, out int completionPortThreads); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool NotifyWorkItemComplete(); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ReportThreadStatus(bool isWorking); - [System.Security.SecuritySafeCritical] internal static void NotifyWorkItemProgress() { if (!ThreadPoolGlobals.vmTpInitialized) @@ -1870,20 +1772,16 @@ namespace System.Threading NotifyWorkItemProgressNative(); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void NotifyWorkItemProgressNative(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool IsThreadPoolHosted(); - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void InitializeVMTp(ref bool enableWorkerTracking); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern IntPtr RegisterWaitForSingleObjectNative( WaitHandle waitHandle, @@ -1896,11 +1794,7 @@ namespace System.Threading ); - [System.Security.SecuritySafeCritical] // auto-generated [Obsolete("ThreadPool.BindHandle(IntPtr) has been deprecated. Please use ThreadPool.BindHandle(SafeHandle) instead.", false)] -#pragma warning disable 618 - [SecurityPermissionAttribute( SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public static bool BindHandle( IntPtr osHandle ) @@ -1908,14 +1802,6 @@ namespace System.Threading return BindIOCompletionCallbackNative(osHandle); } - #if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated - #else - [System.Security.SecuritySafeCritical] - #endif -#pragma warning disable 618 - [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] -#pragma warning restore 618 public static bool BindHandle(SafeHandle osHandle) { if (osHandle == null) @@ -1935,7 +1821,6 @@ namespace System.Threading return ret; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern bool BindIOCompletionCallbackNative(IntPtr fileHandle); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Timer.cs b/src/coreclr/src/mscorlib/src/System/Threading/Timer.cs index c8a1a3b..c692892 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Timer.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Timer.cs @@ -76,7 +76,6 @@ namespace System.Threading // private static int TickCount { - [SecuritySafeCritical] get { #if !FEATURE_PAL @@ -102,7 +101,6 @@ namespace System.Threading // // We use a SafeHandle to ensure that the native timer is destroyed when the AppDomain is unloaded. // - [SecurityCritical] class AppDomainTimerSafeHandle : SafeHandleZeroOrMinusOneIsInvalid { public AppDomainTimerSafeHandle() @@ -110,7 +108,6 @@ namespace System.Threading { } - [SecurityCritical] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] protected override bool ReleaseHandle() { @@ -118,14 +115,12 @@ namespace System.Threading } } - [SecurityCritical] AppDomainTimerSafeHandle m_appDomainTimer; bool m_isAppDomainTimerScheduled; int m_currentAppDomainTimerStartTicks; uint m_currentAppDomainTimerDuration; - [SecuritySafeCritical] private bool EnsureAppDomainTimerFiresBy(uint requestedDuration) { // @@ -195,23 +190,19 @@ namespace System.Threading // // The VM calls this when the native timer fires. // - [SecuritySafeCritical] internal static void AppDomainTimerCallback() { Instance.FireNextTimers(); } - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static extern AppDomainTimerSafeHandle CreateAppDomainTimer(uint dueTime); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] static extern bool ChangeAppDomainTimer(AppDomainTimerSafeHandle handle, uint dueTime); - [System.Security.SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -229,7 +220,6 @@ namespace System.Threading volatile int m_pauseTicks = 0; // Time when Pause was called - [SecurityCritical] internal void Pause() { lock(this) @@ -245,7 +235,6 @@ namespace System.Threading } } - [SecurityCritical] internal void Resume() { // @@ -413,7 +402,6 @@ namespace System.Threading timerToFireOnThisThread.Fire(); } - [SecuritySafeCritical] private static void QueueTimerCompletion(TimerQueueTimer timer) { WaitCallback callback = s_fireQueuedTimerCompletion; @@ -523,7 +511,6 @@ namespace System.Threading volatile WaitHandle m_notifyWhenNoCallbacksRunning; - [SecurityCritical] internal TimerQueueTimer(TimerCallback timerCallback, object state, uint dueTime, uint period, ref StackCrawlMark stackMark) { m_timerCallback = timerCallback; @@ -673,13 +660,11 @@ namespace System.Threading SignalNoCallbacksRunning(); } - [SecuritySafeCritical] internal void SignalNoCallbacksRunning() { Win32Native.SetEvent(m_notifyWhenNoCallbacksRunning.SafeWaitHandle); } - [SecuritySafeCritical] internal void CallCallback() { if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.ThreadTransfer)) @@ -708,10 +693,8 @@ namespace System.Threading } } - [SecurityCritical] private static ContextCallback s_callCallbackInContext; - [SecurityCritical] private static void CallCallbackInContext(object state) { TimerQueueTimer t = (TimerQueueTimer)state; @@ -780,7 +763,6 @@ namespace System.Threading private TimerHolder m_timer; - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Timer(TimerCallback callback, Object state, @@ -797,7 +779,6 @@ namespace System.Threading TimerSetup(callback,state,(UInt32)dueTime,(UInt32)period,ref stackMark); } - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Timer(TimerCallback callback, Object state, @@ -821,7 +802,6 @@ namespace System.Threading } [CLSCompliant(false)] - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Timer(TimerCallback callback, Object state, @@ -832,7 +812,6 @@ namespace System.Threading TimerSetup(callback,state,dueTime,period,ref stackMark); } - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Timer(TimerCallback callback, Object state, @@ -852,7 +831,6 @@ namespace System.Threading TimerSetup(callback,state,(UInt32) dueTime, (UInt32) period,ref stackMark); } - [SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public Timer(TimerCallback callback) { @@ -865,7 +843,6 @@ namespace System.Threading TimerSetup(callback, this, (UInt32)dueTime, (UInt32)period, ref stackMark); } - [SecurityCritical] private void TimerSetup(TimerCallback callback, Object state, UInt32 dueTime, @@ -879,13 +856,11 @@ namespace System.Threading m_timer = new TimerHolder(new TimerQueueTimer(callback, state, dueTime, period, ref stackMark)); } - [SecurityCritical] internal static void Pause() { TimerQueue.Instance.Pause(); } - [SecurityCritical] internal static void Resume() { TimerQueue.Instance.Resume(); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Volatile.cs b/src/coreclr/src/mscorlib/src/System/Threading/Volatile.cs index af687fb..3894b43 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Volatile.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Volatile.cs @@ -129,7 +129,6 @@ namespace System.Threading [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] - [SecuritySafeCritical] // to match 32-bit version public static ulong Read(ref ulong location) { // @@ -154,7 +153,6 @@ namespace System.Threading [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [CLSCompliant(false)] - [SecuritySafeCritical] // contains unsafe code public static ulong Read(ref ulong location) { unsafe @@ -222,7 +220,6 @@ namespace System.Threading } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] //the intrinsic implementation of this method contains unverifiable code [System.Runtime.Versioning.NonVersionable] public static T Read(ref T location) where T : class { @@ -332,7 +329,6 @@ namespace System.Threading [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] - [SecuritySafeCritical] // to match 32-bit version public static void Write(ref ulong location, ulong value) { // @@ -356,7 +352,6 @@ namespace System.Threading [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [CLSCompliant(false)] - [SecuritySafeCritical] // contains unsafe code public static void Write(ref ulong location, ulong value) { // @@ -427,7 +422,6 @@ namespace System.Threading } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SecuritySafeCritical] //the intrinsic implementation of this method contains unverifiable code [System.Runtime.Versioning.NonVersionable] public static void Write(ref T location, T value) where T : class { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs index 1dd29e7..3debaf0 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs @@ -37,12 +37,10 @@ namespace System.Threading private IntPtr waitHandle; // !!! DO NOT MOVE THIS FIELD. (See defn of WAITHANDLEREF in object.h - has hardcoded access to this field.) #pragma warning restore 414 - [System.Security.SecurityCritical] // auto-generated internal volatile SafeWaitHandle safeWaitHandle; internal bool hasThreadAffinity; - [System.Security.SecuritySafeCritical] // auto-generated private static IntPtr GetInvalidHandle() { return Win32Native.INVALID_HANDLE_VALUE; @@ -66,7 +64,6 @@ namespace System.Threading Init(); } - [System.Security.SecuritySafeCritical] // auto-generated private void Init() { safeWaitHandle = null; @@ -78,12 +75,9 @@ namespace System.Threading [Obsolete("Use the SafeWaitHandle property instead.")] public virtual IntPtr Handle { - [System.Security.SecuritySafeCritical] // auto-generated get { return safeWaitHandle == null ? InvalidHandle : safeWaitHandle.DangerousGetHandle();} - [System.Security.SecurityCritical] // auto-generated_required #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] #endif set { @@ -112,9 +106,7 @@ namespace System.Threading public SafeWaitHandle SafeWaitHandle { - [System.Security.SecurityCritical] // auto-generated_required #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] #endif [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] get @@ -126,9 +118,7 @@ namespace System.Threading return safeWaitHandle; } - [System.Security.SecurityCritical] // auto-generated_required #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] #endif [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] set @@ -164,7 +154,6 @@ namespace System.Threading // FileStream, which will then call Sethandle, which requires a link time // security check.). While security has fixed that problem, we still // don't need to do a linktime check here. - [System.Security.SecurityCritical] // auto-generated internal void SetHandleInternal(SafeWaitHandle handle) { safeWaitHandle = handle; @@ -207,14 +196,12 @@ namespace System.Threading return WaitOne(timeout, false); } - [System.Security.SecuritySafeCritical] // auto-generated [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread-safety.")] private bool WaitOne(long timeout, bool exitContext) { return InternalWaitOne(safeWaitHandle, timeout, hasThreadAffinity, exitContext); } - [System.Security.SecurityCritical] // auto-generated internal static bool InternalWaitOne(SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) { if (waitableSafeHandle == null) @@ -234,7 +221,6 @@ namespace System.Threading return (ret != WaitTimeout); } - [System.Security.SecurityCritical] internal bool WaitOneWithoutFAS() { // version of waitone without fast application switch (FAS) support @@ -254,7 +240,6 @@ namespace System.Threading return (ret != WaitTimeout); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int WaitOneNative(SafeHandle waitableSafeHandle, uint millisecondsTimeout, bool hasThreadAffinity, bool exitContext); @@ -267,12 +252,10 @@ namespace System.Threading ** (if in a synchronized context) is exited before the wait and reacquired ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private static extern int WaitMultiple(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext, bool WaitAll); - [System.Security.SecuritySafeCritical] // auto-generated public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { if (waitHandles == null) @@ -379,7 +362,6 @@ namespace System.Threading ** (if in a synchronized context) is exited before the wait and reacquired ========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { @@ -477,7 +459,6 @@ namespace System.Threading == ==================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int SignalAndWaitOne(SafeWaitHandle waitHandleToSignal,SafeWaitHandle waitHandleToWaitOn, int millisecondsTimeout, bool hasThreadAffinity, bool exitContext); @@ -511,7 +492,6 @@ namespace System.Threading #endif } - [System.Security.SecuritySafeCritical] // auto-generated [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread-safety.")] public static bool SignalAndWait( WaitHandle toSignal, @@ -585,7 +565,6 @@ namespace System.Threading GC.SuppressFinalize(this); } - [System.Security.SecuritySafeCritical] // auto-generated protected virtual void Dispose(bool explicitDisposing) { if (safeWaitHandle != null) diff --git a/src/coreclr/src/mscorlib/src/System/TimeSpan.cs b/src/coreclr/src/mscorlib/src/System/TimeSpan.cs index 6dd35b8..349da68 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeSpan.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeSpan.cs @@ -407,7 +407,6 @@ namespace System { // "TimeSpan_LegacyFormatMode"=dword:00000001 // #if !FEATURE_CORECLR - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool LegacyFormatMode(); #endif // !FEATURE_CORECLR @@ -416,7 +415,6 @@ namespace System { // run in v2 - v3 legacy behavior. // #if !FEATURE_CORECLR - [System.Security.SecuritySafeCritical] #endif private static bool GetLegacyFormatMode() { #if !FEATURE_CORECLR diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs index 5e817f2..c8f6f8d 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs @@ -209,7 +209,6 @@ namespace System { public bool m_allSystemTimeZonesRead; #if FEATURE_WIN32_REGISTRY - [System.Security.SecuritySafeCritical] private static TimeZoneInfo GetCurrentOneYearLocal() { // load the data from the OS TimeZoneInfo match; @@ -961,7 +960,6 @@ namespace System { // // // - [System.Security.SecuritySafeCritical] // auto-generated static public ReadOnlyCollection GetSystemTimeZones() { CachedData cachedData = s_cachedData; @@ -995,7 +993,6 @@ namespace System { return cachedData.m_readOnlySystemTimeZones; } - [SecuritySafeCritical] private static void PopulateAllSystemTimeZones(CachedData cachedData) { #if FEATURE_WIN32_REGISTRY @@ -1138,7 +1135,6 @@ namespace System { // private ctor // #if FEATURE_WIN32_REGISTRY - [System.Security.SecurityCritical] // auto-generated private TimeZoneInfo(Win32Native.TimeZoneInformation zone, Boolean dstDisabled) { if (String.IsNullOrEmpty(zone.StandardName)) { @@ -1381,7 +1377,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException(nameof(info)); @@ -1562,7 +1557,6 @@ namespace System { // // This check is only meant to be used for "Local". // - [System.Security.SecurityCritical] // auto-generated static private Boolean CheckDaylightSavingTimeNotSupported(Win32Native.TimeZoneInformation timeZone) { return ( timeZone.DaylightDate.Year == timeZone.StandardDate.Year && timeZone.DaylightDate.Month == timeZone.StandardDate.Month @@ -1620,7 +1614,6 @@ namespace System { // // Converts a Win32Native.RegistryTimeZoneInformation (REG_TZI_FORMAT struct) to an AdjustmentRule // - [System.Security.SecurityCritical] // auto-generated static private AdjustmentRule CreateAdjustmentRuleFromTimeZoneInformation(Win32Native.RegistryTimeZoneInformation timeZoneInformation, DateTime startDate, DateTime endDate, int defaultBaseUtcOffset) { AdjustmentRule rule; bool supportsDst = (timeZoneInformation.StandardDate.Month != 0); @@ -1678,7 +1671,6 @@ namespace System { // Helper function that searches the registry for a time zone entry // that matches the TimeZoneInformation struct // - [System.Security.SecuritySafeCritical] // auto-generated static private String FindIdFromTimeZoneInformation(Win32Native.TimeZoneInformation timeZone, out Boolean dstDisabled) { dstDisabled = false; @@ -2115,7 +2107,6 @@ namespace System { // assumes cachedData lock is taken // - [System.Security.SecuritySafeCritical] // auto-generated static private TimeZoneInfo GetLocalTimeZone(CachedData cachedData) { @@ -2283,7 +2274,6 @@ namespace System { /// 3. Look for the data in GetTimeZoneDirectory()/localtime. /// 4. Use UTC if all else fails. /// - [SecurityCritical] private static bool TryGetLocalTzFile(out byte[] rawData, out string id) { rawData = null; @@ -2363,7 +2353,6 @@ namespace System { /// Finds the time zone id by using 'readlink' on the path to see if tzFilePath is /// a symlink to a file /// - [SecuritySafeCritical] private static string FindTimeZoneIdUsingReadLink(string tzFilePath) { string id = null; @@ -2479,7 +2468,6 @@ namespace System { // // The TryGetLocalTzFile() call returns a Byte[] containing the compiled tzfile. // - [System.Security.SecurityCritical] static private TimeZoneInfo GetLocalTimeZoneFromTzFile() { byte[] rawData; @@ -2542,7 +2530,6 @@ namespace System { // try/catch logic for handling the TimeZoneInfo private constructor that takes // a Win32Native.TimeZoneInformation structure. // - [System.Security.SecurityCritical] // auto-generated static private TimeZoneInfo GetLocalTimeZoneFromWin32Data(Win32Native.TimeZoneInformation timeZoneInformation, Boolean dstDisabled) { // first try to create the TimeZoneInfo with the original 'dstDisabled' flag try { @@ -2748,7 +2735,6 @@ namespace System { // * when the argument 'readStart' is true the corresponding daylightTransitionTimeStart field is read // * when the argument 'readStart' is false the corresponding dayightTransitionTimeEnd field is read // - [System.Security.SecurityCritical] // auto-generated static private bool TransitionTimeFromTimeZoneInformation(Win32Native.RegistryTimeZoneInformation timeZoneInformation, out TransitionTime transitionTime, bool readStartDate) { // // SYSTEMTIME - @@ -2954,7 +2940,6 @@ namespace System { // // This method expects that its caller has already Asserted RegistryPermission.Read // - [System.Security.SecurityCritical] // auto-generated static private bool TryCreateAdjustmentRules(string id, Win32Native.RegistryTimeZoneInformation defaultTimeZoneInformation, out AdjustmentRule[] rules, out Exception e, int defaultBaseUtcOffset) { e = null; @@ -3108,7 +3093,6 @@ namespace System { // Helper function that compares the StandardBias and StandardDate portion a // TimeZoneInformation struct to a time zone registry entry // - [System.Security.SecurityCritical] // auto-generated static private Boolean TryCompareStandardDate(Win32Native.TimeZoneInformation timeZone, Win32Native.RegistryTimeZoneInformation registryTimeZoneInfo) { return timeZone.Bias == registryTimeZoneInfo.Bias && timeZone.StandardBias == registryTimeZoneInfo.StandardBias @@ -3127,7 +3111,6 @@ namespace System { // // Helper function that compares a TimeZoneInformation struct to a time zone registry entry // - [System.Security.SecuritySafeCritical] // auto-generated static private Boolean TryCompareTimeZoneInformationToRegistry(Win32Native.TimeZoneInformation timeZone, string id, out Boolean dstDisabled) { dstDisabled = false; @@ -3210,7 +3193,6 @@ namespace System { // // // - [System.Security.SecuritySafeCritical] // auto-generated #if !FEATURE_CORECLR [FileIOPermissionAttribute(SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.PathDiscovery)] #endif @@ -3283,7 +3265,6 @@ namespace System { // "resource.dll" is a language-specific resource DLL. // If the localized resource DLL exists, LoadString(resource) is returned. // - [SecurityCritical] static private string TryGetLocalizedNameByNativeResource(string filePath, int resource) { using (SafeLibraryHandle handle = UnsafeNativeMethods.LoadLibraryEx(filePath, IntPtr.Zero, Win32Native.LOAD_LIBRARY_AS_DATAFILE)) { @@ -3314,9 +3295,6 @@ namespace System { // // This method expects that its caller has already Asserted RegistryPermission.Read // -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif static private Boolean TryGetLocalizedNamesByRegistryKey(RegistryKey key, out String displayName, out String standardName, out String daylightName) { displayName = String.Empty; standardName = String.Empty; @@ -3393,7 +3371,6 @@ namespace System { // * TZI, REG_BINARY REG_TZI_FORMAT // See Win32Native.RegistryTimeZoneInformation // - [System.Security.SecuritySafeCritical] // auto-generated static private TimeZoneInfoResult TryGetTimeZoneByRegistryKey(string id, out TimeZoneInfo value, out Exception e) { e = null; @@ -4203,7 +4180,6 @@ namespace System { // Converts an array of bytes into an int - always using standard byte order (Big Endian) // per TZif file standard - [System.Security.SecuritySafeCritical] // auto-generated static private unsafe int TZif_ToInt32 (byte[]value, int startIndex) { fixed( byte * pbyte = &value[startIndex]) { return (*pbyte << 24) | (*(pbyte + 1) << 16) | (*(pbyte + 2) << 8) | (*(pbyte + 3)); @@ -4212,7 +4188,6 @@ namespace System { // Converts an array of bytes into a long - always using standard byte order (Big Endian) // per TZif file standard - [System.Security.SecuritySafeCritical] // auto-generated static private unsafe long TZif_ToInt64(byte[] value, int startIndex) { fixed (byte* pbyte = &value[startIndex]) @@ -4711,7 +4686,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException(nameof(info)); @@ -4961,7 +4935,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated_required void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/Type.cs b/src/coreclr/src/mscorlib/src/System/Type.cs index 01d3d93..b0d385b 100644 --- a/src/coreclr/src/mscorlib/src/System/Type.cs +++ b/src/coreclr/src/mscorlib/src/System/Type.cs @@ -154,7 +154,6 @@ namespace System // param progID: the progID of the class to retrieve // returns: the class object associated to the progID //// - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeFromProgID(String progID) { return RuntimeType.GetTypeFromProgIDImpl(progID, null, false); @@ -169,19 +168,16 @@ namespace System // param progID: the progID of the class to retrieve // returns: the class object associated to the progID //// - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeFromProgID(String progID, bool throwOnError) { return RuntimeType.GetTypeFromProgIDImpl(progID, null, throwOnError); } - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeFromProgID(String progID, String server) { return RuntimeType.GetTypeFromProgIDImpl(progID, server, false); } - [System.Security.SecurityCritical] // auto-generated_required public static Type GetTypeFromProgID(String progID, String server, bool throwOnError) { return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError); @@ -194,25 +190,21 @@ namespace System // param CLSID: the CLSID of the class to retrieve // returns: the class object associated to the CLSID //// - [System.Security.SecuritySafeCritical] // auto-generated public static Type GetTypeFromCLSID(Guid clsid) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, false); } - [System.Security.SecuritySafeCritical] // auto-generated public static Type GetTypeFromCLSID(Guid clsid, bool throwOnError) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, throwOnError); } - [System.Security.SecuritySafeCritical] // auto-generated public static Type GetTypeFromCLSID(Guid clsid, String server) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, false); } - [System.Security.SecuritySafeCritical] // auto-generated public static Type GetTypeFromCLSID(Guid clsid, String server, bool throwOnError) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError); @@ -338,12 +330,10 @@ namespace System } // Given a class handle, this will return the class for that handle. - [System.Security.SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] internal static extern RuntimeType GetTypeFromHandleUnsafe(IntPtr handle); [Pure] - [System.Security.SecuritySafeCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] public static extern Type GetTypeFromHandle(RuntimeTypeHandle handle); @@ -1050,7 +1040,6 @@ namespace System public bool IsInterface { [Pure] - [System.Security.SecuritySafeCritical] // auto-generated get { RuntimeType rt = this as RuntimeType; @@ -1771,12 +1760,10 @@ namespace System return (Object.ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType)); } - [System.Security.SecuritySafeCritical] [Pure] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool operator ==(Type left, Type right); - [System.Security.SecuritySafeCritical] [Pure] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool operator !=(Type left, Type right); diff --git a/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs b/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs index 62d189d..bcc1c3e 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs @@ -56,7 +56,6 @@ namespace System { } } - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("TypeName",TypeName,typeof(String)); diff --git a/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs b/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs index a1eae15..d73a97f 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs @@ -44,14 +44,12 @@ namespace System { public override String Message { - [System.Security.SecuritySafeCritical] // auto-generated get { SetMessageField(); return _message; } } - [System.Security.SecurityCritical] // auto-generated private void SetMessageField() { if (_message == null) { @@ -83,7 +81,6 @@ namespace System { } // This is called from inside the EE. - [System.Security.SecurityCritical] // auto-generated private TypeLoadException(String className, String assemblyName, String messageArg, @@ -112,14 +109,12 @@ namespace System { ResourceId = info.GetInt32("TypeLoadResourceID"); } - [System.Security.SecurityCritical] // auto-generated [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void GetTypeLoadExceptionMessage(int resourceId, StringHandleOnStack retString); //We can rely on the serialization mechanism on Exception to handle most of our needs, but //we need to add a few fields of our own. - [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) throw new ArgumentNullException(nameof(info)); diff --git a/src/coreclr/src/mscorlib/src/System/TypeNameParser.cs b/src/coreclr/src/mscorlib/src/System/TypeNameParser.cs index 0fadf39..e879a63 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeNameParser.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeNameParser.cs @@ -15,11 +15,9 @@ using Microsoft.Win32.SafeHandles; namespace System { - [SecurityCritical] internal class SafeTypeNameParserHandle : SafeHandleZeroOrMinusOneIsInvalid { #region QCalls - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _ReleaseTypeNameParser(IntPtr pTypeNameParser); @@ -30,7 +28,6 @@ namespace System { } - [SecurityCritical] protected override bool ReleaseHandle() { _ReleaseTypeNameParser(handle); @@ -42,34 +39,28 @@ namespace System internal sealed class TypeNameParser : IDisposable { #region QCalls - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _CreateTypeNameParser(string typeName, ObjectHandleOnStack retHandle, bool throwOnError); - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _GetNames(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray); - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray); - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray); - [SecurityCritical] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString); #endregion #region Static Members - [SecuritySafeCritical] internal static Type GetType( string typeName, Func assemblyResolver, @@ -103,19 +94,16 @@ namespace System #endregion #region Private Data Members - [SecurityCritical] private SafeTypeNameParserHandle m_NativeParser; private static readonly char[] SPECIAL_CHARS = {',', '[', ']', '&', '*', '+', '\\'}; /* see typeparse.h */ #endregion #region Constructor and Disposer - [SecuritySafeCritical] private TypeNameParser(SafeTypeNameParserHandle handle) { m_NativeParser = handle; } - [SecuritySafeCritical] public void Dispose() { m_NativeParser.Dispose(); @@ -123,7 +111,6 @@ namespace System #endregion #region private Members - [SecuritySafeCritical] private unsafe Type ConstructType( Func assemblyResolver, Func typeResolver, @@ -201,7 +188,6 @@ namespace System } } - [SecuritySafeCritical] private static Assembly ResolveAssembly(string asmName, Func assemblyResolver, bool throwOnError, ref StackCrawlMark stackMark) { Contract.Requires(asmName != null && asmName.Length > 0); @@ -316,7 +302,6 @@ namespace System return StringBuilderCache.GetStringAndRelease(sb); } - [SecuritySafeCritical] private static SafeTypeNameParserHandle CreateTypeNameParser(string typeName, bool throwOnError) { SafeTypeNameParserHandle retHandle = null; @@ -325,7 +310,6 @@ namespace System return retHandle; } - [SecuritySafeCritical] private string[] GetNames() { string[] names = null; @@ -334,7 +318,6 @@ namespace System return names; } - [SecuritySafeCritical] private SafeTypeNameParserHandle[] GetTypeArguments() { SafeTypeNameParserHandle[] arguments = null; @@ -343,7 +326,6 @@ namespace System return arguments; } - [SecuritySafeCritical] private int[] GetModifiers() { int[] modifiers = null; @@ -352,7 +334,6 @@ namespace System return modifiers; } - [SecuritySafeCritical] private string GetAssemblyName() { string assemblyName = null; diff --git a/src/coreclr/src/mscorlib/src/System/TypedReference.cs b/src/coreclr/src/mscorlib/src/System/TypedReference.cs index 9d3f36f..b65652e 100644 --- a/src/coreclr/src/mscorlib/src/System/TypedReference.cs +++ b/src/coreclr/src/mscorlib/src/System/TypedReference.cs @@ -23,7 +23,6 @@ namespace System { private IntPtr Value; private IntPtr Type; - [System.Security.SecurityCritical] // auto-generated_required [CLSCompliant(false)] public static TypedReference MakeTypedReference(Object target, FieldInfo[] flds) { if (target == null) @@ -71,7 +70,6 @@ namespace System { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as pointer private unsafe static extern void InternalMakeTypedReference(void* result, Object target, IntPtr[] flds, RuntimeType lastFieldType); @@ -89,13 +87,11 @@ namespace System { throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI")); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe static Object ToObject(TypedReference value) { return InternalToObject(&value); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal unsafe extern static Object InternalToObject(void * value); @@ -118,14 +114,12 @@ namespace System { } // This may cause the type to be changed. - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public unsafe static void SetTypedReference(TypedReference target, Object value) { InternalSetTypedReference(&target, value); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal unsafe extern static void InternalSetTypedReference(void * target, Object value); } diff --git a/src/coreclr/src/mscorlib/src/System/UInt16.cs b/src/coreclr/src/mscorlib/src/System/UInt16.cs index dba7f97..399ef02 100644 --- a/src/coreclr/src/mscorlib/src/System/UInt16.cs +++ b/src/coreclr/src/mscorlib/src/System/UInt16.cs @@ -68,26 +68,22 @@ namespace System { } // Converts the current value to a String in base-10 with no extra padding. - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/UInt32.cs b/src/coreclr/src/mscorlib/src/System/UInt32.cs index 7010dae..f3d6009 100644 --- a/src/coreclr/src/mscorlib/src/System/UInt32.cs +++ b/src/coreclr/src/mscorlib/src/System/UInt32.cs @@ -79,25 +79,21 @@ namespace System { } // The base 10 representation of the number with no extra padding. - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt32(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/UInt64.cs b/src/coreclr/src/mscorlib/src/System/UInt64.cs index 83549cf..b55cd7c 100644 --- a/src/coreclr/src/mscorlib/src/System/UInt64.cs +++ b/src/coreclr/src/mscorlib/src/System/UInt64.cs @@ -75,25 +75,21 @@ namespace System { return ((int)m_value) ^ (int)(m_value >> 32); } - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt64(m_value, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt64(m_value, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt64(m_value, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result() != null); return Number.FormatUInt64(m_value, format, NumberFormatInfo.GetInstance(provider)); diff --git a/src/coreclr/src/mscorlib/src/System/UIntPtr.cs b/src/coreclr/src/mscorlib/src/System/UIntPtr.cs index 141eb4d..77bca0d 100644 --- a/src/coreclr/src/mscorlib/src/System/UIntPtr.cs +++ b/src/coreclr/src/mscorlib/src/System/UIntPtr.cs @@ -24,20 +24,17 @@ namespace System { [System.Runtime.InteropServices.ComVisible(true)] public struct UIntPtr : IEquatable, ISerializable { - [SecurityCritical] unsafe private void* m_value; public static readonly UIntPtr Zero; - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe UIntPtr(uint value) { m_value = (void *)value; } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe UIntPtr(ulong value) { @@ -48,7 +45,6 @@ namespace System { #endif } - [System.Security.SecurityCritical] [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] public unsafe UIntPtr(void* value) @@ -56,7 +52,6 @@ namespace System { m_value = value; } - [System.Security.SecurityCritical] // auto-generated private unsafe UIntPtr(SerializationInfo info, StreamingContext context) { ulong l = info.GetUInt64("value"); @@ -67,7 +62,6 @@ namespace System { m_value = (void *)l; } - [System.Security.SecurityCritical] unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { @@ -77,7 +71,6 @@ namespace System { info.AddValue("value", (ulong)m_value); } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override bool Equals(Object obj) { if (obj is UIntPtr) { return (m_value == ((UIntPtr)obj).m_value); @@ -85,13 +78,11 @@ namespace System { return false; } - [SecuritySafeCritical] unsafe bool IEquatable.Equals(UIntPtr other) { return m_value == other.m_value; } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override int GetHashCode() { #if FEATURE_CORECLR #if BIT64 @@ -105,7 +96,6 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe uint ToUInt32() { #if BIT64 @@ -115,13 +105,11 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe ulong ToUInt64() { return (ulong)m_value; } - [System.Security.SecuritySafeCritical] // auto-generated public unsafe override String ToString() { Contract.Ensures(Contract.Result() != null); @@ -144,7 +132,6 @@ namespace System { return new UIntPtr(value); } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static explicit operator uint(UIntPtr value) { @@ -155,14 +142,12 @@ namespace System { #endif } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static explicit operator ulong (UIntPtr value) { return (ulong)value.m_value; } - [System.Security.SecurityCritical] [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] public static unsafe explicit operator UIntPtr (void* value) @@ -170,7 +155,6 @@ namespace System { return new UIntPtr(value); } - [System.Security.SecurityCritical] [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] public static unsafe explicit operator void* (UIntPtr value) @@ -179,7 +163,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool operator == (UIntPtr value1, UIntPtr value2) { @@ -187,7 +170,6 @@ namespace System { } - [System.Security.SecuritySafeCritical] // auto-generated [System.Runtime.Versioning.NonVersionable] public unsafe static bool operator != (UIntPtr value1, UIntPtr value2) { @@ -235,7 +217,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] [System.Runtime.Versioning.NonVersionable] public unsafe void* ToPointer() diff --git a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs index 7d65319..8c27982 100644 --- a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs +++ b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs @@ -5,9 +5,6 @@ namespace System { using System; -#if FEATURE_CORECLR - [System.Security.SecurityCritical] // auto-generated -#endif [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public delegate void UnhandledExceptionEventHandler(Object sender, UnhandledExceptionEventArgs e); diff --git a/src/coreclr/src/mscorlib/src/System/UnitySerializationHolder.cs b/src/coreclr/src/mscorlib/src/System/UnitySerializationHolder.cs index 2840004..712391a 100644 --- a/src/coreclr/src/mscorlib/src/System/UnitySerializationHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/UnitySerializationHolder.cs @@ -204,7 +204,6 @@ namespace System { #endregion #region ISerializable - [System.Security.SecurityCritical] // auto-generated public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnitySerHolder")); @@ -212,7 +211,6 @@ namespace System { #endregion #region IObjectReference - [System.Security.SecurityCritical] // auto-generated public virtual Object GetRealObject(StreamingContext context) { // GetRealObject uses the data we have in m_data and m_unityType to do a lookup on the correct diff --git a/src/coreclr/src/mscorlib/src/System/ValueType.cs b/src/coreclr/src/mscorlib/src/System/ValueType.cs index ae08b7d..102a0d2 100644 --- a/src/coreclr/src/mscorlib/src/System/ValueType.cs +++ b/src/coreclr/src/mscorlib/src/System/ValueType.cs @@ -20,7 +20,6 @@ namespace System { [System.Runtime.InteropServices.ComVisible(true)] public abstract class ValueType { - [System.Security.SecuritySafeCritical] public override bool Equals (Object obj) { BCLDebug.Perf(false, "ValueType::Equals is not fast. "+this.GetType().FullName+" should override Equals(Object)"); if (null==obj) { @@ -60,11 +59,9 @@ namespace System { return true; } - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool CanCompareBits(Object obj); - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool FastEqualsCheck(Object a, Object b); @@ -78,7 +75,6 @@ namespace System { **Arguments: None. **Exceptions: None. ==============================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override int GetHashCode(); diff --git a/src/coreclr/src/mscorlib/src/System/Variant.cs b/src/coreclr/src/mscorlib/src/System/Variant.cs index 951c46d..52ec0ab 100644 --- a/src/coreclr/src/mscorlib/src/System/Variant.cs +++ b/src/coreclr/src/mscorlib/src/System/Variant.cs @@ -118,19 +118,14 @@ namespace System { // // Native Methods // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern double GetR8FromVar(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern float GetR4FromVar(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetFieldsR4(float val); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetFieldsR8(double val); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetFieldsObject(Object val); @@ -224,7 +219,6 @@ namespace System { m_data2 = (int)(val >> 32); } - [System.Security.SecuritySafeCritical] // auto-generated public Variant(float val) { m_objref=null; m_flags=CV_R4; @@ -233,7 +227,6 @@ namespace System { SetFieldsR4(val); } - [System.Security.SecurityCritical] // auto-generated public Variant(double val) { m_objref=null; m_flags=CV_R8; @@ -257,7 +250,6 @@ namespace System { m_data2=0; } - [System.Security.SecuritySafeCritical] // auto-generated public Variant(Object obj) { m_data1=0; m_data2=0; @@ -342,7 +334,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated unsafe public Variant(void* voidPointer,Type pointerType) { if (pointerType == null) throw new ArgumentNullException(nameof(pointerType)); @@ -365,7 +356,6 @@ namespace System { } } - [System.Security.SecuritySafeCritical] // auto-generated public Object ToObject() { switch (CVType) { case CV_EMPTY: @@ -413,14 +403,12 @@ namespace System { } // This routine will return an boxed enum. - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Object BoxEnum(); // Helper code for marshaling managed objects to VARIANT's (we use // managed variants as an intermediate type. - [System.Security.SecuritySafeCritical] // auto-generated internal static void MarshalHelperConvertObjectToVariant(Object o, ref Variant v) { IConvertible ic = o as IConvertible; @@ -529,7 +517,6 @@ namespace System { // Helper code: on the back propagation path where a VT_BYREF VARIANT* // is marshaled to a "ref Object", we use this helper to force the // updated object back to the original type. - [System.Security.SecurityCritical] // auto-generated internal static void MarshalHelperCastVariant(Object pValue, int vt, ref Variant v) { IConvertible iv = pValue as IConvertible; diff --git a/src/coreclr/src/mscorlib/src/System/WeakReference.cs b/src/coreclr/src/mscorlib/src/System/WeakReference.cs index 27a9ab7..b30ea81 100644 --- a/src/coreclr/src/mscorlib/src/System/WeakReference.cs +++ b/src/coreclr/src/mscorlib/src/System/WeakReference.cs @@ -19,7 +19,6 @@ namespace System { using System.Diagnostics.Contracts; [System.Runtime.InteropServices.ComVisible(true)] #if !FEATURE_CORECLR - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] // Don't call Object::MemberwiseClone. #endif [Serializable] public class WeakReference : ISerializable @@ -31,7 +30,6 @@ namespace System { #if FEATURE_CORECLR // Migrating InheritanceDemands requires this default ctor, so we can mark it SafeCritical - [SecuritySafeCritical] protected WeakReference() { Contract.Assert(false, "WeakReference's protected default ctor should never be used!"); throw new NotImplementedException(); @@ -68,7 +66,6 @@ namespace System { // public extern virtual bool IsAlive { [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] get; } @@ -85,10 +82,8 @@ namespace System { // public extern virtual Object Target { [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] get; [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] set; } @@ -99,10 +94,8 @@ namespace System { // This is needed for subclasses deriving from WeakReference, however. // Additionally, there may be some cases during shutdown when we run this finalizer. [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] extern ~WeakReference(); - [SecurityCritical] public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { @@ -114,11 +107,9 @@ namespace System { } [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] private extern void Create(Object target, bool trackResurrection); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] private extern bool IsTrackResurrection(); } diff --git a/src/coreclr/src/mscorlib/src/System/WeakReferenceOfT.cs b/src/coreclr/src/mscorlib/src/System/WeakReferenceOfT.cs index da2999e..0972e5f 100644 --- a/src/coreclr/src/mscorlib/src/System/WeakReferenceOfT.cs +++ b/src/coreclr/src/mscorlib/src/System/WeakReferenceOfT.cs @@ -81,10 +81,8 @@ namespace System private extern T Target { [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] get; [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] set; } @@ -95,10 +93,8 @@ namespace System // This is needed for subclasses deriving from WeakReference, however. // Additionally, there may be some cases during shutdown when we run this finalizer. [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] extern ~WeakReference(); - [SecurityCritical] public void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { @@ -111,11 +107,9 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] private extern void Create(T target, bool trackResurrection); [MethodImplAttribute(MethodImplOptions.InternalCall)] - [SecuritySafeCritical] private extern bool IsTrackResurrection(); } } diff --git a/src/coreclr/src/mscorlib/src/System/_LocalDataStore.cs b/src/coreclr/src/mscorlib/src/System/_LocalDataStore.cs index a3a312f..b9659f6 100644 --- a/src/coreclr/src/mscorlib/src/System/_LocalDataStore.cs +++ b/src/coreclr/src/mscorlib/src/System/_LocalDataStore.cs @@ -197,7 +197,6 @@ namespace System { /*========================================================================= ** Method used to expand the capacity of the local data store. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated private LocalDataStoreElement PopulateElement(LocalDataStoreSlot slot) { bool tookLock = false; diff --git a/src/coreclr/src/mscorlib/src/System/_LocalDataStoreMgr.cs b/src/coreclr/src/mscorlib/src/System/_LocalDataStoreMgr.cs index 6078b2e..8f60d6f 100644 --- a/src/coreclr/src/mscorlib/src/System/_LocalDataStoreMgr.cs +++ b/src/coreclr/src/mscorlib/src/System/_LocalDataStoreMgr.cs @@ -89,7 +89,6 @@ namespace System { ** list. The initial size of the new store matches the number of slots ** allocated in this manager. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public LocalDataStoreHolder CreateLocalDataStore() { // Create a new local data store. @@ -115,7 +114,6 @@ namespace System { /*========================================================================= * Remove the specified store from the list of managed stores.. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public void DeleteLocalDataStore(LocalDataStore store) { bool tookLock = false; @@ -138,7 +136,6 @@ namespace System { ** an object to prevent clients from manipulating it directly, allowing us ** to make assumptions its integrity. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public LocalDataStoreSlot AllocateDataSlot() { bool tookLock = false; @@ -208,7 +205,6 @@ namespace System { /*========================================================================= ** Allocate a slot and associate a name with it. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public LocalDataStoreSlot AllocateNamedDataSlot(String name) { bool tookLock = false; @@ -235,7 +231,6 @@ namespace System { ** Retrieve the slot associated with a name, allocating it if no such ** association has been defined. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public LocalDataStoreSlot GetNamedDataSlot(String name) { bool tookLock = false; @@ -264,7 +259,6 @@ namespace System { ** Eliminate the association of a name with a slot. The actual slot will ** be reclaimed when the finalizer for the slot object runs. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated public void FreeNamedDataSlot(String name) { bool tookLock = false; @@ -285,7 +279,6 @@ namespace System { /*========================================================================= ** Free's a previously allocated data slot on ALL the managed data stores. =========================================================================*/ - [System.Security.SecuritySafeCritical] // auto-generated internal void FreeDataSlot(int slot, long cookie) { bool tookLock = false; diff --git a/src/coreclr/src/mscorlib/src/System/__ComObject.cs b/src/coreclr/src/mscorlib/src/System/__ComObject.cs index fc82c28..9f9bac6 100644 --- a/src/coreclr/src/mscorlib/src/System/__ComObject.cs +++ b/src/coreclr/src/mscorlib/src/System/__ComObject.cs @@ -59,7 +59,6 @@ namespace System return base.ToString(); } - [System.Security.SecurityCritical] // auto-generated internal IntPtr GetIUnknown(out bool fIsURTAggregated) { fIsURTAggregated = !GetType().IsDefined(typeof(ComImportAttribute), false); @@ -118,7 +117,6 @@ namespace System // This method is called from within the EE and releases all the // cached data for the __ComObject. //==================================================================== - [System.Security.SecurityCritical] // auto-generated internal void ReleaseAllData() { // Synchronize access to the map. @@ -154,7 +152,6 @@ namespace System // This method is called from within the EE and is used to handle // calls on methods of event interfaces. //==================================================================== - [System.Security.SecurityCritical] // auto-generated internal Object GetEventProvider(RuntimeType t) { // Check to see if we already have a cached event provider for this type. @@ -167,19 +164,16 @@ namespace System return EvProvider; } - [System.Security.SecurityCritical] // auto-generated internal int ReleaseSelf() { return Marshal.InternalReleaseComObject(this); } - [System.Security.SecurityCritical] // auto-generated internal void FinalReleaseSelf() { Marshal.InternalFinalReleaseComObject(this); } - [System.Security.SecurityCritical] // auto-generated private Object CreateEventProvider(RuntimeType t) { // Create the event provider for the specified type. diff --git a/src/coreclr/src/mscorlib/src/System/mda.cs b/src/coreclr/src/mscorlib/src/System/mda.cs index 089039c..f750e99 100644 --- a/src/coreclr/src/mscorlib/src/System/mda.cs +++ b/src/coreclr/src/mscorlib/src/System/mda.cs @@ -18,7 +18,6 @@ namespace System private static volatile int _captureAllocatedCallStackState; internal static bool Enabled { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_enabledState == 0) { if (Mda.IsStreamWriterBufferedDataLostEnabled()) @@ -32,7 +31,6 @@ namespace System } internal static bool CaptureAllocatedCallStack { - [System.Security.SecuritySafeCritical] // auto-generated get { if (_captureAllocatedCallStackState == 0) { if (Mda.IsStreamWriterBufferedDataLostCaptureAllocatedCallStack()) @@ -45,42 +43,33 @@ namespace System } } - [System.Security.SecuritySafeCritical] // auto-generated internal static void ReportError(String text) { Mda.ReportStreamWriterBufferedDataLost(text); } } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ReportStreamWriterBufferedDataLost(String text); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool IsStreamWriterBufferedDataLostEnabled(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool IsStreamWriterBufferedDataLostCaptureAllocatedCallStack(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void MemberInfoCacheCreation(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void DateTimeInvalidLocalFormat(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern bool IsInvalidGCHandleCookieProbeEnabled(); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void FireInvalidGCHandleCookieProbe(IntPtr cookie); - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void ReportErrorSafeHandleRelease(Exception ex); } -- 2.7.4