mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: nSVM: Mark VMCB_CET dirty on active VMCB in svm_set_msr()
@ 2026-11-12  0:02 Jim Mattson
  2026-11-12  0:17 ` Yosry Ahmed
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Mattson @ 2026-11-12  0:02 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: Yosry Ahmed, kvm, linux-kernel, Jim Mattson

In svm_set_msr(), writes to MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, and
MSR_KVM_INTERNAL_GUEST_SSP update svm->vmcb->save.{s_cet,isst_addr,ssp}
(which resolves to vmcb02->save when in guest mode), but mark VMCB_CET
dirty on svm->vmcb01.ptr instead of svm->vmcb.

A stale VMCB_CET clean bit may result in the loss of those MSR updates.

Mark VMCB_CET dirty on svm->vmcb instead of svm->vmcb01.ptr.

Fixes: 48b2ec0d540c ("KVM: SVM: Emulate reads and writes to shadow stack MSRs")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/svm/svm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 136069dfcd44..eab11fe50312 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3181,15 +3181,15 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
 		break;
 	case MSR_IA32_S_CET:
 		svm->vmcb->save.s_cet = data;
-		vmcb_mark_dirty(svm->vmcb01.ptr, VMCB_CET);
+		vmcb_mark_dirty(svm->vmcb, VMCB_CET);
 		break;
 	case MSR_IA32_INT_SSP_TAB:
 		svm->vmcb->save.isst_addr = data;
-		vmcb_mark_dirty(svm->vmcb01.ptr, VMCB_CET);
+		vmcb_mark_dirty(svm->vmcb, VMCB_CET);
 		break;
 	case MSR_KVM_INTERNAL_GUEST_SSP:
 		svm->vmcb->save.ssp = data;
-		vmcb_mark_dirty(svm->vmcb01.ptr, VMCB_CET);
+		vmcb_mark_dirty(svm->vmcb, VMCB_CET);
 		break;
 	case MSR_TSC_AUX:
 		/*
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-12  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12  0:02 [PATCH] KVM: nSVM: Mark VMCB_CET dirty on active VMCB in svm_set_msr() Jim Mattson
2026-11-12  0:17 ` Yosry Ahmed

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®