*
* 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.
*
*
* 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.
*
-static GENERATE_GET_CLASS_WITH_CACHE (security_critical, System.Security, SecurityCriticalAttribute)
-static GENERATE_GET_CLASS_WITH_CACHE (security_safe_critical, System.Security, SecuritySafeCriticalAttribute)
+static GENERATE_GET_CLASS_WITH_CACHE (security_critical, "System.Security", "SecurityCriticalAttribute")
+static GENERATE_GET_CLASS_WITH_CACHE (security_safe_critical, "System.Security", "SecuritySafeCriticalAttribute")
{
char *type_name = mono_type_get_full_name (klass);
char *parent_name = mono_type_get_full_name (klass->parent);
{
char *type_name = mono_type_get_full_name (klass);
char *parent_name = mono_type_get_full_name (klass->parent);
- char *message = g_strdup_printf (format, type_name, parent_name);
+ char *message = mono_image_strdup_printf (klass->image, format, type_name, parent_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
- mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+ mono_class_set_type_load_failure (klass, "%s", message);
- char *message = g_strdup_printf (format, method_name, base_name);
+ char *message = mono_image_strdup_printf (override->klass->image, format, method_name, base_name);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
- mono_class_set_failure (override->klass, MONO_EXCEPTION_TYPE_LOAD, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+ mono_class_set_type_load_failure (override->klass, "%s", message);
/* unlike most Invoke* cases InvokeMember is not inside System.Reflection[.Emit] but is SecuritySafeCritical */
if (((*kname == 'T') && (strcmp (kname, "Type") == 0)) ||
/* unlike most Invoke* cases InvokeMember is not inside System.Reflection[.Emit] but is SecuritySafeCritical */
if (((*kname == 'T') && (strcmp (kname, "Type") == 0)) ||
/* if calling InvokeMember then we can't stop the stackwalk here and need to look at the caller */
if (strcmp (m->name, "InvokeMember") == 0)
/* if calling InvokeMember then we can't stop the stackwalk here and need to look at the caller */
if (strcmp (m->name, "InvokeMember") == 0)
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+ mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
MonoMethod *caller = get_reflection_caller ();
/* CoreCLR restrictions applies to Transparent code/caller */
if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
MonoMethod *caller = get_reflection_caller ();
/* CoreCLR restrictions applies to Transparent code/caller */
if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
MonoMethod *caller = get_reflection_caller ();
/* CoreCLR restrictions applies to Transparent code/caller */
if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
MonoMethod *caller = get_reflection_caller ();
/* CoreCLR restrictions applies to Transparent code/caller */
if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
/* note: mscorlib creates delegates to avoid reflection (optimization), we ignore those cases */
if (can_avoid_corlib_reflection_delegate_optimization (method))
/* note: mscorlib creates delegates to avoid reflection (optimization), we ignore those cases */
if (can_avoid_corlib_reflection_delegate_optimization (method))