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 snapshots drop the interrupt-shadow kind (STI vs MOV SS) #1369
On KVM on an Intel (VMX) host, a VP that is stopped in an STI interrupt shadow is restored in a MOV SS shadow. The save keeps only a boolean, Activity::interrupt_shadow, and the restore writes it back as 1, which is KVM_X86_SHADOW_INT_MOV_SS; KVM reports an STI shadow as KVM_X86_SHADOW_INT_STI (2). A MOV SS shadow survives the round trip. The kinds differ at the next instruction boundary, where a MOV SS shadow also blocks certain debug exceptions and an STI shadow does not, so the restored guest can differ from the saved one only there. AMD hosts are not affected: SVM has one shadow kind, which KVM reports with both bits. Any guest can be stopped in such a shadow; no crafted input is needed. No panic results.
Reproduction
Not reproduced. On an Intel host, stop a vCPU right after an sti executed with IF clear, so that KVM_GET_VCPU_EVENTS reports interrupt.shadow = 2 (KVM_X86_SHADOW_INT_STI). Save and restore its activity. Expected: 2. Actual, from OpenVMM's and KVM's code: set_activity writes 1, and KVM_GET_VCPU_EVENTS then reports 1 (KVM_X86_SHADOW_INT_MOV_SS). A vCPU stopped right after mov ss reports 1 before and after, so it does not show the bug.
Cause
KvmVpStateAccess::activity and set_activity (vmm_core/virt_kvm/src/arch/x86_64/vp_state.rs) turn the shadow into a boolean and back, because vp::Activity (vmm_core/virt/src/x86/vp.rs) has no field for the kind:
No patch is attached. Preserving the kind adds a saved-state field, so a format decision is needed:
Add an optional interrupt_shadow_kind (MOV SS, STI) to Activity. KVM fills it and restores it exactly. Other backends, and older snapshots, fall back to the boolean.
Keep the boolean, and document that the restore promises a shadow, not its kind.
Activity
virt: say what an STI shadow restored as a MOV SS shadow loses
doc: specify that a snapshot keeps the interrupt shadow's kind
openvmm: pin the kind of an interrupt shadow across a KVM snapshot