rumpkernel and bhyve: triple faults

Fabian Freyer fabian.freyer at physik.tu-berlin.de
Fri Mar 9 17:45:34 UTC 2018


On 6 Mar 2018, at 7:45, Fabian Freyer wrote:
> Tracking down bios_crtc_base, I find that it’s 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 addresses to be
> Uninitialised:
>
> 00000400: 0000                                     ..
> 00000483: 0000                                     ..
>
> I’m 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’ve chased this bug down a bit further to what I believe is an issue with the
rumprun toolchain I am building on FreeBSD with the misc/rumprun port [1].

objdump -t helloer-rumprun.elf list a number of symbols in the *COM* section, 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, accessing any
of these will result in a fault. I’m pretty sure that these shouldn’t 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=markup&pathrev=459195
[2] http://man7.org/linux/man-pages/man5/elf.5.html / SHN_COMMON
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 882 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20180309/13dd1ba0/attachment.sig>


More information about the freebsd-virtualization mailing list