[Bug 219787] Guest's applications crash with EXCEPTION_SINGLE_STEP (0x80000004)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=219787

--- Comment #13 from Sean Christopherson (seanjc@xxxxxxxxxx) ---
On Fri, Feb 21, 2025, bugzilla-daemon@xxxxxxxxxx wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=219787
> 
> Ravi Bangoria (ravi.bangoria@xxxxxxx) changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |ravi.bangoria@xxxxxxx
> 
> --- Comment #12 from Ravi Bangoria (ravi.bangoria@xxxxxxx) ---
> Thanks for the bug report. This is what is probably happening:
> 
> BusLockTrap is controlled through DEBUGCTL MSR and currently DEBUGCTL MSR is
> saved/restored on guest entry/exit only if LBRV is enabled. So, if
> BusLockTrap
> is enabled on the host, it will remain enabled even after guest entry and
> thus,
> if some process inside the guest causes a BusLock, KVM will inject #DB from
> host to the guest.

*sigh*

Bluntly, that's horrific architecture.  Why on earth isn't debugctl
automatically
context switched when BusLockTrap is supported?

And does AMD do _any_ testing?  This doesn't even require a full reproducer,
e.g. the existing debug KVM-Unit-Test fails on my system (Turin) without ever
generating a split/bus lock.  AFAICT, the CPU is reporting bus locks in DR6 on
#DBs that are most definitely not due to bus locks.

> I had a KVM patch[1] but couldn't get back to work on it. Let me try to
> spend some time and respin it.
> 
> [1] https://lore.kernel.org/all/20240808062937.1149-5-ravi.bangoria@xxxxxxx

Virtualizing BusLockTrap won't do a damn thing.  If the guest isn't using LBRs
or BusLockTrap, then KVM won't enable LBR virtualization and so will run the
guest with the host's DEBUGCTL.

Furthermore, running with the host's DEBUGCTL is a bug irrespective of
BusLockTrap.  It just happens to be fatal with BusLockTrap, but running with
BTF=1 and whatever other bits may be enabled in the host most definitely isn't
correct.

Bug reporters, can you test the attached patches?  I have a reproducer in the
form of a KVM test, but I haven't actually tested a Windows guest.  Assuming
squashing DEBUGCTL remedies the issue, I'll post patches after I've done a bit
more testing.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux