From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 4 18:11:15 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61DEDC38 for ; Fri, 4 Apr 2014 18:11:15 +0000 (UTC) Received: from mail.ignoranthack.me (ujvl.x.rootbsd.net [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C92BE3A for ; Fri, 4 Apr 2014 18:11:14 +0000 (UTC) Received: from [10.73.160.242] (nat-dip7.cfw-a-gci.corp.yahoo.com [209.131.62.116]) (using SSLv3 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id DE0BA1929C8 for ; Fri, 4 Apr 2014 18:11:06 +0000 (UTC) Subject: Re: qemu-mips illegal instruction From: Sean Bruno To: "freebsd-hackers@freebsd.org" In-Reply-To: <1396029630.1466.21.camel@powernoodle.corp.yahoo.com> References: <1395337352.7757.11.camel@powernoodle.corp.yahoo.com> <1395599440.67694.13.camel@powernoodle.corp.yahoo.com> <1396029630.1466.21.camel@powernoodle.corp.yahoo.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-TKwQPkcCrvMPR6OYpqV3" Date: Fri, 04 Apr 2014 11:11:06 -0700 Message-ID: <1396635066.1475.25.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: sbruno@freebsd.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Apr 2014 18:11:15 -0000 --=-TKwQPkcCrvMPR6OYpqV3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2014-03-28 at 11:00 -0700, Sean Bruno wrote: > > This problem seems to be caused by a endian issue in qemu-mips. Ed > > Maste found the culprit and I've applied it here: > >=20 > > https://github.com/seanbruno/qemu/commit/05ee8495804599b52a88eb36b13ea9= c06b3207cd > >=20 > > Which is my combined tracking branch for qemu and sson's bsd-user > > branch. > >=20 > > I'm currently tracking an "illegal instruction" on exit issue that seem= s > > to happen on application exit causing a crash. > >=20 > > sean >=20 >=20 > I've been tracking qemu upstream with sson's patches and massaging > things here and there with the bsd-user mode qemu. >=20 > https://github.com/seanbruno/qemu/tree/bsd-user >=20 > That in combination with sson's kernelmod/userland tool allows me to > "chroot" into a mips environment suitable for building packages. > http://people.freebsd.org/~sson/imgact_binmisc/imgact_binmisc.diff >=20 > Currently, if I explicitly pass a shell into the chroot command, I have > no issues and all is well. e.g. chroot /mipsbuild /bin/sh >=20 > If I do not explicitly pass a shell, I get an illegal instruction core > dump from qemu-mips on exit from any command I run in the chroot: >=20 > chroot /mipsbuild > uname -a > > (Illegal Instruction)[coredump] >=20 > This breaks poudriere right now. >=20 >=20 > More or less this is my recipe: > - built a mips32 world for "chroot" purposes: > - use sson's binmisc ELF interceptor thing: > - run binmiscctl: > binmiscctl add mips32 --interpreter "/bin/qemu-mips" --magic "\x7f\x45 > \x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00 > \x08" --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff > \xff\xff\xff\xfe\xff\xff" --size 20 --set-enabled >=20 >=20 > - chroot /mipsbuild > - uname -a (Illegal Instruction and coredump ON EXIT) >=20 > - chroot /mipsbuild /bin/sh > - uname -a (works everytime) >=20 >=20 > sean I've narrowed this down with some help from #bsdmips: env SHELL=3D/bin/sh chroot /mipsbuild --> no issues running commands env SHELL=3D/bin/csh chroot /mipsbuild env SHELL=3D/bin/tcsh chroot /mipsbuild --> both of these cause illegal instructions in qemu-mips Juregen came up with a patch that makes the amd64 version of qemu-mips work, so there's no need to xbuild the i386 version now, so thanks for that! sean ref https://github.com/seanbruno/qemu/tree/bsd-user --=-TKwQPkcCrvMPR6OYpqV3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJTPvW5AAoJEBkJRdwI6BaHqewIAI2sfsCFvNKBnVo4mCM/y58E /wxrzbjf5lJYSuuwl02garPurXT4SJf9uXEGnTX4ViTZ0sqfPprNYJ4g0KrywHKa wm9B2G0ER7x8dCFVlc6/lcCCtNYYJC6BQf09FVQwkejRLCr16GuFyO8aId9l2aFP QcJLBcAfl7hvKSm9DkNsrpSGSxN9v/TVF0hHrvyl1AelUwvnw2xqkmt7zALH9YIF FbEiDkyrwgueXdhjb0wHqXgQGyljyJFmF2mjgO9SrunnF3/ZGhLHgpufiXNOacCU shKYVGZSzI34E++quOnYlE5kWy4y+NGE++Ah8YiAqX37MXbnj/kxDpKvlYGSR6g= =iPki -----END PGP SIGNATURE----- --=-TKwQPkcCrvMPR6OYpqV3--