Re: bhyve OpenBSD guest crash on boot between #61 and #65

2019-06-24 Thread Jason Tubnor
On Tue, 25 Jun 2019 at 12:25, Mike Larkin  wrote:

> On Mon, Jun 24, 2019 at 07:16:20PM -0700, guent...@openbsd.org wrote:
>
> > According to objdump -d, that's:
> >  f7 04 25 00 d3 d1 81testl  $0x1000,0x81d1d300
> >  00 10 00 00
> >  74 08   je 
> >  f3 90   pause
> >
> > That's testing the LAPIC ICRLO, a memory-mapped register.  Previously,
> the
> > compiler generated code like this:
> >
> >  8b 0c 25 00 63 cf 81mov0x81cf6300,%ecx
> >  f7 c1 00 10 00 00   test   $0x1000,%ecx
> >  74 09   je 
> >  f3 90   pause
> >
> > where it loaded the LAPIC register into %ecx and then tested that value;
> > now it combines them and does a direct test.  Congrats, that's legal
> > according to Intel (reportedly, Windows will use SSE(!) instructions to
> > read LAPIC registers), so this seems like a bug in Bhyve.
>
>
> Yep, please report it to the bhyve guys.
>
>
Bug report raised at FreeBSD.  For reference:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238794

Thanks for the quick response.  Cheers!


Re: bhyve OpenBSD guest crash on boot between #61 and #65

2019-06-24 Thread Mike Larkin
On Mon, Jun 24, 2019 at 07:16:20PM -0700, guent...@openbsd.org wrote:
> On Mon, 24 Jun 2019, Jason Tubnor wrote:
> > Following daily snapshots, I have hit a bug that was introduced between
> > 6.5-current #61 and 6.5-current #66 (not sure if it was related to the LLVM
> > upgrade).
> > 
> > Reference system is bhyve on FreeBSD 11.2 with an OpenBSD guest.  #61 boots
> > fine and runs as expected.  However, #66 get to the following point and the
> > guest terminates:
> ...
> > Below is output from bhyve.log:
> > 
> > rdmsr to register 0xc80 on vcpu 0
> > Failed to emulate instruction [0xf7 0x04 0x25 0x00 0xd3 0xd1 0x81 0x00 0x10
> > 0x00 0x00 0x74 0x08 0xf3 0x90] at 0x817648f0
> 
> According to objdump -d, that's:
>  f7 04 25 00 d3 d1 81testl  $0x1000,0x81d1d300
>  00 10 00 00
>  74 08   je 
>  f3 90   pause
> 
> That's testing the LAPIC ICRLO, a memory-mapped register.  Previously, the 
> compiler generated code like this:
> 
>  8b 0c 25 00 63 cf 81mov0x81cf6300,%ecx
>  f7 c1 00 10 00 00   test   $0x1000,%ecx
>  74 09   je 
>  f3 90   pause  
> 
> where it loaded the LAPIC register into %ecx and then tested that value; 
> now it combines them and does a direct test.  Congrats, that's legal 
> according to Intel (reportedly, Windows will use SSE(!) instructions to 
> read LAPIC registers), so this seems like a bug in Bhyve.
> 
> 
> Philip Guenther
> 

Yep, please report it to the bhyve guys.

-ml



Re: bhyve OpenBSD guest crash on boot between #61 and #65

2019-06-24 Thread guenther
On Mon, 24 Jun 2019, Jason Tubnor wrote:
> Following daily snapshots, I have hit a bug that was introduced between
> 6.5-current #61 and 6.5-current #66 (not sure if it was related to the LLVM
> upgrade).
> 
> Reference system is bhyve on FreeBSD 11.2 with an OpenBSD guest.  #61 boots
> fine and runs as expected.  However, #66 get to the following point and the
> guest terminates:
...
> Below is output from bhyve.log:
> 
> rdmsr to register 0xc80 on vcpu 0
> Failed to emulate instruction [0xf7 0x04 0x25 0x00 0xd3 0xd1 0x81 0x00 0x10
> 0x00 0x00 0x74 0x08 0xf3 0x90] at 0x817648f0

According to objdump -d, that's:
 f7 04 25 00 d3 d1 81testl  $0x1000,0x81d1d300
 00 10 00 00
 74 08   je 
 f3 90   pause

That's testing the LAPIC ICRLO, a memory-mapped register.  Previously, the 
compiler generated code like this:

 8b 0c 25 00 63 cf 81mov0x81cf6300,%ecx
 f7 c1 00 10 00 00   test   $0x1000,%ecx
 74 09   je 
 f3 90   pause  

where it loaded the LAPIC register into %ecx and then tested that value; 
now it combines them and does a direct test.  Congrats, that's legal 
according to Intel (reportedly, Windows will use SSE(!) instructions to 
read LAPIC registers), so this seems like a bug in Bhyve.


