Re: Crash when writing to x86 hardware debug registers

2022-09-16 Thread Jan Beulich
On 15.09.2022 22:04, Neil Sikka wrote:
> Update: I rebuilt the hypervisor binary in debug mode and get the following
> output in xl dmesg after the crash.
> 
> (XEN) HVM9 restore: CPU 0
> (XEN) HVM9 restore: PIC 0
> (XEN) HVM9 restore: PIC 1
> (XEN) HVM9 restore: IOAPIC 0
> (XEN) HVM9 restore: LAPIC 0
> (XEN) HVM9 restore: LAPIC_REGS 0
> (XEN) HVM9 restore: PCI_IRQ 0
> (XEN) HVM9 restore: ISA_IRQ 0
> (XEN) HVM9 restore: PCI_LINK 0
> (XEN) HVM9 restore: PIT 0
> (XEN) HVM9 restore: RTC 0
> (XEN) HVM9 restore: HPET 0
> (XEN) HVM9 restore: PMTIMER 0
> (XEN) HVM9 restore: MTRR 0
> (XEN) HVM9 restore: VIRIDIAN_DOMAIN 0
> (XEN) HVM9 restore: CPU_XSAVE 0
> (XEN) HVM9 restore: VIRIDIAN_VCPU 0
> (XEN) HVM9 restore: VMCE_VCPU 0
> (XEN) HVM9 restore: TSC_ADJUST 0
> (XEN) HVM9 restore: CPU_MSR 0
> (XEN) d9: VIRIDIAN MSR_TIME_REF_COUNT: accessed
> (XEN) vmx.c:3295:d9v0 RDMSR 0x unimplemented

Now that's MSR_P5_MC_ADDR, and hence an issue which Roger did already see
and fix. You will want to update to 4.16.2.

Jan



Re: Crash when writing to x86 hardware debug registers

2022-09-15 Thread Neil Sikka
Update: I rebuilt the hypervisor binary in debug mode and get the following
output in xl dmesg after the crash.

(XEN) HVM9 restore: CPU 0
(XEN) HVM9 restore: PIC 0
(XEN) HVM9 restore: PIC 1
(XEN) HVM9 restore: IOAPIC 0
(XEN) HVM9 restore: LAPIC 0
(XEN) HVM9 restore: LAPIC_REGS 0
(XEN) HVM9 restore: PCI_IRQ 0
(XEN) HVM9 restore: ISA_IRQ 0
(XEN) HVM9 restore: PCI_LINK 0
(XEN) HVM9 restore: PIT 0
(XEN) HVM9 restore: RTC 0
(XEN) HVM9 restore: HPET 0
(XEN) HVM9 restore: PMTIMER 0
(XEN) HVM9 restore: MTRR 0
(XEN) HVM9 restore: VIRIDIAN_DOMAIN 0
(XEN) HVM9 restore: CPU_XSAVE 0
(XEN) HVM9 restore: VIRIDIAN_VCPU 0
(XEN) HVM9 restore: VMCE_VCPU 0
(XEN) HVM9 restore: TSC_ADJUST 0
(XEN) HVM9 restore: CPU_MSR 0
(XEN) d9: VIRIDIAN MSR_TIME_REF_COUNT: accessed
(XEN) vmx.c:3295:d9v0 RDMSR 0x unimplemented
(XEN) d9v0 VIRIDIAN CRASH: 1e c096 f80575bc362c 0 0

On Thu, Sep 15, 2022 at 12:33 PM Neil Sikka  wrote:

> Hi All,
> I am running a userland debugger in Windows 10 HVM on Xen 4.16 on an Intel
> chip. I noticed when I set a hardware breakpoint (which writes to the DR0
> register), Windows 10 crashes. This crash reproduces both with and without
> viridian enabled in the DomU cfg file.
>
> (XEN) Xen version 4.16.1 (neil@) (gcc (Debian 10.2.1-6) 10.2.1 20210110)
> debug=n Tue Apr 19 11:20:04 EDT 2022
> (XEN) d13v0 VIRIDIAN CRASH: 1e c096 f8007f85562c 0 0
>
> This output from xl dmesg shows that I am not running a debug hypervisor,
> and that theres a viridian crash. I've gotten the following stop codes in
> the BSOD from Windows: KMODE EXCEPTION NOT HANDLED, SYSTEM_SERVICE
> EXCEPTION.
>
> I see this code in xen/xen/arch/x86/msr.c inside guest_wrmsr():
> case MSR_AMD64_DR0_ADDRESS_MASK:
> case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK:
> if ( !cp->extd.dbext )
> goto gp_fault;
>
> I was assuming AMD64 refers to a 64 bit CPU rather than an AMD CPU, and
> this is one of the few references I found to DR0, and I saw a deliberate
> fault raised if dbext is not set. However I'm told that dbext is unrelated,
> set by default and does not need to be set at hypervisor compile time.
>
> Any ideas why I'm getting this crash?
>
> Thanks in Advance,
> Neil
>
> --
> My Blog: http://www.neilscomputerblog.blogspot.com/
> Twitter: @neilsikka
>


-- 
My Blog: http://www.neilscomputerblog.blogspot.com/
Twitter: @neilsikka


Crash when writing to x86 hardware debug registers

2022-09-15 Thread Neil Sikka
Hi All,
I am running a userland debugger in Windows 10 HVM on Xen 4.16 on an Intel
chip. I noticed when I set a hardware breakpoint (which writes to the DR0
register), Windows 10 crashes. This crash reproduces both with and without
viridian enabled in the DomU cfg file.

(XEN) Xen version 4.16.1 (neil@) (gcc (Debian 10.2.1-6) 10.2.1 20210110)
debug=n Tue Apr 19 11:20:04 EDT 2022
(XEN) d13v0 VIRIDIAN CRASH: 1e c096 f8007f85562c 0 0

This output from xl dmesg shows that I am not running a debug hypervisor,
and that theres a viridian crash. I've gotten the following stop codes in
the BSOD from Windows: KMODE EXCEPTION NOT HANDLED, SYSTEM_SERVICE
EXCEPTION.

I see this code in xen/xen/arch/x86/msr.c inside guest_wrmsr():
case MSR_AMD64_DR0_ADDRESS_MASK:
case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK:
if ( !cp->extd.dbext )
goto gp_fault;

I was assuming AMD64 refers to a 64 bit CPU rather than an AMD CPU, and
this is one of the few references I found to DR0, and I saw a deliberate
fault raised if dbext is not set. However I'm told that dbext is unrelated,
set by default and does not need to be set at hypervisor compile time.

Any ideas why I'm getting this crash?

Thanks in Advance,
Neil

-- 
My Blog: http://www.neilscomputerblog.blogspot.com/
Twitter: @neilsikka