mono assertion failure under qemu-arm (ERROR:mini-arm.c:2063:arm_patch_general: assertion failed: (thumb_supported))

Bug #528377 reported by Oliver Grawert
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
mono
Fix Released
Low
mono (Ubuntu)
Fix Released
Undecided
Loïc Minier

Bug Description

Binary package hint: qemu-kvm

trying to install tomboy in a qemu-arm-static chroot on i386 host with the proc filesystem mounted inside the chroot creates the following output:

Setting up libmono-security2.0-cil (2.4.3+dfsg-1ubuntu2) ...
Setting up mono-2.0-gac (2.4.3+dfsg-1ubuntu2) ...
Setting up mono-gac (2.4.3+dfsg-1ubuntu2) ...
* Installing 6 assemblies from libart2.0-cil into Mono
qemu: Unsupported syscall: 242
qemu: Unsupported syscall: 242
**
ERROR:mini-arm.c:2063:arm_patch_general: assertion failed: (thumb_supported)
Stacktrace:

Native stacktrace:

Debug info from gdb:

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

qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)
Use of uninitialized value $_ in scalar chomp at /usr/share/cli-common/runtimes.d/mono line 144.
Use of uninitialized value $fullname in concatenation (.) or string at /usr/share/cli-common/runtimes.d/mono line 113.
qemu: Unsupported syscall: 242
qemu: Unsupported syscall: 242
**

Related branches

Revision history for this message
Oliver Grawert (ogra) wrote :

there was a crash report created in /var/crash but apport seems not to be able to handle it, attaching the .crash file manually here

Revision history for this message
Oliver Grawert (ogra) wrote :
Revision history for this message
Loïc Minier (lool) wrote :

12:13 < lool> The unsupported syscall 242 ones are probably harmless (affinity
              stuff)