Philip Guenther



Re: bhyve OpenBSD guest crash on boot between #61 and #65

2019-06-24 Thread Bryan Steele
On Tue, Jun 25, 2019 at 11:03:24AM +1000, Jason Tubnor wrote:
> Hi,
> 
> Following daily snapshots, I have hit a bug that was introduced between
> 6.5-current #61 and 6.5-current #66 (not sure if it was related to the LLVM
> upgrade).
> 
> Reference system is bhyve on FreeBSD 11.2 with an OpenBSD guest.  #61 boots
> fine and runs as expected.  However, #66 get to the following point and the
> guest terminates:
> 
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 3.0 @ 0xbf957000 (11 entries)
> bios0: vendor BHYVE version "1.00" date 03/14/2014
> bios0: bhyve BHYVE
> acpi0 at bios0: ACPI 4.0
> acpi0: sleep states S5
> acpi0: tables DSDT FACP HPET APIC MCFG SPCR
> acpi0: wakeup devices
> acpitimer0 at acpi0: 3579545 Hz, 32 bits
> acpihpet0 at acpi0: 16777216 Hz
> acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: Intel(R) Xeon(R) CPU E3-1230 v6 @ 3.50GHz, 3504.21 MHz, 06-9e-09
> cpu0:
> FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,PBE,SSE3,PCLMUL,DTES64,DS-CPL,SSSE3,SDBG,FMA3,CX16,xTPR,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,ITSC,FSGSBASE,BMI1,HLE,AVX2,BMI2,ERMS,INVPCID,RTM,ARAT,XSAVEOPT,MELTDOWN
> cpu0: 256KB 64b/line 8-way L2 cache
> cpu0: smt 0, core 0, package 0
> mtrr: CPU supports MTRRs but not enabled by BIOS
> 
> (Note:  The above was text from #61 but was all the console text (as UEFI
> is graphics) I could copy/paste).
> 
> Below is output from bhyve.log:
> 
> rdmsr to register 0xc80 on vcpu 0
> Failed to emulate instruction [0xf7 0x04 0x25 0x00 0xd3 0xd1 0x81 0x00 0x10
> 0x00 0x00 0x74 0x08 0xf3 0x90] at 0x817648f0

Sounds like a bug in bhyve? Perhaps the compiler change may be
exposing the problem, but it's not clear if the new code being
generated is neccesarily wrong. Does the same snapshot/kernel
boot on the bare metal?

> 
> bhyve.log when booting with #61:
> 
> rdmsr to register 0xc80 on vcpu 0
> rdmsr to register 0xc80 on vcpu 1
> rdmsr to register 0xc80 on vcpu 2
> rdmsr to register 0xc80 on vcpu 3
> rdmsr to register 0xc80 on vcpu 4
> rdmsr to register 0xc80 on vcpu 5
> rdmsr to register 0xc80 on vcpu 6
> rdmsr to register 0xc80 on vcpu 7
> 
> RAMDISK #62 is not showing this issue either.
> 
> Please advise if there is any further information that is needed.
> 
> Jason.
> 



bhyve OpenBSD guest crash on boot between #61 and #65

2019-06-24 Thread Jason Tubnor
Hi,

Following daily snapshots, I have hit a bug that was introduced between
6.5-current #61 and 6.5-current #66 (not sure if it was related to the LLVM
upgrade).

Reference system is bhyve on FreeBSD 11.2 with an OpenBSD guest.  #61 boots
fine and runs as expected.  However, #66 get to the following point and the
guest terminates:

scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.0 @ 0xbf957000 (11 entries)
bios0: vendor BHYVE version "1.00" date 03/14/2014
bios0: bhyve BHYVE
acpi0 at bios0: ACPI 4.0
acpi0: sleep states S5
acpi0: tables DSDT FACP HPET APIC MCFG SPCR
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihpet0 at acpi0: 16777216 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Xeon(R) CPU E3-1230 v6 @ 3.50GHz, 3504.21 MHz, 06-9e-09
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,PBE,SSE3,PCLMUL,DTES64,DS-CPL,SSSE3,SDBG,FMA3,CX16,xTPR,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,ITSC,FSGSBASE,BMI1,HLE,AVX2,BMI2,ERMS,INVPCID,RTM,ARAT,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: CPU supports MTRRs but not enabled by BIOS

(Note:  The above was text from #61 but was all the console text (as UEFI
is graphics) I could copy/paste).

Below is output from bhyve.log:

rdmsr to register 0xc80 on vcpu 0
Failed to emulate instruction [0xf7 0x04 0x25 0x00 0xd3 0xd1 0x81 0x00 0x10
0x00 0x00 0x74 0x08 0xf3 0x90] at 0x817648f0

