Skip to contentSkip to conversation

KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state

PATCH Applied Jim Mattson 2 participants 2 messages Nov 5 – Nov 13

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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()).

Fixes 7ca62d132250 ("KVM: nSVM: do not mark all VMCB01 fields dirty on nested vmexit")
---
 arch/x86/kvm/svm/nested.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kvm/svm/nested.c +1 -0
index 07554089ec05..0d1e4d624cdf 100644
@@ -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
maintainer Applied
#1 lore raw
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 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()).

[...]

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

--
https://github.com/kvm-x86/linux/tree/next