NetBSD Problem Report #53064

From brad.harder@gmail.com  Fri Mar  2 01:28:55 2018
Return-Path: <brad.harder@gmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 638F77A10D
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  2 Mar 2018 01:28:55 +0000 (UTC)
Message-Id: <CABfrOT-He9JLQub6y-VyfCqCM7MxD=CByTOZb8G4x_jB7mj05Q@mail.gmail.com>
Date: Thu, 1 Mar 2018 17:28:52 -0800
From: bch <brad.harder@gmail.com>
Reply-To:
To: gnats-bugs@netbsd.org
Subject: i386 kernel fault under VirtualBox

>Number:         53064
>Category:       port-i386
>Synopsis:       fault on boot in Oracle VirtualBox VM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 02 01:30:00 +0000 2018
>Last-Modified:  Sat Mar 03 11:25:00 +0000 2018
>Originator:     bch <brad.harder@gmail.com>
>Release:        NetBSD 8.99.12
>Organization:
method logic digital
>Environment:
System: NetBSD daily build from nycdn.netbsd.org, i386
Architecture: i386
Machine: i386 Virtual
>Description:
Kernel fault booting under VirtualBox
Transcribed by hand:

...
attimer0: attached to pcppi0
uvm_fault(0xc136b640, 0, 1) -> 0xe
fatal page fault in supervisor mode
trap type 6 code 0 eip 0xc0100e08 cs 0x8 eflags 0x10082 c42 0x5 ilevel
0x8 esp 0 x1
curlwp 0xc3a18540 pid 0 lid 17 lowest kstack 0xdaecc2c0
kernel: supervisor trap page fault, code=0
Stopped in pid 0.17 (system) at netbsd:Xspllower+0x18: addb %ah,5(%ebx)
>How-To-Repeat:
 I seemed to get this fault w/ 6.x, 7.x, and -current (i386) all the
