[Mono-bugs] [Bug 678269] New: ModuleBuilder.GetToken causes SIGSEGV

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 9 16:13:24 EST 2011


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

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


           Summary: ModuleBuilder.GetToken causes SIGSEGV
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mapperso at cisco.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=418412)
 --> (http://bugzilla.novell.com/attachment.cgi?id=418412)
Test assemblies and source code

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14)
Gecko/20110301 Fedora/3.6.14-1.fc14 Firefox/3.6.14

Getting the Metadata token in the context of an emit causes a SIGSEGV on 2.10.x
and newer. If you uncomment the line above the emit to pre-read the
MetadataToken, it works around the issue.

This works properly on 2.8.2

Reproducible: Always

Steps to Reproduce:
1.mono GetMetadataToken.exe
2.
3.
Actual Results:  
$ mono GetMetadataToken.exe 
Stacktrace:

  at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.getToken
(System.Reflection.Emit.ModuleBuilder,object,bool) <0xffffffff>
  at System.Reflection.Emit.ModuleBuilder.GetToken
(System.Reflection.MemberInfo,bool) <0x00025>
  at System.Reflection.Emit.ModuleBuilderTokenGenerator.GetToken
(System.Reflection.MemberInfo,bool) <0x0002b>
  at System.Reflection.Emit.ILGenerator.Emit
(System.Reflection.Emit.OpCode,System.Reflection.FieldInfo) <0x0002f>
  at GetMetadataToken.MainClass.Main (string[]) <0x00149>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

    mono() [0x80e17c0]
    mono() [0x812738b]
    mono() [0x805d271]
    [0x4f840c]
    mono() [0x81bb2bd]
    mono() [0x81c4926]
    mono() [0x815e87f]
    [0x7afc5e]
    /opt/mono/lib/mono/4.0/mscorlib.dll.so(+0x178a96) [0xdd1a96]
    /opt/mono/lib/mono/4.0/mscorlib.dll.so(+0x179c0c) [0xdd2c0c]
    /opt/mono/lib/mono/4.0/mscorlib.dll.so(+0x16ef40) [0xdc7f40]
    [0x7ade92]
    [0x7adf9d]
    mono() [0x8061f28]
    mono(mono_runtime_invoke+0x3e) [0x81abc9e]
    mono(mono_runtime_exec_main+0xd8) [0x81aea68]
    mono(mono_main+0x17cf) [0x80bbc1f]
    mono() [0x8056f9e]
    /lib/libc.so.6(__libc_start_main+0xe6) [0x984e36]
    mono() [0x8056df1]

Debug info from gdb:

Mono support loaded.
[Thread debugging using libthread_db enabled]
[New Thread 0xb5bd0b70 (LWP 1562)]
[New Thread 0xb66adb70 (LWP 1561)]
[New Thread 0xb6eaeb70 (LWP 1560)]
[New Thread 0xb76afb70 (LWP 1559)]
0x004f8424 in __kernel_vsyscall ()
  5 Thread 0xb76afb70 (LWP 1559)  0x004f8424 in __kernel_vsyscall ()
  4 Thread 0xb6eaeb70 (LWP 1560)  0x004f8424 in __kernel_vsyscall ()
  3 Thread 0xb66adb70 (LWP 1561)  0x004f8424 in __kernel_vsyscall ()
  2 Thread 0xb5bd0b70 (LWP 1562)  0x004f8424 in __kernel_vsyscall ()
* 1 Thread 0xb78b06e0 (LWP 1558)  0x004f8424 in __kernel_vsyscall ()

Thread 5 (Thread 0xb76afb70 (LWP 1559)):
#0  0x004f8424 in __kernel_vsyscall ()
#1  0x00b0439b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x08230c5a in GC_wait_marker () at pthread_support.c:1863
#3  0x0822b285 in GC_help_marker (my_mark_no=2) at mark.c:1116
#4  0x0822fbea in GC_mark_thread (id=0x0) at pthread_support.c:552
#5  0x00affe99 in start_thread () from /lib/libpthread.so.0
#6  0x00a45d2e in clone () from /lib/libc.so.6

Thread 4 (Thread 0xb6eaeb70 (LWP 1560)):
#0  0x004f8424 in __kernel_vsyscall ()
#1  0x00b0439b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x08230c5a in GC_wait_marker () at pthread_support.c:1863
#3  0x0822b285 in GC_help_marker (my_mark_no=2) at mark.c:1116
#4  0x0822fbea in GC_mark_thread (id=0x1) at pthread_support.c:552
#5  0x00affe99 in start_thread () from /lib/libpthread.so.0
#6  0x00a45d2e in clone () from /lib/libc.so.6

