From owner-freebsd-virtualization@freebsd.org Fri Mar 9 17:45:34 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A4F1F3D215 for ; Fri, 9 Mar 2018 17:45:34 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from mail.physik.tu-berlin.de (mail.physik-pool.tu-berlin.de [130.149.50.25]) (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 041AA8349C for ; Fri, 9 Mar 2018 17:45:33 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from [192.168.119.1] (wlan-141-23-171-244.tubit.tu-berlin.de [141.23.171.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.physik.tu-berlin.de (Postfix) with ESMTPSA id 0407C6206E; Fri, 9 Mar 2018 17:45:32 +0000 (UTC) From: "Fabian Freyer" To: rumpkernel-users@freelists.org Cc: freebsd-virtualization@freebsd.org Subject: Re: rumpkernel and bhyve: triple faults Date: Fri, 09 Mar 2018 18:45:28 +0100 X-Mailer: MailMate (1.10r5443) Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 17:45:34 -0000 This is an OpenPGP/MIME signed message (RFC 3156 and 4880). --=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6 Mar 2018, at 7:45, Fabian Freyer wrote: > Tracking down bios_crtc_base, I find that it=E2=80=99s loaded in > rumprun/platform/hw/arch/amd64/locore.S:70: > > /* save BIOS data area values */ > movw BIOS_COM1_BASE, %bx > movw %bx, bios_com1_base > movw BIOS_CRTC_BASE, %bx > movw %bx, bios_crtc_base > > Where BIOS_CRTC_BASE is 0x463 and BIOS_COM1_BASE is 0x400. Checking the= bhyve > device node in /dev/vmm with xxd(1), I find the words at these addresse= s to be > Uninitialised: > > 00000400: 0000 .. > 00000483: 0000 .. > > I=E2=80=99m not sure where to go from here. Is this a bug in bhyve(4), = should these > values be initialised somehow, or should I patch rumpkernel(7) to skip = this check > when running on bhyve(4)? I=E2=80=99ve chased this bug down a bit further to what I believe is an i= ssue with the rumprun toolchain I am building on FreeBSD with the misc/rumprun port [1]= =2E objdump -t helloer-rumprun.elf list a number of symbols in the *COM* sect= ion, which holds unallocated C external variables [2]: objdump -t helloer-rumprun.elf | grep \*COM\* 00000001 l O *COM* 00000001 pic1mask 00000004 l O *COM* 00000004 pgalloc_totalkb 00000004 l O *COM* 00000004 pgalloc_usedkb 00001000 l O *COM* 00000020 multiboot_cmdline 00000002 l O *COM* 00000002 bios_crtc_base 00000001 l O *COM* 00000001 pic2mask 00000002 l O *COM* 00000002 bios_com1_base As the pagetable in pagetable.s maps the first page as non-present, acces= sing any of these will result in a fault. I=E2=80=99m pretty sure that these shoul= dn=E2=80=99t be undefined. A build on Linux (which boots fine) shows these not to be uninitialised: 00000000003e3480 g O .bss 0000000000000002 bios_com1_base 00000000003e44a0 g O .bss 0000000000000002 bios_crtc_base Further down the rabbit hole, this goes on in rumprun.o: On Linux, bios_crtc_base is not a local symbol: 0000000000000002 O *COM* 0000000000000002 bios_crtc_base 0000000000000002 O *COM* 0000000000000002 bios_com1_base While on FreeBSD, they are marked as local: 0000000000000002 l O *COM* 0000000000000002 bios_crtc_base 0000000000000002 l O *COM* 0000000000000002 bios_com1_base Fabian [1] https://svnweb.freebsd.org/ports/head/misc/rumprun/Makefile?view=3Dma= rkup&pathrev=3D459195 [2] http://man7.org/linux/man-pages/man5/elf.5.html / SHN_COMMON --=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQJWBAEBCgBAFiEEX6JoxdmEemcFacQZmealkcs85+YFAlqiyDgiHGZhYmlhbi5m cmV5ZXJAcGh5c2lrLnR1LWJlcmxpbi5kZQAKCRCZ5qWRyzzn5ve+EAC3okXKpevy pZecEHqzMRZvT69OtLYYADqwUWxUatoXWv+X9jzyYG+L7XGf2w1EJSEAKDbGpYb9 6pLWXk3Yd38HHL1w0nd5UhOynunw/ru9Ka6vtZYJcQHi39UOVdgqIm7s9x/0HmOv /7f25q5eDaBLRYqPFUpwLegJ46UVtCGJu2eN1EyeTifx/yNw0DTQDo96JPY0SPhE jgoX1eTggerv5Rn1O8hhToVibdNBQLcv+9uM1CET5EgWAOwEDcvZAlgpCq+eu3x8 9yEfy5UgIKMa0wgq7aUzqfGxdhLdnE5A2pHyits3TFcev/HXhzsP471Z0lAGDe9z ap+hG2gcCsEwLjA3UmjtGXD2nBO7yI+7l/me/jfKsSGhoyoA1F+PNa9ElUbmKabz wBE0tylxv1CC47r/V/vWcnvszpmIklaYg+on3AYM9Y0MCmgwKzSjE+uUsgzCkIBt mxx3JukFVGFiUQldTKhnxcorvmeArYtUf3mGh2p/wOp8ZaZ9loUJ5ZmmT046/ssC yOll/2Tbas5uuDPFeZw+iNpfM2POeQZ5Mjm/rJ3ZoO0EYb3WXo6IiDeUrkvJwW0y UDNTrx1v2jLoZi3VR5uqA3VBfng4RRkBWVb4GofM/N0jFfTaqzNbYzA37lypssxa 2e14RvWdO8gU9lWtcDCr/7Ah2NUJsizw1A== =6hrC -----END PGP SIGNATURE----- --=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_=--