diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index b605643ff557a3..622978d4f15817 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/metadata/CMakeLists.txt b/src/mono/mono/metadata/CMakeLists.txt index d9818390bdcbf0..72fe5b1e60fbbd 100644 --- a/src/mono/mono/metadata/CMakeLists.txt +++ b/src/mono/mono/metadata/CMakeLists.txt @@ -139,9 +139,6 @@ set(metadata_common_sources profiler.c profiler-private.h runtime.c - security-core-clr.c - security-core-clr.h - security-manager.h string-icalls.c string-icalls.h sysmath.c diff --git a/src/mono/mono/metadata/appdomain.c b/src/mono/mono/metadata/appdomain.c index 0c8bd4bf68050b..3bae7722325e90 100644 --- a/src/mono/mono/metadata/appdomain.c +++ b/src/mono/mono/metadata/appdomain.c @@ -970,3 +970,15 @@ runtimeconfig_json_read_props (const char *ptr, const char **endp, int nprops, g *endp = ptr; } + +void +mono_security_enable_core_clr () +{ + // no-op +} + +void +mono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback) +{ + // no-op +} diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index 57bb9ac6103472..f591daee162bfb 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -17,10 +17,10 @@ #include #include #include -#include -#include #include #include +#include +#include #include #include #include diff --git a/src/mono/mono/metadata/class-setup-vtable.c b/src/mono/mono/metadata/class-setup-vtable.c index ae1727efa0beb0..73015f3753df61 100644 --- a/src/mono/mono/metadata/class-setup-vtable.c +++ b/src/mono/mono/metadata/class-setup-vtable.c @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include #include #include #ifdef MONO_CLASS_DEF_PRIVATE diff --git a/src/mono/mono/metadata/class.c b/src/mono/mono/metadata/class.c index c3d6d53893f97f..6c816c174ab015 100644 --- a/src/mono/mono/metadata/class.c +++ b/src/mono/mono/metadata/class.c @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/mono/mono/metadata/icall-decl.h b/src/mono/mono/metadata/icall-decl.h index 7d613e738289b1..c145332ed493bf 100644 --- a/src/mono/mono/metadata/icall-decl.h +++ b/src/mono/mono/metadata/icall-decl.h @@ -18,8 +18,6 @@ #include "object-forward.h" #include "object-internals.h" #include "reflection.h" -#include "security-core-clr.h" -#include "security-manager.h" #include "string-icalls.h" #include "mono/utils/mono-digest.h" #include "mono/utils/mono-forward-internal.h" diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 7d67af17d23ece..21fd4a523bdaa9 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -68,8 +68,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/mono/mono/metadata/image.c b/src/mono/mono/metadata/image.c index 6a5fd151dce699..4954655cb2a803 100644 --- a/src/mono/mono/metadata/image.c +++ b/src/mono/mono/metadata/image.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -1458,8 +1457,6 @@ do_mono_image_open (MonoAssemblyLoadContext *alc, const char *fname, MonoImageOp image->metadata_only = metadata_only; image->load_from_context = load_from_context; image->ref_count = 1; - /* if MONO_SECURITY_MODE_CORE_CLR is set then determine if this image is platform code */ - image->core_clr_platform_code = mono_security_core_clr_determine_platform_image (image); image->alc = alc; return do_mono_image_load (image, status, care_about_cli, care_about_pecoff); } diff --git a/src/mono/mono/metadata/metadata-internals.h b/src/mono/mono/metadata/metadata-internals.h index 2aea7227de7258..e96e7042057856 100644 --- a/src/mono/mono/metadata/metadata-internals.h +++ b/src/mono/mono/metadata/metadata-internals.h @@ -339,7 +339,7 @@ struct _MonoImage { guint8 idx_guid_wide : 1; guint8 idx_blob_wide : 1; - /* Whenever this image is considered as platform code for the CoreCLR security model */ + /* NOT SUPPORTED: Whenever this image is considered as platform code for the CoreCLR security model */ guint8 core_clr_platform_code : 1; /* Whether a #JTD stream was present. Indicates that this image was a minimal delta and its heaps only include the new heap entries */ diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index b4a19469544991..c3822f1e1955d7 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -38,7 +38,6 @@ #include #include #include "mono/metadata/profiler-private.h" -#include "mono/metadata/security-manager.h" #include #include #include diff --git a/src/mono/mono/metadata/reflection.c b/src/mono/mono/metadata/reflection.c index 3a342dbfcb66f4..158b95b4199df0 100644 --- a/src/mono/mono/metadata/reflection.c +++ b/src/mono/mono/metadata/reflection.c @@ -27,8 +27,8 @@ #include "mono/metadata/assembly.h" #include "mono/metadata/object-internals.h" #include +#include #include -#include #include #include #include @@ -42,7 +42,6 @@ #include "mono-endian.h" #include #include -#include #include #include #include diff --git a/src/mono/mono/metadata/security-core-clr.c b/src/mono/mono/metadata/security-core-clr.c deleted file mode 100644 index 2687308e88cf1e..00000000000000 --- a/src/mono/mono/metadata/security-core-clr.c +++ /dev/null @@ -1,208 +0,0 @@ -/** - * \file - * CoreCLR security - * - * Authors: - * Mark Probst - * Sebastien Pouliot - * - * Copyright 2007-2010 Novell, Inc (http://www.novell.com) - * Licensed under the MIT license. See LICENSE file in the project root for full license information. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security-core-clr.h" - -gboolean mono_security_core_clr_test = FALSE; - -static MonoSecurityCoreCLROptions security_core_clr_options = MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT; - -/** - * mono_security_core_clr_set_options: - * \param options the new options for the coreclr system to use - * - * By default, the CoreCLRs security model forbids execution trough reflection of methods not visible from the calling code. - * Even if the method being called is not in a platform assembly. For non moonlight CoreCLR users this restriction does not - * make a lot of sense, since the author could have just changed the non platform assembly to allow the method to be called. - * This function allows specific relaxations from the default behaviour to be set. - * - * Use \c MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT for the default coreclr coreclr behaviour as used in Moonlight. - * - * Use \c MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_REFLECTION to allow transparent code to execute methods and access - * fields that are not in platformcode, even if those methods and fields are private or otherwise not visible to the calling code. - * - * Use \c MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_DELEGATE to allow delegates to be created that point at methods that are not in - * platformcode even if those methods and fields are private or otherwise not visible to the calling code. - * - */ -void -mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options) { - security_core_clr_options = options; -} - -/** - * mono_security_core_clr_get_options: - * - * Retrieves the current options used by the coreclr system. - */ - -MonoSecurityCoreCLROptions -mono_security_core_clr_get_options () -{ - return security_core_clr_options; -} - -/* - * default_platform_check: - * - * Default platform check. Always TRUE for current corlib (minimum - * trust-able subset) otherwise return FALSE. Any real CoreCLR host - * should provide its own callback to define platform code (i.e. - * this default is meant for test only). - */ -static gboolean -default_platform_check (const char *image_name) -{ - if (mono_defaults.corlib) { - return (strcmp (mono_defaults.corlib->name, image_name) == 0); - } else { - /* this can get called even before we load corlib (e.g. the EXE itself) */ - const char *corlib = MONO_ASSEMBLY_CORLIB_NAME ".dll"; - int ilen = strlen (image_name); - int clen = strlen (corlib); - return ((ilen >= clen) && (strcmp (corlib, image_name + ilen - clen) == 0)); - } -} - -static MonoCoreClrPlatformCB platform_callback = default_platform_check; - -/* - * mono_security_core_clr_determine_platform_image: - * - * Call the supplied callback (from mono_security_set_core_clr_platform_callback) - * to determine if this image represents platform code. - */ -gboolean -mono_security_core_clr_determine_platform_image (MonoImage *image) -{ - return platform_callback (image->name); -} - -/* - * mono_security_set_core_clr_platform_callback: - * - * Set the callback function that will be used to determine if an image - * is part, or not, of the platform code. - */ -void -mono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback) -{ - platform_callback = callback; -} - -/* - * mono_security_core_clr_is_platform_image: - * - * Return the (cached) boolean value indicating if this image represent platform code - */ -gboolean -mono_security_core_clr_is_platform_image (MonoImage *image) -{ - return image->core_clr_platform_code; -} - -void -mono_security_core_clr_check_inheritance (MonoClass *klass) -{ -} - -void -mono_security_core_clr_check_override (MonoClass *klass, MonoMethod *override, MonoMethod *base) -{ -} - -gboolean -mono_security_core_clr_require_elevated_permissions (void) -{ - return FALSE; -} - -gboolean -mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field, MonoError *error) -{ - error_init (error); - return TRUE; -} - -gboolean -mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method, MonoError *error) -{ - error_init (error); - return TRUE; -} - -gboolean -mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, MonoError *error) -{ - error_init (error); - return TRUE; -} - -MonoException* -mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class) -{ - return NULL; -} - -gboolean -mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed) -{ - return TRUE; -} - -MonoException* -mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field) -{ - return NULL; -} - -MonoException* -mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee) -{ - return NULL; -} - -MonoSecurityCoreCLRLevel -mono_security_core_clr_class_level (MonoClass *klass) -{ - return MONO_SECURITY_CORE_CLR_TRANSPARENT; -} - -MonoSecurityCoreCLRLevel -mono_security_core_clr_field_level (MonoClassField *field, gboolean with_class_level) -{ - return MONO_SECURITY_CORE_CLR_TRANSPARENT; -} - -MonoSecurityCoreCLRLevel -mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level) -{ - return MONO_SECURITY_CORE_CLR_TRANSPARENT; -} - -void -mono_security_enable_core_clr () -{ -} diff --git a/src/mono/mono/metadata/security-core-clr.h b/src/mono/mono/metadata/security-core-clr.h deleted file mode 100644 index f3718aff7363b6..00000000000000 --- a/src/mono/mono/metadata/security-core-clr.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * \file - * CoreCLR security - * - * Author: - * Mark Probst - * - * (C) 2007, 2010 Novell, Inc - */ - -#ifndef _MONO_METADATA_SECURITY_CORE_CLR_H_ -#define _MONO_METADATA_SECURITY_CORE_CLR_H_ - -#include -#include -#include - -typedef enum { - /* We compare these values as integers, so the order must not - be changed. */ - MONO_SECURITY_CORE_CLR_TRANSPARENT = 0, - MONO_SECURITY_CORE_CLR_SAFE_CRITICAL, - MONO_SECURITY_CORE_CLR_CRITICAL -} MonoSecurityCoreCLRLevel; - -typedef enum { - //The following flags can be used in combination, and control specific behaviour of the CoreCLR securit system. - - //Default coreclr behaviour, as used in moonlight. - MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT = 0, - - //Allow transparent code to execute methods and access fields that are not in platformcode, - //even if those methods and fields are private or otherwise not visible to the calling code. - MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_REFLECTION = 1, - - //Allow delegates to be created that point at methods that are not in platformcode, - //even if those methods and fields are private or otherwise not visible to the calling code. - MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_DELEGATE = 2 -} MonoSecurityCoreCLROptions; - -extern gboolean mono_security_core_clr_test; - -extern void mono_security_core_clr_check_inheritance (MonoClass *klass); -extern void mono_security_core_clr_check_override (MonoClass *klass, MonoMethod *override, MonoMethod *base); - -extern gboolean -mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field, MonoError *error); -extern gboolean -mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method, MonoError *error); -extern gboolean mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, MonoError *error); -extern MonoException* mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class); - -extern gboolean mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed); - -extern MonoException* mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field); -extern MonoException* mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee); - -extern MonoSecurityCoreCLRLevel mono_security_core_clr_class_level (MonoClass *klass); -extern MonoSecurityCoreCLRLevel mono_security_core_clr_field_level (MonoClassField *field, gboolean with_class_level); -extern MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level); - -extern gboolean mono_security_core_clr_is_platform_image (MonoImage *image); -extern gboolean mono_security_core_clr_determine_platform_image (MonoImage *image); - -MONO_API gboolean mono_security_core_clr_require_elevated_permissions (void); - -MONO_API void mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options); -MONO_API MonoSecurityCoreCLROptions mono_security_core_clr_get_options (void); - -#endif /* _MONO_METADATA_SECURITY_CORE_CLR_H_ */ diff --git a/src/mono/mono/metadata/security-manager.h b/src/mono/mono/metadata/security-manager.h deleted file mode 100644 index 781c5d7418b3ef..00000000000000 --- a/src/mono/mono/metadata/security-manager.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * \file - * Security Manager - * - * Author: - * Sebastien Pouliot - * - * Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) - * Licensed under the MIT license. See LICENSE file in the project root for full license information. - */ - -#ifndef _MONO_METADATA_SECURITY_MANAGER_H_ -#define _MONO_METADATA_SECURITY_MANAGER_H_ - -#include - -#include "object.h" -#include "metadata-internals.h" -#include "domain-internals.h" -#include "tokentype.h" -#include "threads.h" -#include "marshal.h" -#include "image.h" -#include "reflection.h" -#include "tabledefs.h" -#include - -/* Definitions */ - -#define MONO_ECMA_KEY_LENGTH 16 -#define MONO_PUBLIC_KEY_HEADER_LENGTH 32 -#define MONO_MINIMUM_PUBLIC_KEY_LENGTH 48 -#define MONO_DEFAULT_PUBLIC_KEY_LENGTH 128 - -#define MONO_PUBLIC_KEY_BIT_SIZE(x) ((x - MONO_PUBLIC_KEY_HEADER_LENGTH) << 3) - -typedef enum { - MONO_SECURITY_MODE_NONE, - MONO_SECURITY_MODE_CORE_CLR, -} MonoSecurityMode; - -#endif /* _MONO_METADATA_SECURITY_MANAGER_H_ */ diff --git a/src/mono/mono/metadata/sre.c b/src/mono/mono/metadata/sre.c index 17e49231129ea6..0ad6b51478ed4b 100644 --- a/src/mono/mono/metadata/sre.c +++ b/src/mono/mono/metadata/sre.c @@ -31,8 +31,6 @@ #include "mono/metadata/reflection-cache.h" #include "mono/metadata/sre-internals.h" #include "mono/metadata/custom-attrs-internals.h" -#include "mono/metadata/security-manager.h" -#include "mono/metadata/security-core-clr.h" #include "mono/metadata/tabledefs.h" #include "mono/metadata/tokentype.h" #include "mono/metadata/abi-details.h" diff --git a/src/mono/mono/metadata/verify.c b/src/mono/mono/metadata/verify.c index 05fedca5a9d832..8c9353e21caa31 100644 --- a/src/mono/mono/metadata/verify.c +++ b/src/mono/mono/metadata/verify.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/mono/mono/mini/driver.c b/src/mono/mono/mini/driver.c index 3e7a07c17c674a..8a6f3099fe462a 100644 --- a/src/mono/mono/mini/driver.c +++ b/src/mono/mono/mini/driver.c @@ -42,8 +42,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/mono/mono/mini/exceptions-amd64.c b/src/mono/mono/mini/exceptions-amd64.c index 93a34be8ed3057..20eb44c8fbdb2b 100644 --- a/src/mono/mono/mini/exceptions-amd64.c +++ b/src/mono/mono/mini/exceptions-amd64.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/src/mono/mono/mini/exceptions-arm.c b/src/mono/mono/mini/exceptions-arm.c index 8c92366be1f45d..146cf26e1e3664 100644 --- a/src/mono/mono/mini/exceptions-arm.c +++ b/src/mono/mono/mini/exceptions-arm.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "mini.h" #include "mini-arm.h" diff --git a/src/mono/mono/mini/exceptions-arm64.c b/src/mono/mono/mini/exceptions-arm64.c index 139534fc44f833..30f0612f4fe88b 100644 --- a/src/mono/mono/mini/exceptions-arm64.c +++ b/src/mono/mono/mini/exceptions-arm64.c @@ -20,6 +20,7 @@ #include #include +#include #include "mono/utils/mono-tls-inline.h" #ifndef DISABLE_JIT diff --git a/src/mono/mono/mini/exceptions-x86.c b/src/mono/mono/mini/exceptions-x86.c index 2476c89fbf99bf..1c451717415c6a 100644 --- a/src/mono/mono/mini/exceptions-x86.c +++ b/src/mono/mono/mini/exceptions-x86.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "mini.h" diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index 84b800d69e6c4b..40e0110fbb58d7 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include "mono/utils/mono-tls-inline.h" diff --git a/src/mono/mono/mini/llvmonly-runtime.c b/src/mono/mono/mini/llvmonly-runtime.c index d457dadfb7feeb..e6979ada04f031 100644 --- a/src/mono/mono/mini/llvmonly-runtime.c +++ b/src/mono/mono/mini/llvmonly-runtime.c @@ -5,6 +5,7 @@ */ #include +#include #include "llvmonly-runtime.h" #include "aot-runtime.h" diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 5d17be0c34a7dc..6b790e59a044a5 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -57,9 +57,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/src/mono/mono/mini/mini-amd64.c b/src/mono/mono/mini/mini-amd64.c index 87c0b175ee6c7a..1404f5e29837f9 100644 --- a/src/mono/mono/mini/mini-amd64.c +++ b/src/mono/mono/mini/mini-amd64.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/mini/mini-arm.c b/src/mono/mono/mini/mini-arm.c index 58c0cef04842e9..a7ce9d77e1aa3f 100644 --- a/src/mono/mono/mini/mini-arm.c +++ b/src/mono/mono/mini/mini-arm.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index a868facb7ff488..217c9d08d32ae8 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "interp/interp.h" diff --git a/src/mono/mono/mini/mini-exceptions.c b/src/mono/mono/mini/mini-exceptions.c index c9e084a0d88699..fa139ec666821f 100644 --- a/src/mono/mono/mini/mini-exceptions.c +++ b/src/mono/mono/mini/mini-exceptions.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index ada72e46a90afd..ed2a605c728233 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/mini/mini-x86.c b/src/mono/mono/mini/mini-x86.c index 5c43d7ae72796f..ea338d4a3b8667 100644 --- a/src/mono/mono/mini/mini-x86.c +++ b/src/mono/mono/mini/mini-x86.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mono/mono/mini/mini.h b/src/mono/mono/mini/mini.h index 5001ee38ddd091..0a7a157ac7c292 100644 --- a/src/mono/mono/mini/mini.h +++ b/src/mono/mono/mini/mini.h @@ -59,7 +59,6 @@ typedef struct SeqPointInfo SeqPointInfo; #include "mono/metadata/tabledefs.h" #include "mono/metadata/marshal.h" -#include "mono/metadata/security-manager.h" #include "mono/metadata/exception.h" #include "mono/metadata/callspec.h" #include "mono/metadata/icall-signatures.h"