I personally get a gdb started by the failure in native code; this results in further warnings from qemu:
12:14 < lool> The unuspported syscall 26 is just a consequence of trying to run
              gdb under qemu-arm, wont work because ptrace() isn't emulated
              (and far from trivial I'm afraid)

but the actual cause is:
ERROR:mini-arm.c:2063:arm_patch_general: assertion failed: (thumb_supported)

The problem is that mono reads /proc/cpuinfo, looking for the Features line, and misses the thumb extension for which it was built.

Revision history for this message
Oliver Grawert (ogra) wrote :
Download full text (3.3 KiB)

not mounting /proc results in the following (indeed still failing, but no segfaults):

Setting up mono-2.0-gac (2.4.3+dfsg-1ubuntu2) ...
Setting up mono-gac (2.4.3+dfsg-1ubuntu2) ...
* Installing 6 assemblies from libart2.0-cil into Mono
E: installing Assembly /usr/lib/cli/art-sharp-2.0/art-sharp.dll failed
E: Installation of libart2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 6 assemblies from libgconf2.0-cil into Mono
E: installing Assembly /usr/lib/cli/gconf-sharp-2.0/gconf-sharp.dll failed
E: Installation of libgconf2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglade2.0-cil into Mono
E: installing Assembly /usr/lib/cli/glade-sharp-2.0/glade-sharp.dll failed
E: Installation of libglade2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglib2.0-cil into Mono
E: installing Assembly /usr/lib/cli/glib-sharp-2.0/glib-sharp.dll failed
E: Installation of libglib2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libgmime2.4-cil into Mono
E: installing Assembly /usr/lib/cli/gmime-sharp-2.4/gmime-sharp.dll failed
E: Installation of libgmime2.4-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 6 assemblies from libgnome-vfs2.0-cil into Mono
E: installing Assembly /usr/lib/cli/gnome-vfs-sharp-2.0/gnome-vfs-sharp.dll failed
E: Installation of libgnome-vfs2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 2 assemblies from libgnome2.24-cil into Mono
E: installing Assembly /usr/lib/cli/gnome-sharp-2.24/gnome-sharp.dll failed
E: Installation of libgnome2.24-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libgnomepanel2.24-cil into Mono
E: installing Assembly /usr/lib/cli/gnome-panel-sharp-2.24/gnome-panel-sharp.dll failed
E: Installation of libgnomepanel2.24-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 5 assemblies from libgtk2.0-cil into Mono
E: installing Assembly /usr/lib/cli/gtk-sharp-2.0/gtk-sharp.dll failed
E: Installation of libgtk2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from liblaunchpad-integration1.0-cil into Mono
E: installing Assembly /usr/lib/cli/launchpad-integration-sharp-1/launchpad-integration-sharp.dll failed
E: Installation of liblaunchpad-integration1.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 3 assemblies from libmono-addins-gui0.2-cil into Mono
E: installing Assembly /usr/lib/cli/Mono.Addins.Gui-0.2/Mono.Addins.Gui.dll failed
E: Installation of libmono-addins-gui0.2-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 7 assemblies from libmono-addins0.2-cil into Mono
E: installing Assembly /usr/lib/cli/Mono.Addins-0.2/Mono.Addins.dll failed
E: Installation of libmono-addins0.2-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libndesk-dbus-glib1.0-cil into Mono
E: installing Assembly /usr/lib/cli/NDesk.DBus.GLib-1.0/NDesk.DBus.GLib.dll failed
E: Installation of libndesk-dbus-glib1.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libndesk-dbus1.0-cil into...

Read more...

Loïc Minier (lool)
summary: - qemu-arm-static fails installing mono assemblies if /proc is mounted in
- the chroot
+ mono assertion failure under qemu-arm (ERROR:mini-
+ arm.c:2063:arm_patch_general: assertion failed: (thumb_supported))
Revision history for this message
Loïc Minier (lool) wrote :

So this is really a qemu bug that it should emulate contents of /proc/cpuinfo, but the cpuinfo parsing in mono wasn't perfect either, it didn't notice it was parsing a non-arm cpuinfo and had IMO bad defaults for the no-cpuinfo case. I'll upload a patch to fix that which helps under qemu-arm.

I filed bug #529008 about lack of /proc/cpuinfo emulation.

Note that the binaries run under mono after the patch changing cpuinfo parsing (fixing this bug) hang on exit; Riku tells me it's related to the boehm gc not working properly under qemu.

affects: qemu-kvm (Ubuntu) → mono (Ubuntu)
Changed in mono (Ubuntu):
assignee: nobody → Loïc Minier (lool)
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mono - 2.4.4~svn151842-1ubuntu2

---------------
mono (2.4.4~svn151842-1ubuntu2) lucid; urgency=low

  * New patch, arm-cpuinfo-parsing, nicer cpuinfo detection, allows running
    mono under qemu-arm; LP: #528377.
 -- Loic Minier <email address hidden> Sat, 27 Feb 2010 15:00:50 +0100

Changed in mono (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
In , Loïc Minier (lool) wrote :

Created an attachment (id=345551)
ARM cpuinfo parsing improvements dpatch

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.9.2) Gecko/20100222 Ubuntu/10.04 (lucid) Firefox/3.6

Hi

The mono ARM JIT implementation reads /proc/cpuinfo to check the family of the ARM CPU it's running on and whether it supports Thumb. When cpuinfo is missing or has data mono can't parse, it assumes non-thumb and <= ARMv4, and if you urn some thumb code, it triggers an assertion failure.

/proc/cpuinfo is typically missing in chroots if you don't mount /proc, and might have bogus data when using qemu-arm syscall emulation; the latter is clearly a qemu bug, but I think it makes sense to improve the cpudetection routine to handle the case where the data doesn't seem like it's an ARM CPU. The parsing is relatively weak in that it looks for "(v" in the Processor line and uses the digit after that to decide of the ARM family.

I'd like to propose merging the attached patch.

One important thing to keep in mind is that families older than ARMv4 (and in fact even some ARMv4 families) aren't supported anymore and all ARMv5 and later families have Thumb. So I believe the only case where we care that Thumb might not be enabled is when Processor is ARMv4 and Features lacks "thumb".

Thanks,

Reproducible: Always

Revision history for this message
In , Loïc Minier (lool) wrote :

See https://bugs.launchpad.net/ubuntu/+source/mono/+bug/528377 and https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/529008 for the bug related to mono cpuinfo parsing under qemu-arm, and qemu's lack of cpuinfo emulation (which is the qemu bug I mention earlier).

Revision history for this message
In , Loïc Minier (lool) wrote :

NB: Hardware platform field lacks "ARM".

Also note that mono apps such as a basic hello world don't fully work after the patch: they will run correctly, but hang on exit, it seems to be a deadlock in the boehm garbage collector which is apparently a known qemu + boehm-gc bug. So Hello World prints "Hello World" and then hangs in sleep(), futex() and futex(). Anyway, that's for another bug.

Revision history for this message
In , Lupus-novell (lupus-novell) wrote :

Introducing the MAYBE value and defaulting to armv5+ blindly is not acceptable.
A patch that detects the broken qemu behaviour and in that cases enables armv5 and thumb would be ok.

Revision history for this message
In , Loïc Minier (lool) wrote :

Well it would be much easier to just assume whatever mono was built against, that is if mono was built for armv5 or armv4 or armv4 + thumb, assume that.

Would this be acceptable?

I don't quite see how to get optimal defaults if /proc/cpuinfo is missing -- SIGILL not being thread-safe.

Revision history for this message
In , Lupus-novell (lupus-novell) wrote :

It's not acceptable to default to the cpu on the build host.
Mono is going to need /proc also for other things on Linux, so it's a bit futile to break mono on other setups to try and avoid it.
As I said, you could check that cpuinfo is for arm and if it isn't, assume it's the broken qemu and that armv5+ is available.
In addition or as an alternative you could allow the flags to e set from an env var, so you can set that when running on a broken system.
Something like:
MONO_CPU_ARCH="armv5 thumb" mono ...

Revision history for this message
In , Loïc Minier (lool) wrote :

I was thinking to default to the *configured* CPU, not necessarily exactly the one on the build host. Do people build Mono on ARMv5 and run it on v4 or vice-versa?

Note that my patch already defaults to thumb + v5 when CPU isn't ARM, but it also defaults to that when cpuinfo is missing, which is probably the part you're objecting against.

I really wonder whether it makes sense to keep supporting ARMv4; I can understand why you'd still want to support ARMv4T a bit longer though.

Revision history for this message
In , Lupus-novell (lupus-novell) wrote :

MONO_CPU_ARCH support is in svn now.

Changed in mono:
status: Unknown → Fix Released
Revision history for this message
Dr. The Fugitive (drbrando007) wrote :
Download full text (6.2 KiB)

running this on a real arm board, snapdragon htc phone
this is a chroot apt-get install ubuntu-netbook. here is the results of my 'kill -SIGINT' for hanging mono processess, this does not appear to be an issue related to kvm, since this has been done outside the virtual machine:

Setting up mono-2.0-gac (2.4.4~svn151842-1ubuntu4) ...
Setting up mono-gac (2.4.4~svn151842-1ubuntu4) ...
* Installing 6 assemblies from libart2.0-cil into Mono
E: Installation of libart2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libflickrnet2.2-cil into Mono
E: Installation of libflickrnet2.2-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 6 assemblies from libgconf2.0-cil into Mono
Use of uninitialized value $_ in scalar chomp at /usr/share/cli-common/runtimes.d/mono line 144.
Use of uninitialized value $fullname in concatenation (.) or string at /usr/share/cli-common/runtimes.d/mono line 113.
E: installing Assembly /usr/lib/cli/gconf-sharp-2.0/gconf-sharp.dll failed
E: Installation of libgconf2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglade2.0-cil into Mono
E: Installation of libglade2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libglib2.0-cil into Mono
Use of uninitialized value $_ in scalar chomp at /usr/share/cli-common/runtimes.d/mono line 144.
Use of uninitialized value $fullname in concatenation (.) or string at /usr/share/cli-common/runtimes.d/mono line 113.
E: installing Assembly /usr/lib/cli/glib-sharp-2.0/glib-sharp.dll failed
E: Installation of libglib2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libgmime2.4-cil into Mono
E: Installation of libgmime2.4-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libgnome-keyring1.0-cil into Mono
E: Installation of libgnome-keyring1.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 6 assemblies from libgnome-vfs2.0-cil into Mono
Use of uninitialized value $_ in scalar chomp at /usr/share/cli-common/runtimes.d/mono line 144.
Use of uninitialized value $fullname in concatenation (.) or string at /usr/share/cli-common/runtimes.d/mono line 113.
E: installing Assembly /usr/lib/cli/gnome-vfs-sharp-2.0/gnome-vfs-sharp.dll failed
E: Installation of libgnome-vfs2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 2 assemblies from libgnome2.24-cil into Mono
E: Installation of libgnome2.24-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from libgnomepanel2.24-cil into Mono
E: Installation of libgnomepanel2.24-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 5 assemblies from libgtk2.0-cil into Mono
E: Installation of libgtk2.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 1 assembly from liblaunchpad-integration1.0-cil into Mono
E: Installation of liblaunchpad-integration1.0-cil with /usr/share/cli-common/runtimes.d/mono failed
* Installing 3 assemblies from libmono-addins-gui0.2-cil into Mono
Use of uninitialized value $_ in scalar chomp at /usr/share/cli-common/runtimes.d/mono line 144.
Use of unini...

Read more...

Revision history for this message
Oliver Grawert (ogra) wrote :

this seems to be an issue with your board, on the supported ubuntu architectures native installation of mono packages works fine (there are surely plenty issues with applications, but the breakage you describe above observed in VMs yet) all our images build fine and install the mono dependencies without problems on omap (lucid-natty), imx51(jaunty-lucid), dove (jaunty-maverick) and omap4 (maverick-natty) platforms.

Revision history for this message
AdamOutler (adamoutler) wrote :

No sir. This is a problem with the armel versions

Linux adam-desktop 2.6.35-26-generic #46-Ubuntu SMP Sun Jan 30 06:59:07 UTC 2011 armv5tel GNU/Linux

qemu.

Changed in mono:
importance: Unknown → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.