same. This was under latest VirtualBox from Oracle on Win 7.
>Fix:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox
Date: Fri, 2 Mar 2018 13:36:05 +0100

 On Fri, Mar 02, 2018 at 01:30:00AM +0000, bch wrote:
 > >How-To-Repeat:
 >  I seemed to get this fault w/ 6.x, 7.x, and -current (i386) all the
 > same. This was under latest VirtualBox from Oracle on Win 7.

 Do you have hardware support for nested page tables?

 Joerg

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox
Date: Fri, 2 Mar 2018 18:08:50 +0300

 On Fri, Mar 02, 2018 at 13:36:05 +0100, Joerg Sonnenberger wrote:

 > On Fri, Mar 02, 2018 at 01:30:00AM +0000, bch wrote:
 > > >How-To-Repeat:
 > >  I seemed to get this fault w/ 6.x, 7.x, and -current (i386) all the
 > > same. This was under latest VirtualBox from Oracle on Win 7.
 > 
 > Do you have hardware support for nested page tables?

 I think you mean VT-x (make sure it's enabled in the BIOS).

 -uwe

From: bch <brad.harder@gmail.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	port-i386-maintainer@netbsd.org
Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox
Date: Fri, 02 Mar 2018 17:34:26 +0000

 --001a114a908ae2a51f056671631c
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 On Fri, Mar 2, 2018 at 7:10 AM Valery Ushakov <uwe@stderr.spb.ru> wrote:

 > The following reply was made to PR port-i386/53064; it has been noted by
 > GNATS.
 >
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox
 > Date: Fri, 2 Mar 2018 18:08:50 +0300
 >
 >  On Fri, Mar 02, 2018 at 13:36:05 +0100, Joerg Sonnenberger wrote:
 >
 >  > On Fri, Mar 02, 2018 at 01:30:00AM +0000, bch wrote:
 >  > > >How-To-Repeat:
 >  > >  I seemed to get this fault w/ 6.x, 7.x, and -current (i386) all the
 >  > > same. This was under latest VirtualBox from Oracle on Win 7.
 >  >
 >  > Do you have hardware support for nested page tables?
 >
 >  I think you mean VT-x (make sure it's enabled in the BIOS).
 >

 I can check, though I=E2=80=99m not sure I=E2=80=99ll have access to adjust=
  this machine.
 As a datapoint, FreeBSD 11.1 runs fine, fwiw.

 -bch



 >  -uwe
 >
 >

 --001a114a908ae2a51f056671631c
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 <div><br><div class=3D"gmail_quote"><div dir=3D"auto">On Fri, Mar 2, 2018 a=
 t 7:10 AM Valery Ushakov &lt;<a href=3D"mailto:uwe@stderr.spb.ru">uwe@stder=
 r.spb.ru</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
 "margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The followi=
 ng reply was made to PR port-i386/53064; it has been noted by GNATS.<br>
 <br>
 From: Valery Ushakov &lt;<a href=3D"mailto:uwe@stderr.spb.ru" target=3D"_bl=
 ank">uwe@stderr.spb.ru</a>&gt;<br>
 To: gnats-bugs@NetBSD.org<br>
 Cc:<br>
 Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox<br>
 Date: Fri, 2 Mar 2018 18:08:50 +0300<br>
 <br>
 =C2=A0On Fri, Mar 02, 2018 at 13:36:05 +0100, Joerg Sonnenberger wrote:<br>
 <br>
 =C2=A0&gt; On Fri, Mar 02, 2018 at 01:30:00AM +0000, bch wrote:<br>
 =C2=A0&gt; &gt; &gt;How-To-Repeat:<br>
 =C2=A0&gt; &gt;=C2=A0 I seemed to get this fault w/ 6.x, 7.x, and -current =
 (i386) all the<br>
 =C2=A0&gt; &gt; same. This was under latest VirtualBox from Oracle on Win 7=
 .<br>
 =C2=A0&gt;<br>
 =C2=A0&gt; Do you have hardware support for nested page tables?<br>
 <br>
 =C2=A0I think you mean VT-x (make sure it&#39;s enabled in the BIOS).<br>
 </blockquote><div dir=3D"auto"><br></div><div dir=3D"auto">I can check, tho=
 ugh I=E2=80=99m not sure I=E2=80=99ll have access to adjust this machine. A=
 s a datapoint, FreeBSD 11.1 runs fine, fwiw.</div><div dir=3D"auto"><br></d=
 iv><div dir=3D"auto">-bch=C2=A0</div><div dir=3D"auto"><br></div><div dir=
 =3D"auto"><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
  .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
 =C2=A0-uwe<br>
 <br>
 </blockquote></div></div>

 --001a114a908ae2a51f056671631c--

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-i386/53064: i386 kernel fault under VirtualBox
Date: Sat, 3 Mar 2018 14:23:53 +0300

 On Fri, Mar 02, 2018 at 17:34:26 +0000, bch wrote:

 > On Fri, Mar 2, 2018 at 7:10 AM Valery Ushakov <uwe@stderr.spb.ru> wrote:
 > 
 > >  I think you mean VT-x (make sure it's enabled in the BIOS).
 > 
 > I can check

 You can see it in the VM's log.  E.g.:

 00:00:05.135897 VM: fHMEnabled=true  (configured) fRecompileUser=false fRecompileSupervisor=false
 00:00:05.135900 VM: fRawRing1Enabled=false CSAM=true  PATM=true 
 00:00:05.156239 HM: HMR3Init: VT-x w/ nested paging and unrestricted guest execution hw support


 > though I'm not sure I'll have access to adjust this machine.
 > As a datapoint, FreeBSD 11.1 runs fine, fwiw.

 VirtualBox recompiler cannot cope with some of the code in NetBSD
 locore (iirc, it's confused because netbsd only does indirect jumps to
 the cli instruction in spllower).

 If you are stuck without VT-x, you can tell vbox to not use "raw
 mode"[1] for the kernel with --recompile-supervisor command line
 option (it's not exposed in the GUI).  That will be slow, but will
 work.

 [1] https://www.virtualbox.org/manual/ch10.html#idm10909


 If you can compile custom kernels you can probably also use my very
 old patches from

   http://ftp.netbsd.org/pub/NetBSD/misc/uwe/netbsd-vbox-raw-mode.diff

 Ignore TSS part (it was a proof of concept hack), you only need spl.S
 and patch.c


 -uwe

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.