[Mono-bugs] [Bug 589940] Mono JIT invokes invalid vtable method on MeeGo

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 19 20:47:55 EDT 2010


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

http://bugzilla.novell.com/show_bug.cgi?id=589940#c6


--- Comment #6 from Miguel de Icaza <miguel at novell.com> 2010-03-20 00:47:54 UTC ---
Ok, some amateur decided to optimize the code in memcmp for SSE3 instructions
and it turns out that memcmp is returning zero, even when it should not.  

The issue is basically that our code tries to share the new computed vtable
with our parent vtable.   We do this in class.c:3904 in method
mono_class_setup_vtable_general:

    /* Try to share the vtable with our parent. */
    if (class->parent && (class->parent->vtable_size == class->vtable_size) &&
(memcmp (class->parent->vtable, vtable, sizeof (gpointer) * class->vtable_size)
== 0)) {
        mono_memory_barrier ();
        class->vtable = class->parent->vtable;
    } else {
        MonoMethod **tmp = mono_image_alloc0 (class->image, sizeof (gpointer) *
class->vtable_size);
        memcpy (tmp, vtable,  sizeof (gpointer) * class->vtable_size);
        mono_memory_barrier ();
        class->vtable = tmp;
    }

And the super-fast SSE3 implementation is so incredibly brilliantly fast, it
returns 0 even when the two vtables are different, we end up sharing the vtable
with the parent.

Replacing this with a professional K&R C-based implementation of memcmp makes
the code work.   Of course, god knows how much other stuff will be subtly
broken by this.

-- 
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