[Mono-bugs] [Bug 696817] New: Reflection Emit does not pin RVA data

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun May 29 03:38:12 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=696817

https://bugzilla.novell.com/show_bug.cgi?id=696817#c0


           Summary: Reflection Emit does not pin RVA data
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: stefanor at cox.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=432002)
 --> (http://bugzilla.novell.com/attachment.cgi?id=432002)
Code to demonstrate the problem

Description of Problem:

When a dynamic assembly is created, any fields defined using
DefineInitializedData have their data stored as a byte[] object.  Additionally,
once CreateType is called, typebuilder_setup_fields saves a pointer to the data
as a const char * in a MonoFieldDefaultValue struct.  However, the garbage
collector does not know about this reference, and when SGen is used the pointer
can become stale if the garbage collector decides to move the byte[].

(Note that the pointer can also be copied into JITted code, when
InitializeArray is optimized to memcpy.)

Steps to reproduce the problem:

See attached code.

Actual Results:

0

Expected Results:

42

How often does this happen? 

Depends on GC run timing, and whether the GC decides to move the array.

Additional Information:

Observed on 16fc336.

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


More information about the mono-bugs mailing list