mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Yosry Ahmed <yosry@kernel.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jim Mattson <jmattson@google.com>
Subject: [PATCH] KVM: nSVM: Mark VMCB_CET dirty on active VMCB in svm_set_msr()
Date: Wed, 11 Nov 2026 16:02:00 -0800	[thread overview]
Message-ID: <20261112000200.3005587-1-jmattson@google.com> (raw)

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


             reply	other threads:[~2026-11-12  0:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  0:02 Jim Mattson [this message]
2026-11-12  0:17 ` Yosry Ahmed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112000200.3005587-1-jmattson@google.com \
    --to=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=yosry@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®