Thread 3 (Thread 0xb66adb70 (LWP 1561)):
#0  0x004f8424 in __kernel_vsyscall ()
#1  0x00b0439b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x08230c5a in GC_wait_marker () at pthread_support.c:1863
#3  0x0822b285 in GC_help_marker (my_mark_no=2) at mark.c:1116
#4  0x0822fbea in GC_mark_thread (id=0x2) at pthread_support.c:552
#5  0x00affe99 in start_thread () from /lib/libpthread.so.0
#6  0x00a45d2e in clone () from /lib/libc.so.6

Thread 2 (Thread 0xb5bd0b70 (LWP 1562)):
#0  0x004f8424 in __kernel_vsyscall ()
#1  0x00b06765 in sem_wait@@GLIBC_2.1 () from /lib/libpthread.so.0
#2  0x08213878 in mono_sem_wait (sem=0x82f6bd8, alertable=1) at
mono-semaphore.c:113
#3  0x0815746e in finalizer_thread (unused=0x0) at gc.c:1072
#4  0x081e0c6e in start_wrapper_internal (data=0x9909bf0) at threads.c:772
#5  start_wrapper (data=0x9909bf0) at threads.c:820
#6  0x0820dd2a in thread_start_routine (args=0x98e4584) at wthreads.c:285
#7  0x082308f7 in GC_start_routine (arg=0x60fe0) at pthread_support.c:1468
#8  0x00affe99 in start_thread () from /lib/libpthread.so.0
#9  0x00a45d2e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb78b06e0 (LWP 1558)):
#0  0x004f8424 in __kernel_vsyscall ()
#1  0x00b073fb in read () from /lib/libpthread.so.0
#2  0x080e1955 in mono_handle_native_sigsegv (signal=11, ctx=0xb78c7d0c) at
mini-exceptions.c:2211
#3  0x0812738b in mono_arch_handle_altstack_exception (sigctx=0xb78c7d0c,
fault_addr=0x7, stack_ovf=0) at exceptions-x86.c:1140
#4  0x0805d271 in mono_sigsegv_signal_handler (_dummy=11, info=0xb78c7c8c,
context=0xb78c7d0c) at mini.c:5852
#5  <signal handler called>
#6  fieldref_encode_signature (assembly=0x72000, field_image=0x991a6d8,
type=0x0) at reflection.c:1677
#7  0x081bb2bd in mono_image_get_fieldref_token (assembly=0x72000, f=0x64fe0,
field=0x991acec) at reflection.c:2750
#8  0x081c4926 in mono_image_create_token (assembly=0x72000, obj=0x64fe0,
create_open_instance=1, register_token=1) at reflection.c:5005
#9  0x0815e87f in ves_icall_ModuleBuilder_getToken (mb=0x69f80, obj=0x64fe0,
create_open_instance=1) at icall.c:1189
#10 0x007afc5e in ?? ()
#11 0x00dd1a96 in System.Reflection.Emit.ModuleBuilder:GetToken (this=...,
member=..., create_open_instance=true) at
/home/mapperso/Projects/mono/mono/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs:680
#12 0x00dd2c0c in System.Reflection.Emit.ModuleBuilderTokenGenerator:GetToken
(this=..., member=..., create_open_instance=true) at
/home/mapperso/Projects/mono/mono/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs:938
#13 0x00dc7f40 in System.Reflection.Emit.ILGenerator:Emit (this=...,
opcode=169049087, field=...) at
/home/mapperso/Projects/mono/mono/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs:552
#14 0x007ade92 in ?? ()
#15 0x007adf9d in ?? ()
#16 0x08061f28 in mono_jit_runtime_invoke
(method="GetMetadataToken.MainClass:Main ()", obj=0x0, params=0xbfdc9e4c,
exc=0x0) at mini.c:5734
#17 0x081abc9e in mono_runtime_invoke (method="GetMetadataToken.MainClass:Main
()", obj=0x0, params=0xbfdc9e4c, exc=0x0) at object.c:2752
#18 0x081aea68 in mono_runtime_exec_main
(method="GetMetadataToken.MainClass:Main ()", args=0x3be00, exc=0x0) at
object.c:3935
#19 0x080bbc1f in main_thread_handler (argc=2, argv=0xbfdca034) at
driver.c:1003
#20 mono_main (argc=2, argv=0xbfdca034) at driver.c:1848
#21 0x08056f9e in mono_main_with_options (argc=2, argv=0xbfdca034) at main.c:66
#22 main (argc=2, argv=0xbfdca034) at main.c:97

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)


Expected Results:  
$ mono GetMetadataToken.exe 
get_MetadataToken succeeded

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