In the Linux kernel, the following vulnerability has been resolved:
KVM: x86: Drop WARNs that assert a triple fault never "escapes" from L2
Remove WARNs that sanity check that KVM never lets a triple fault for L2 escape and incorrectly end up in L1. In normal operation, the sanity check is perfectly valid, but it incorrectly assumes that it's impossible for userspace to induce KVMREQTRIPLEFAULT without bouncing through KVMRUN (which guarantees kvmchecknested_state() will see and handle the triple fault).
The WARN can currently be triggered if userspace injects a machine check while L2 is active and CR4.MCE=0. And a future fix to allow save/restore of KVMREQTRIPLE_FAULT, e.g. so that a synthesized triple fault isn't lost on migration, will make it trivially easy for userspace to trigger the WARN.
Clearing KVMREQTRIPLE_FAULT when forcibly leaving guest mode is tempting, but wrong, especially if/when the request is saved/restored, e.g. if userspace restores events (including a triple fault) and then restores nested state (which may forcibly leave guest mode). Ignoring the fact that KVM doesn't currently provide the necessary APIs, it's userspace's responsibility to manage pending events during save/restore.
------------[ cut here ]------------ WARNING: CPU: 7 PID: 1399 at arch/x86/kvm/vmx/nested.c:4522 nestedvmxvmexit+0x7fe/0xd90 [kvmintel] Modules linked in: kvmintel kvm irqbypass CPU: 7 PID: 1399 Comm: statetest Not tainted 5.17.0-rc3+ #808 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:nestedvmxvmexit+0x7fe/0xd90 [kvmintel] Call Trace: <TASK> vmxleavenested+0x30/0x40 [kvmintel] vmxsetnestedstate+0xca/0x3e0 [kvmintel] kvmarchvcpuioctl+0xf49/0x13e0 [kvm] kvmvcpuioctl+0x4b9/0x660 [kvm] _x64sysioctl+0x83/0xb0 dosyscall64+0x3b/0xc0 entrySYSCALL64after_hwframe+0x44/0xae </TASK> ---[ end trace 0000000000000000 ]---