Skip to contentSkip to conversation

bug in ARM thumb usermode emulation

Qemu-devel Rafael Espíndola 2 participants 6 messages Sep 18, 2006 – Sep 29, 2006

lore
Share & tools
lore
#0 lore raw

Running python 2.4 in qemu sometimes causes this assert

Inconsistency detected by ld.so: rtld.c: 288: _dl_start_final:
Assertion `info->l.l_tls_modid == 0' failed!

The same error is present in all versions tested (0.8.1, 0.8.2 and CVS).

I have been able to create a "small" ARM chroot that contais a test program and python 2.4. It is available at
http://www.maemo.org.br/platform/rafael/qemu-bug.tar.bz2

The test program sets some environment variables and execs python. The test can be run with

sudo chroot bug/ ./test

An equivalent test program that skips qemu runs correctly in a real ARM device, so I thing that the bug is really in qemu.

The bug is very dependent on the environment variables and argv. Small changes can hide the bug.

Do you have any suggestions on how to debug this?

Thanks,
Rafael

#1 lore raw
Quoted 4 lines · Rafael Espíndola

Running python 2.4 in qemu sometimes causes this assert

Inconsistency detected by ld.so: rtld.c: 288: _dl_start_final:
Assertion `info->l.l_tls_modid == 0' failed!

TLS and multithreaded applications are known to not work with usermode emulation.

Paul

#2 lore raw
Quoted 2 lines

TLS and multithreaded applications are known to not work with usermode emulation.

We use python for compiling python modules inside scratchbox. So I need to fix this or find a workaround (undef Py_HAVE_NATIVE_TLS?).

What must be done for implementing TLS + multithread in qemu? Maybe I can help.

Quoted 2 lines

Paul

Thanks,
Rafael

#3 lore raw
Quoted 2 lines

What must be done for implementing TLS + multithread in qemu? Maybe I can help.

* Implement the TLS syscalls (futexes and the architecture specific bits). There's a patch for clone() here: https://nowt.dyndns.org/patch.qemu_nptl
* Fix all the bits of qemu that aren't threadsafe (mainly the TB cache IIRC).
* Fix guest atomic operations, and make sure guest coherency/ordering guaranteed are honoured, even which not guaranteed natively by the host.

Note that this only applies to usermode emulation. Full system emulation works fine because this is all handled by the guest kernel, exactly the same as on real hardware.

Paul

#4 lore raw
In reply to Paul Brook
Quoted 2 lines · Paul Brook

TLS and multithreaded applications are known to not work with usermode emulation.

It looks like this is a memory corruption problem and the assert that fails is just a coincidence!

I started to remove code from python to find what triggers the assert. I ended up with an empty main linked only with libc!

I new version of the chroot is available at
http://www.maemo.org.br/platform/rafael/qemu-bug.tar.bz2

Any ideas on how to debug this?

Quoted 1 line

Paul

Thanks,
Rafael