[PATCH] KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state
From: Jim Mattson
Date: Thu Nov 05 2026 - 17:35:44 EST
When restoring a vCPU in guest mode via KVM_SET_NESTED_STATE,
svm_copy_vmrun_state() updates L1's save state in vmcb01->save directly.
Stale clean bits may result in the loss of these updates.
Mark all of vmcb01 dirty after svm_copy_vmrun_state() in
svm_set_nested_state() (cf. svm_leave_smm()).
Fixes: 7ca62d132250 ("KVM: nSVM: do not mark all VMCB01 fields dirty on nested vmexit")
Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
---
arch/x86/kvm/svm/nested.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 07554089ec05..0d1e4d624cdf 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -2091,6 +2091,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
svm->nested.vmcb12_gpa = kvm_state->hdr.svm.vmcb_pa;
svm_copy_vmrun_state(vcpu, &svm->vmcb01.ptr->save, save);
+ vmcb_mark_all_dirty(svm->vmcb01.ptr);
nested_copy_vmcb_control_to_cache(svm, ctl);
svm_switch_vmcb(svm, &svm->nested.vmcb02);
--
2.56.0.455.g6c5a503b38-goog