From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 6 02:59:16 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30527CB for ; Sun, 6 Apr 2014 02:59:16 +0000 (UTC) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 003C2AC5 for ; Sun, 6 Apr 2014 02:59:15 +0000 (UTC) Received: by mail-pd0-f182.google.com with SMTP id y10so5003683pdj.41 for ; Sat, 05 Apr 2014 19:59:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=X1MojKbovfYqN5u8CiurO61nINuZuWoJ36WketBqrUc=; b=QWc8bixVOOdaqU8oGHdEB+XQlBKJt3OVtUVBIKKfwxFdo6gM2RIjX7STAniPMZddSv xvkxfN1/TbkqY1QVDibeeL3AlfroiVfeW8ukYkX5CRhYEMVTcmF+xbIP9tgQtqE0fZbP JEk0AdCKgp1/44EumOuM70oCU3GSTu/7oe+ms6fZF/1QerdCB9kKKebk2yGBTywJXVf9 weIoIrOxeqqAdqXLyNtKEEsJpJFvuuRi3asttAer8WNP0IvhdtrFFfxrL+CmBMQlJ/Sy XJ6hE/DMZqfHTJ6f+F9j6yWWj+Hw/OVi6DWs1Gww1UIr9JucnqGpX80HF+Y3dN73HUkz vObQ== X-Gm-Message-State: ALoCoQlKahuItrvnqALaRfg30JKu7J3FY3EwSjl9RGPFCj+emkGgcMV1REmcytgofOtSZkaf4pz+ X-Received: by 10.66.139.70 with SMTP id qw6mr370705pab.111.1396753149344; Sat, 05 Apr 2014 19:59:09 -0700 (PDT) Received: from lgmac-josharris.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id xz7sm64125943pac.3.2014.04.05.19.59.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Apr 2014 19:59:08 -0700 (PDT) Sender: Warner Losh Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: qemu-mips illegal instruction From: Warner Losh In-Reply-To: <1396651226.1475.41.camel@powernoodle.corp.yahoo.com> Date: Sat, 5 Apr 2014 20:59:06 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: 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> <1396635066.1475.25.camel@powernoodle.corp.yahoo.com> <1396651226.1475.41.camel@powernoodle.corp.yahoo.com> To: sbruno@freebsd.org X-Mailer: Apple Mail (2.1874) Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Apr 2014 02:59:16 -0000 On Apr 4, 2014, at 4:40 PM, Sean Bruno wrote: > On Fri, 2014-04-04 at 11:11 -0700, Sean Bruno wrote: >> 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/05ee8495804599b52a88eb36b13ea9c06= b3207cd >>>>=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 = seems >>>> 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 >>=20 >> I've narrowed this down with some help from #bsdmips: >>=20 >> env SHELL=3D/bin/sh chroot /mipsbuild --> no issues running commands >>=20 >> env SHELL=3D/bin/csh chroot /mipsbuild >> env SHELL=3D/bin/tcsh chroot /mipsbuild --> both of these cause = illegal >> instructions in qemu-mips >>=20 >> 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! >>=20 >> sean >>=20 >> ref https://github.com/seanbruno/qemu/tree/bsd-user >>=20 >>=20 >=20 >=20 > And finally, thanks to peter, we have a 1bit change for 32bit mips = that > seems to work. >=20 > = https://github.com/seanbruno/qemu/commit/d62553b108aa27c0c020dbb771d29f867= 3807a3b >=20 >=20 > Doing a test run now. this might mean that 32bit mips packages might > exist this weekend in some form. Doesn=92t that daddu turn into a simple addu with that bit change? Warner=