mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state
@ 2026-11-05 22:30 Jim Mattson
  0 siblings, 0 replies; only message in thread
From: Jim Mattson @ 2026-11-05 22:30 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: Yosry Ahmed, kvm, linux-kernel, 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()).

Fixes: 7ca62d132250 ("KVM: nSVM: do not mark all VMCB01 fields dirty on nested vmexit")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-05 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 22:30 [PATCH] KVM: nSVM: Mark all of vmcb01 dirty when restoring nested state Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®