bhyve.log when booting with #61:

rdmsr to register 0xc80 on vcpu 0
rdmsr to register 0xc80 on vcpu 1
rdmsr to register 0xc80 on vcpu 2
rdmsr to register 0xc80 on vcpu 3
rdmsr to register 0xc80 on vcpu 4
rdmsr to register 0xc80 on vcpu 5
rdmsr to register 0xc80 on vcpu 6
rdmsr to register 0xc80 on vcpu 7

RAMDISK #62 is not showing this issue either.

Please advise if there is any further information that is needed.

Jason.


Re: incorrect book reference in ksh.1

2019-06-24 Thread Andras Farkas
Thanks
:D

On Mon, Jun 24, 2019 at 10:28 AM Ingo Schwarze  wrote:
>
> Hi,
>
> Andras Farkas wrote on Sat, Jun 22, 2019 at 02:54:01PM -0400:
>
> > In ksh.1, in the See Also section, this book is referenced:
> > Morris Bolsky and David Korn, The KornShell Command and Programming
> > Language, 2nd Edition, Prentice Hall, 1995, ISBN 0131827006.
> > However, the book with that ISBN number has a different name, as
> > attested to here:
> > https://dl.acm.org/citation.cfm?id=545704&preflayout=flat
> > and by looking up the ISBN on Google and Amazon. (I also own the book
> > with this ISBN number, and can confirm those sources _are_ correct)
> > So if this book is to be referenced, the title given should be:
> > The New KornShell Command and Programming Language
> > The reference to it being a second edition then becomes optional, and
> > fine either way.
> >
> > However, it may be worthwhile reverting the reference to be to the
> > first edition of the book:
> > https://dl.acm.org/citation.cfm?id=77009&preflayout=flat
> > The 2nd edition is about ksh93, while the first edition is about
> > ksh88.  The ksh clone in OpenBSD is not a ksh93 clone.
> >
> > Relevant diff where this change occurred:
> > https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/ksh.1.diff?r1=1.150&r2=1.151
>
> Since jmc@ asked me to handle this, i committed the following patch.
>
> Thanks for reporting,
>   Ingo
>
>
> CVSROOT:/cvs
> Module name:src
> Changes by: schwa...@cvs.openbsd.org2019/06/24 08:22:39
>
> Modified files:
> bin/ksh: ksh.1
>
> Log message:
> Partial revert of rev. 1.151:
> Reference the First Edition (1989) of Bolsky/Korn which is about ksh88,
> the shell the OpenBSD ksh(1) descends from (via pdksh).
> The Second Edition (1995) of the book is about ksh93 which we don't provide.
> Pointed out by Andras Farkas on bugs@.
>
>
> Index: ksh.1
> ===
> RCS file: /cvs/src/bin/ksh/ksh.1,v
> retrieving revision 1.205
> retrieving revision 1.206
> diff -u -r1.205 -r1.206
> --- ksh.1   21 Jun 2019 10:49:17 -  1.205
> +++ ksh.1   24 Jun 2019 14:22:39 -  1.206
> @@ -5545,10 +5545,12 @@
>  .Rs
>  .%A Morris Bolsky
>  .%A David Korn
> -.%B The KornShell Command and Programming Language, 2nd Edition
> -.%D 1995
> +.%B The KornShell Command and Programming Language
> +.%D First Edition 1989
>  .%I Prentice Hall
> -.%O ISBN 0131827006
> +.%O ISBN 0135169720
> +.\" The second edition of the above book (1995) is about ksh93,
> +.\" but the OpenBSD ksh is a decendant from ksh88 via pdksh.
>  .Re
>  .Rs
>  .%A Stephen G. Kochan



Re: incorrect book reference in ksh.1

2019-06-24 Thread Jason McIntyre
On Mon, Jun 24, 2019 at 04:28:02PM +0200, Ingo Schwarze wrote:
> Hi,
> 
> Andras Farkas wrote on Sat, Jun 22, 2019 at 02:54:01PM -0400:
> 
> > In ksh.1, in the See Also section, this book is referenced:
> > Morris Bolsky and David Korn, The KornShell Command and Programming
> > Language, 2nd Edition, Prentice Hall, 1995, ISBN 0131827006.
> > However, the book with that ISBN number has a different name, as
> > attested to here:
> > https://dl.acm.org/citation.cfm?id=545704&preflayout=flat
> > and by looking up the ISBN on Google and Amazon. (I also own the book
> > with this ISBN number, and can confirm those sources _are_ correct)
> > So if this book is to be referenced, the title given should be:
> > The New KornShell Command and Programming Language
> > The reference to it being a second edition then becomes optional, and
> > fine either way.
> > 
> > However, it may be worthwhile reverting the reference to be to the
> > first edition of the book:
> > https://dl.acm.org/citation.cfm?id=77009&preflayout=flat
> > The 2nd edition is about ksh93, while the first edition is about
> > ksh88.  The ksh clone in OpenBSD is not a ksh93 clone.
> > 
> > Relevant diff where this change occurred:
> > https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/ksh.1.diff?r1=1.150&r2=1.151
> 
> Since jmc@ asked me to handle this, i committed the following patch.
> 
> Thanks for reporting,
>   Ingo
> 

