[Mono-bugs] [Bug 561737] sigsegv in mono_compile_create_var while JITting a verified method

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Dec 13 12:58:12 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=561737

http://bugzilla.novell.com/show_bug.cgi?id=561737#c1


--- Comment #1 from Sebastien Pouliot <spouliot at novell.com> 2009-12-13 17:58:09 UTC ---
Changing the macro into a function (that deals with the NULL return value) fix
this issue but crash a bit later

Index: mini/mini.c
===================================================================
--- mini/mini.c    (revision 148335)
+++ mini/mini.c    (working copy)
@@ -861,7 +861,17 @@
     cfg->vreg_to_inst [vreg] = inst;
 }

-#define mono_type_is_long(type) (!(type)->byref &&
((mono_type_get_underlying_type (type)->type == MONO_TYPE_I8) ||
(mono_type_get_underlying_type (type)->type == MONO_TYPE_U8)))
+static gboolean
+mono_type_is_long (MonoType *type)
+{
+    if (type->byref) {
+        return FALSE;
+    } else {
+        MonoType *utype = mono_type_get_underlying_type (type);
+        return (utype && ((utype->type == MONO_TYPE_I8) || (utype->type ==
MONO_TYPE_U8)));
+    }
+}
+
 #define mono_type_is_float(type) (!(type)->byref && (((type)->type ==
MONO_TYPE_R8) || ((type)->type == MONO_TYPE_R4)))

 #ifdef DISABLE_JIT


Again I'm not sure if the above patch is needed. It would be better to ensure,
at verification time, that no usable type can result in having a NULL value
returned by mono_type_get_underlying_type



** (process:887): WARNING **: The class System.Text.RegularExpressions.Position
could not be loaded, used in System, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e
Compilation of System.Text.RegularExpressions.Interpreter:Reset () failed with
exception 'Could not load type .RepeatContext at 0x0000':
[Switching to Thread 0xb751db90 (LWP 890)]

Breakpoint 1, type_to_eval_stack_type (cfg=0x835dd00, type=0x836b628,
inst=0x837dd2c) at method-to-ir.c:612
612        g_warning ("MONO_TYPE_VALUETYPE");
(gdb) p type->data.klass->name
$1 = 0xb7bd034a "Position"
(gdb) p type->data.klass->name_space
$2 = 0xb7bd01b9 "System.Text.RegularExpressions"
(gdb) c
Continuing.

** (process:887): WARNING **: MONO_TYPE_VALUETYPE

Program received signal SIGSEGV, Segmentation fault.
0x080683ba in type_to_eval_stack_type (cfg=0x835dd00, type=0x0, inst=0x837dd2c)
at method-to-ir.c:573
573        switch (type->type) {

The problem is that System.Text.RegularExpressions.Position could not been
loaded (see WARNING) but it's used in another method and the verifier did not
catch that.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list