Bug 1897 - Invoke on Address methods of array types causes abort
Summary: Invoke on Address methods of array types causes abort
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-11-05 16:27 UTC by stefanor
Modified: 2011-12-22 19:15 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description stefanor 2011-11-05 16:27:34 UTC
stefan@stefans:/tmp$ cat MonoBug1105.cs
public class MonoBug1105 {
    public static void Main(string[] args) {
        var mi = typeof(string[]).GetMethod("Address");
        mi.Invoke(new string[5], new object[] { (int)2 });
    }
}
stefan@stefans:/tmp$ mcs MonoBug1105.cs
stefan@stefans:/tmp$ mono MonoBug1105.exe
* Assertion: should not be reached at marshal.c:4334

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
  at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x00150>
  at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002f>
  at MonoBug1105.Main (string[]) <0x000a7>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	mono() [0x80e6293]
	[0xb773e40c]
	[0xb773e424]
	/lib/i386-linux-gnu/i686/cmov/libc.so.6(gsignal+0x51) [0xb75a2911]
	/lib/i386-linux-gnu/i686/cmov/libc.so.6(abort+0x182) [0xb75a5d42]
	mono() [0x823136d]

Debug info from gdb:

Mono support loaded.
[Thread debugging using libthread_db enabled]
[New Thread 0xb6a4db70 (LWP 17859)]
0xb773e424 in __kernel_vsyscall ()
  2 Thread 0xb6a4db70 (LWP 17859)  0xb773e424 in __kernel_vsyscall ()
* 1 Thread 0xb7577b60 (LWP 17858)  0xb773e424 in __kernel_vsyscall ()

Thread 2 (Thread 0xb6a4db70 (LWP 17859)):
#0  0xb773e424 in __kernel_vsyscall ()
#1  0xb76de655 in sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:80
#2  0x0821e1e8 in mono_sem_wait (sem=0x835a444, alertable=1) at mono-semaphore.c:113
#3  0x081d535c in finalizer_thread (unused=0x0) at gc.c:1073
#4  0x081b9ccd in start_wrapper_internal (data=0x9880940) at threads.c:571
#5  start_wrapper (data=0x9880940) at threads.c:619
#6  0x0820f84a in thread_start_routine (args=0x9873344) at wthreads.c:290
#7  0x082275f7 in inner_start_thread (arg=0x9880b40) at mono-threads-posix.c:49
#8  0x0823af3c in GC_start_routine (arg=0x61fe0) at pthread_support.c:1473
#9  0xb76d7c39 in start_thread (arg=0xb6a4db70) at pthread_create.c:304
#10 0xb764496e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb7577b60 (LWP 17858)):
#0  0xb773e424 in __kernel_vsyscall ()
#1  0xb76df33b in read () at ../sysdeps/unix/syscall-template.S:82
#2  0x080e6447 in mono_handle_native_sigsegv (signal=6, ctx=0xbfb817ac) at mini-exceptions.c:2256
#3  <signal handler called>
#4  0xb773e424 in __kernel_vsyscall ()
#5  0xb75a2911 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#6  0xb75a5d42 in abort () at abort.c:92
#7  0x0823136d in monoeg_g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, format=0x824f374 "* Assertion: should not be reached at %s:%d\n", args=0xbfb81c44 "\270\366*\b\356\020") at goutput.c:136
#8  0x082313f3 in monoeg_assertion_message (format=0x824f374 "* Assertion: should not be reached at %s:%d\n") at goutput.c:156
#9  0x081852b1 in emit_invoke_call (mb=0x985adc0, method="System.String[]:Address ()", sig=<value optimized out>, callsig=0x9889a7c, loc_res=0, virtual=0, need_direct_wrapper=1) at marshal.c:4334
#10 0x081897f1 in emit_runtime_invoke_body (method="System.String[]:Address ()", virtual=0) at marshal.c:4441
#11 mono_marshal_get_runtime_invoke (method="System.String[]:Address ()", virtual=0) at marshal.c:4630
#12 0x080671c8 in mono_jit_runtime_invoke (method="System.String[]:Address ()", obj=0x35eb0, params=0xbfb81dc0, exc=0x0) at mini.c:5599
#13 0x081e762f in mono_runtime_invoke (method="System.String[]:Address ()", obj=0x35eb0, params=0xbfb81dc0, exc=0x0) at object.c:2779
#14 0x081eb7a4 in mono_runtime_invoke_array (method="System.String[]:Address ()", obj=0x35eb0, params=0x57f48, exc=0x0) at object.c:4174
#15 0x0813fb75 in ves_icall_InternalInvoke (method=0x3cfa8, this=0x35eb0, params=0x57f48, exc=0xbfb81ee0) at icall.c:2869
#16 0xb6ac1798 in ?? ()
#17 0xb6c2a561 in System.Reflection.MonoMethod:Invoke (this=..., obj=string [5], invokeAttr=Default, binder=..., parameters=System.Object [1], culture=...) at /usr/local/src/monogit/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:226
#18 0xb6c235d0 in System.Reflection.MethodBase:Invoke (this=..., obj=string [5], parameters=System.Object [1]) at /usr/local/src/monogit/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:101
#19 0xb6ac0d88 in ?? ()
#20 0xb6ac0e2f in ?? ()
#21 0x080670ac in mono_jit_runtime_invoke (method="MonoBug1105:Main ()", obj=0x0, params=0xbfb8204c, exc=0x0) at mini.c:5778
#22 0x081e762f in mono_runtime_invoke (method="MonoBug1105:Main ()", obj=0x0, params=0xbfb8204c, exc=0x0) at object.c:2779
#23 0x081ea556 in mono_runtime_exec_main (method="MonoBug1105:Main ()", args=0x3be00, exc=0x0) at object.c:3970
#24 0x080bf55b in main_thread_handler (argc=2, argv=0xbfb82224) at driver.c:1003
#25 mono_main (argc=2, argv=0xbfb82224) at driver.c:1876
#26 0x0805bd8f in mono_main_with_options (argc=2, argv=0xbfb82224) at main.c:66
#27 main (argc=2, argv=0xbfb82224) at main.c:97

=================================================================
Got a SIGABRT 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)

stefan@stefans:/tmp$ mono --version
Mono JIT compiler version 2.11 (master/233950b Mon Oct 31 23:09:25 PDT 2011)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
Comment 1 Alex Rønne Petersen 2011-11-06 09:51:56 UTC
Fixed in master.