summaryrefslogtreecommitdiff
path: root/scripts/cleanpatch
diff options
context:
space:
mode:
authorAmirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>2026-10-17 11:30:10 +0200
committerSean Christopherson <seanjc@google.com>2026-11-10 14:42:26 -0800
commitbcc359264f15095d3d167535cf5de0b7e4800279 (patch)
tree37407698f3e1f3dc9c4ad1c498defc8acb32436f /scripts/cleanpatch
parent809f39842c1706089e0de82b5c1d851d84eec4dc (diff)
KVM: nVMX: Clear nested.smm.guest_mode on a failed RSM-to-L2
vmx_leave_smm() consumes nested.smm.vmxon into nested.vmxon up front, but clears nested.smm.guest_mode only on the success path. On either failure arm (nested_vmx_check_restored_vmcs12() < 0, or nested_vmx_enter_non_root_mode() != NVMX_VMENTRY_SUCCESS) it returns early with nested.smm.guest_mode still true while nested.smm.vmxon is already false. em_rsm() turns that non-zero return into a triple fault, but the vCPU is left with the internal pair (smm.guest_mode=true, smm.vmxon=false). That pair is not representable in migration state: vmx_get_nested_state() serializes KVM_STATE_NESTED_SMM_GUEST_MODE without KVM_STATE_NESTED_SMM_VMXON, and vmx_set_nested_state() rejects exactly SMM_GUEST_MODE && !SMM_VMXON with -EINVAL. KVM thus serializes a state it refuses to restore -- a save/restore (live-migration) round-trip break. The leak is sticky: free_nested() and vCPU reset do not clear nested.smm.guest_mode (kvm_vcpu_reset() gates the nested unwind on is_guest_mode(), false here), so a later VMXON re-exposes the bad KVM_GET_NESTED_STATE with no SMI/RSM involved, for the life of the vCPU. Clear nested.smm.guest_mode before the consistency check and re-entry, so it is cleared on every exit from the block. nested.vmxon is left true, which is correct (L1 does have VMX on) and round-trips cleanly on its own. Not a memory-safety issue; fidelity / migration only. Cc: stable@vger.kernel.org Signed-off-by: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de> Link: https://patch.msgid.link/20261017093016.32348-1-amirmohammad.eftekhar@cispa.de Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'scripts/cleanpatch')
0 files changed, 0 insertions, 0 deletions