KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state
PATCH 1/1 KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state
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()).
--- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
@@ -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);
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
Quoted 8 lines · Jim Mattson
When restoring a vCPU in guest mode via
KVM_SET_NESTED_STATE,svm_copy_vmrun_state()updates L1's save state invmcb01->savedirectly. Stale clean bits may result in the loss of these updates.Mark all of vmcb01 dirty after
svm_copy_vmrun_state()insvm_set_nested_state()(cf.svm_leave_smm()).[...]
Applied to kvm-x86 svm, thanks!
[1/1] KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state
https://github.com/kvm-x86/linux/commit/69a4ba37c75b