much obliged!
jmc

> 
> CVSROOT:  /cvs
> Module name:  src
> Changes by:   schwa...@cvs.openbsd.org2019/06/24 08:22:39
> 
> Modified files:
>   bin/ksh: ksh.1 
> 
> Log message:
> Partial revert of rev. 1.151:
> Reference the First Edition (1989) of Bolsky/Korn which is about ksh88,
> the shell the OpenBSD ksh(1) descends from (via pdksh).
> The Second Edition (1995) of the book is about ksh93 which we don't provide.
> Pointed out by Andras Farkas on bugs@.
> 
> 
> Index: ksh.1
> ===
> RCS file: /cvs/src/bin/ksh/ksh.1,v
> retrieving revision 1.205
> retrieving revision 1.206
> diff -u -r1.205 -r1.206
> --- ksh.1 21 Jun 2019 10:49:17 -  1.205
> +++ ksh.1 24 Jun 2019 14:22:39 -  1.206
> @@ -5545,10 +5545,12 @@
>  .Rs
>  .%A Morris Bolsky
>  .%A David Korn
> -.%B The KornShell Command and Programming Language, 2nd Edition
> -.%D 1995
> +.%B The KornShell Command and Programming Language
> +.%D First Edition 1989
>  .%I Prentice Hall
> -.%O ISBN 0131827006
> +.%O ISBN 0135169720
> +.\" The second edition of the above book (1995) is about ksh93,
> +.\" but the OpenBSD ksh is a decendant from ksh88 via pdksh.
>  .Re
>  .Rs
>  .%A Stephen G. Kochan



Re: incorrect book reference in ksh.1

2019-06-24 Thread Ingo Schwarze
Hi,

Andras Farkas wrote on Sat, Jun 22, 2019 at 02:54:01PM -0400:

> In ksh.1, in the See Also section, this book is referenced:
> Morris Bolsky and David Korn, The KornShell Command and Programming
> Language, 2nd Edition, Prentice Hall, 1995, ISBN 0131827006.
> However, the book with that ISBN number has a different name, as
> attested to here:
> https://dl.acm.org/citation.cfm?id=545704&preflayout=flat
> and by looking up the ISBN on Google and Amazon. (I also own the book
> with this ISBN number, and can confirm those sources _are_ correct)
> So if this book is to be referenced, the title given should be:
> The New KornShell Command and Programming Language
> The reference to it being a second edition then becomes optional, and
> fine either way.
> 
> However, it may be worthwhile reverting the reference to be to the
> first edition of the book:
> https://dl.acm.org/citation.cfm?id=77009&preflayout=flat
> The 2nd edition is about ksh93, while the first edition is about
> ksh88.  The ksh clone in OpenBSD is not a ksh93 clone.
> 
> Relevant diff where this change occurred:
> https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/ksh.1.diff?r1=1.150&r2=1.151

Since jmc@ asked me to handle this, i committed the following patch.

Thanks for reporting,
  Ingo


CVSROOT:/cvs
Module name:src
Changes by: schwa...@cvs.openbsd.org2019/06/24 08:22:39

Modified files:
bin/ksh: ksh.1 

Log message:
Partial revert of rev. 1.151:
Reference the First Edition (1989) of Bolsky/Korn which is about ksh88,
the shell the OpenBSD ksh(1) descends from (via pdksh).
The Second Edition (1995) of the book is about ksh93 which we don't provide.
Pointed out by Andras Farkas on bugs@.


Index: ksh.1
===
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -r1.205 -r1.206
--- ksh.1   21 Jun 2019 10:49:17 -  1.205
+++ ksh.1   24 Jun 2019 14:22:39 -  1.206
@@ -5545,10 +5545,12 @@
 .Rs
 .%A Morris Bolsky
 .%A David Korn
-.%B The KornShell Command and Programming Language, 2nd Edition
-.%D 1995
+.%B The KornShell Command and Programming Language
+.%D First Edition 1989
 .%I Prentice Hall
-.%O ISBN 0131827006
+.%O ISBN 0135169720
+.\" The second edition of the above book (1995) is about ksh93,
+.\" but the OpenBSD ksh is a decendant from ksh88 via pdksh.
 .Re
 .Rs
 .%A Stephen G. Kochan