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: Add CET shadow stack MSRs to merge_msrs[]
Date: Thu, 12 Nov 2026 11:01:58 -0800 [thread overview]
Message-ID: <20261112190158.103091-1-jmattson@google.com> (raw)
When shadow stack is enabled for a vCPU, svm_recalc_msr_intercepts()
disables interception of MSR_IA32_U_CET, MSR_IA32_S_CET, and
MSR_IA32_PL{0..3}_SSP in vmcb01's MSRPM. However, because these MSRs are
missing from merge_msrs[] in nested_svm_init_msrpm_merge_offsets(),
their MSRPM bits are never merged into vmcb02's MSRPM, and L0 continues
to intercept L2 accesses to them even when L1 disables interception.
Add the CET shadow stack MSRs to merge_msrs[] and bump the size of
nested_svm_msrpm_merge_offsets[] to accommodate their MSRPM chunk offset.
Fixes: 38c46bdbf998 ("KVM: SVM: Pass through shadow stack MSRs as appropriate")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
arch/x86/kvm/svm/nested.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 6298160458bc..1299fdadeb73 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -209,7 +209,7 @@ void nested_vmcb02_recalc_intercepts(struct vcpu_svm *svm)
* Hardcode the capacity of the array based on the maximum number of _offsets_.
* MSRs are batched together, so there are fewer offsets than MSRs.
*/
-static int nested_svm_msrpm_merge_offsets[10] __ro_after_init;
+static int nested_svm_msrpm_merge_offsets[11] __ro_after_init;
static int nested_svm_nr_msrpm_merge_offsets __ro_after_init;
typedef unsigned long nsvm_msrpm_merge_t;
@@ -238,6 +238,13 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
MSR_IA32_LASTINTFROMIP,
MSR_IA32_LASTINTTOIP,
+ MSR_IA32_U_CET,
+ MSR_IA32_S_CET,
+ MSR_IA32_PL0_SSP,
+ MSR_IA32_PL1_SSP,
+ MSR_IA32_PL2_SSP,
+ MSR_IA32_PL3_SSP,
+
MSR_K7_PERFCTR0,
MSR_K7_PERFCTR1,
MSR_K7_PERFCTR2,
--
2.56.1.703.gf848ed807c-goog
reply other threads:[~2026-11-12 19:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261112190158.103091-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®