From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56511 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4KjW-0002rt-5P for qemu-devel@nongnu.org; Mon, 28 Mar 2011 18:16:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4Kj4-0000q4-7d for qemu-devel@nongnu.org; Mon, 28 Mar 2011 18:15:55 -0400 Received: from adelie.canonical.com ([91.189.90.139]:47131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4Kj3-0000q0-Tc for qemu-devel@nongnu.org; Mon, 28 Mar 2011 18:15:54 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q4Kj3-0005oR-8b for ; Mon, 28 Mar 2011 22:15:53 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 3CD0A2EA01D for ; Mon, 28 Mar 2011 22:15:53 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 28 Mar 2011 22:09:47 -0000 From: Peter Maydell Sender: bounces@canonical.com References: <20110321222037.3067.75336.malonedeb@soybean.canonical.com> <20110328201341.17808.47873.malone@wampee.canonical.com> Message-Id: Errors-To: bounces@canonical.com Subject: [Qemu-devel] Re: [Bug 739785] Re: qemu-i386 on ARM bash: fork: Invalid argument Reply-To: Bug 739785 <739785@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 28 March 2011 21:13, moonman <739785@bugs.launchpad.net> wrote: > Hello, > > [root@Plugbox ~]# strace -ff -o ls-strace.log chroot /i386 /usr/bin/qemu-= i386 /bin/ls > b? =C2=A0 d? =C2=A0 =C2=A0e? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0l? = =C2=A0mu-e386i =C2=A0ome =C2=A0oot =C2=A0roc =C2=A0s? =C2=A0u? > bin =C2=A0diae =C2=A0hlrc.tin.gar =C2=A0m? =C2=A0o? =C2=A0 =C2=A0 =C2=A0 = =C2=A0oot =C2=A0q =C2=A0 =C2=A0s? =C2=A0 t? =C2=A0v? > > [root@Plugbox ~]# strace -ff -o bash-strace.log chroot /i386 /usr/bin/qem= u-i386 /bin/bash -c /bin/ls > /bin/bash: /bin/: %snnca eotcuxe btearinfiy Something odd is going on here... Excerpts from the strace: readlink("roc/self/f", 0x81abf80, 4095) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn_UF.UT!\304\27\10P\254\32\10\267\304\27\10\20= /LC_IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn_UF.ut/LC_IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn_UF/LC_IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn.UT!\304\27\10P\254\32\10\267\304\27\10\20/LC= _IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn.ut/LC_IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) open("/0):/usr/libalo/eNG=3DSn/LC_IDENTIFICATION", O_RDONLY|O_LARGEFILE) =3D -1 ENOENT (No such file or directory) write(2, "/bin/bash: /bin/: %snnca eotcuxe"..., 47) =3D 47 That's clearly an attempt to open something in /proc/self, something in /usr/lib/locale/, and to print a "cannot execute" message, but everything's got rather twisted. Swap every two pairs of bytes (or equivalently, rotate sets of four characters by two) in this: : %snnca eotcuxe ...and as if by magic, something comprehensible appears: %s: cannot execu Now, running x86 binaries on an ARM host does work for me, but I've only tested on a Cortex-A8 (ARMv7) host. I think that what's happening here is that qemu is doing unaligned accesses. On ARMv7 unaligned accesses "work", ie you get the word you asked for. On ARMv5 the effect is that the unaligned address is rounded down to a multiple of four, we load 32 bits and then rotate them -- so you get the effects you see above. Short answer: looks like QEMU doesn't currently work on ARMv5 hosts (although ARMv7 are fine). I'll look into this if I can manage to scare up some suitable hardware. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/739785 Title: qemu-i386 user mode on ARMv5 host fails (bash: fork: Invalid argument) Status in QEMU: New Bug description: Good time of day everybody, I have been trying to make usermode qemu on ARM with plugapps (archlinux) with archlinux i386 chroot to work. 1. I installed arch linux in a virtuabox and created a chroot for it with= mkarchroot. Transferred it to my pogo plug into /i386/ 2. I comiled qemu-i386 static and put it into /i386/usr/bin/ ./configure --static --disable-blobs --disable-system --target-list=3Di38= 6-linux-user make 3. I also compiled linux kernel 2.6.38 with CONFIG_BINFMT_MISC=3Dy and in= stalled it. uname -a Linux Plugbox 2.6.38 #4 PREEMPT Fri Mar 18 22:19:10 CDT 2011 armv5tel Fer= oceon 88FR131 rev 1 (v5l) Marvell SheevaPlug Reference Board GNU/Linux 4. Added the following options into /etc/rc.local /sbin/modprobe binfmt_misc /bin/mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc echo ':qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x= 00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff= \xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386:' >/proc/sys/fs/binfmt_misc/reg= ister 5. Also copied ld-linux.so.3 (actually ld-2.13.so because ld- linux.so.3 is a link to that file) from /lib/ to /i386/lib/ 6.Now i chroot into /i386 and I get this: [root@Plugbox i386]# chroot . [II aI hnve ao n@P /]# pacman -Suy bash: fork: Invalid argument 7.I also downloaded linux-user-test-0.3 from qemu website and ran the tes= t: [root@Plugbox linux-user-test-0.3]# make ./qemu-linux-user.sh [qemu-i386] ../qemu-0.14.0/i386-linux-user/qemu-i386 -L ./gnemul/qemu-i386 i386/ls -l= dummyfile BUG IN DYNAMIC LINKER ld.so: dl-version.c: 210: _dl_check_map_versions: A= ssertion `needed !=3D ((void *)0)' failed! make: *** [test] Error 127