When a break point is set, nested virtualization sees "kvm_queue_exception: Assertion `!env->exception_has_payload' failed."
Host environment
- Operating system: Debian 11
- OS/kernel version: 5.17.9 (self-compiled)
- Architecture: x86_64
- QEMU flavor: qemu-system-i386
- QEMU version: QEMU emulator version 7.0.0
- QEMU command line:
qemu-system-i386 -m 512M -gdb tcp::1234 -smp 2 -cpu Haswell,vmx=yes -enable-kvm -serial stdio -drive media=disk,file=1.img,index=1 -drive media=disk,file=2.img,index=2 -S
- Note: to reproduce this bug, run both lines above at the same time in different shells.
Emulated/Virtualized environment
- Operating system: A micro-hypervisor called XMHF, which runs a small operating system called LHV
- OS/kernel version:
- 1.img is XMHF. Its source code is https://github.com/lxylxy123456/uberxmhf/tree/a8610d2f9e69263c014b5e48270e42690b73b85d.
- 2.img is LHV. Its source code is https://github.com/lxylxy123456/uberxmhf/tree/10afe107cbeadb1c4dbe7f9b8e41c2a50c47bda5.
- These images are compressed as a.tar.xz
- Architecture: x86
Description of problem
I am debugging XMHF and LHV using QEMU + KVM. I found that if I set a break point using GDB, QEMU will crash when LHV is booting. The message is
qemu-system-i386: ../../../target/i386/kvm/kvm.c:678: kvm_queue_exception: Assertion `!env->exception_has_payload' failed.
The address of the break point is arbitrary. The break point does not need to hit. So I chose 0 as the address in this bug report.
Steps to reproduce
- Start QEMU using
qemu-system-i386 -m 512M -gdb tcp::1234 -smp 2 -cpu Haswell,vmx=yes -enable-kvm -serial stdio -drive media=disk,file=1.img,index=1 -drive media=disk,file=2.img,index=2 -S
- In another shell, start GDB using
gdb --ex 'target remote :::1234' --ex 'hb *0' --ex c
- See many serial output lines. The tail of the output is
CPU #0: vcpu_vaddr_ptr=0x01e06080, esp=0x01e11000 CPU #1: vcpu_vaddr_ptr=0x01e06540, esp=0x01e15000 BSP(0x00): Rallying APs... BSP(0x00): APs ready, doing DRTM... LAPIC base and status=0xfee00900 Sending INIT IPI to all APs...
- See assertion error in QEMU
qemu-system-i386: ../target/i386/kvm/kvm.c:645: kvm_queue_exception: Assertion `!env->exception_has_payload' failed.
Additional information
This bug was first incorrectly filed in KVM's bug tracker at https://bugzilla.kernel.org/show_bug.cgi?id=216002.
Edited by lxylxy1234561