You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: KVM CPU reset retains a pending NMI and interrupt shadow #1159
Resetting a KVM CPU can preserve an NMI and interrupt shadow from its previous execution. A rebooted guest can receive a stale NMI or retain interrupt blocking; debug builds can also fail the reset-state comparison.
In vmm_core/virt_kvm/src/arch/x86_64/vp_state.rs, KvmVpStateAccess::set_activity constructs the event-validity flags conditionally:
KVM updates nmi.pending only when KVM_VCPUEVENT_VALID_NMI_PENDING is present, and updates the interrupt shadow only when KVM_VCPUEVENT_VALID_SHADOW is present. For false values, this code omits the flags and therefore asks KVM to retain the old state rather than clear it.
Trigger
Deliver an NMI to a CPU before reset, or reset while its interrupt shadow is set following STI or MOV SS. Processor::reset writes the reset activity with both booleans false, but the subsequent activity read can still report the old bits. Restoring activity with false values onto an existing CPU has the same problem.
Fix
fix.patch always supplies both validity flags when setting activity. The supplied booleans then replace KVM's state, including clearing it on reset or restore. True-value writes retain their existing behavior, and the change requires no snapshot-format extension.
Activity
tangruize commentedon Nov 1, 2026
Proposed patch
Patch against OpenVMM
998b9f2402050cd16d1faa897bc831ef1434be48. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch