QEMU's default msrs handling causes Windows 10 64 bit to crash

Bug #1658141 reported by Francois Gouget
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
QEMU
Expired
Undecided
Unassigned

Bug Description

Wine uses QEMU to run its conformance test suite on Windows virtual machines. Wine's conformance tests check the behavior of various Windows APIs and verify that they behave as expected.

One such test checks handling of exceptions down. When run on Windows 10 64 bit in QEMU it triggers a "KMOD_EXCEPTION_NOT_HANDLED" BSOD in the VM. See:
https://bugs.winehq.org/show_bug.cgi?id=40240

To reproduce this bug:
* Pick a Windows 10 64 bit VM on an Intel host.

* Start the VM. I'm pretty sure any qemu command will do but here's what I used:
  qemu-system-x86_64 -machine pc-i440fx-2.1,accel=kvm -cpu core2duo,+nx -m 2048 -hda /var/lib/libvirt/images/wtbw1064.qcow2

* Grab the attached source code. The tar file is a bit big at 85KB because I had to include some Wine headers. However the source file proper, exception.c, is only 85 lines, including the LGPL header.

* Compile the source code with MinGW by typing 'make'. This produces a 32 bit exception.exe executable. I'll attach it for good measure.

* Put exception.exe on the VM and run it.

After investigation it turns out this happens:
 * Only for Windows 10 64 bit guests. Windows 10 32 bit and older Windows versions are unaffected.

 * Only on Intel hosts. At least both my Xeon E3-1226 v3 and i7-4790K hosts are impacted but not my Opteron 6128 one.

 * It does not seem to depend on the emulated CPU type: on the Intel hosts this happened with both
core2duo,nx and 'copy the host configuration' and did not depend on the number of emulated cpus/cores.

 * This happened with both QEMU 2.1 and 2.7, and both the 3.16.0 and 4.8.11 Linux kernels, both on Debian 8.6 and Debian Testing.

After searching for quite some time I discovered that the kvm kernel module was sneaking the following messages into /var/log/syslog precisely when the BSOD happens:

Dec 16 13:43:48 vm3 kernel: [ 191.624802] kvm [2064]: vcpu0, guest rIP: 0xfffff803cb3c0bf3 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x1, nop
Dec 16 13:43:48 vm3 kernel: [ 191.624835] kvm [2064]: vcpu0, guest rIP: 0xfffff803cb3c0c5c unhandled rdmsr: 0x1c9

A search on the Internet turned up a post suggesting to change kvm's ignore_msrs setting:

   echo 1 >/sys/module/kvm/parameters/ignore_msrs

https://www.reddit.com/r/VFIO/comments/42dj7n/some_games_crash_to_biosboot_on_launch/

This does actually work and provides a workaround at least.

Revision history for this message
Francois Gouget (fgouget) wrote :
Revision history for this message
Francois Gouget (fgouget) wrote :
Revision history for this message
aldelaro 5 (aldelaro5) wrote :

It appears this bug affects me too with very similar symptons, but this time, it's while launching the recently released game "Puyo Poyo Tetris" using Steam in the guest VM.

Revision history for this message
Thomas Huth (th-huth) wrote :

The QEMU project is currently considering to move its bug tracking to another system. For this we need to know which bugs are still valid and which could be closed already. Thus we are setting all older bugs to
"Incomplete" now.
If you still think this bug report here is valid, then please switch the state back to "New" within the next 60 days, otherwise this report will be marked as "Expired". Thank you and sorry for the inconvenience.

Changed in qemu:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for QEMU because there has been no activity for 60 days.]

Changed in qemu:
status: Incomplete → Expired
Revision history for this message
Francois Gouget (fgouget) wrote :

This bug is still present.
However the "ignore_msrs=1" workaround does not work with QEmu 3.1 anymore. To prevent Windows 10 from crashing one must upgrade QEmu to 5.0.14.

Revision history for this message
Francois Gouget (fgouget) wrote :

The bug is still present so changing the status back to New.

Changed in qemu:
status: Expired → New
Revision history for this message
Thomas Huth (th-huth) wrote : Moved bug report

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'expired' now.
Please continue with the discussion here:

 https://gitlab.com/qemu-project/qemu/-/issues/131

Changed in qemu:
status: New → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.