mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zihui Guo <youzih27@gmail.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Chao Gao <chao.gao@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] KVM: nVMX: Check that the guest's IA32_S_CET is canonical on VM-Enter
Date: Thu,  3 Dec 2026 05:34:46 +0000	[thread overview]
Message-ID: <20261203053449.25917-2-youzih27@gmail.com> (raw)
In-Reply-To: <20261203053449.25917-1-youzih27@gmail.com>

SDM Vol. 3C 29.3.1.1 says: "If the 'load CET state' VM-entry control
is 1, the IA32_S_CET field and the IA32_INTERRUPT_SSP_TABLE_ADDR field
must contain canonical addresses."

The nested consistency checks were meant to cover all CET checks of
VM-Enter, but treat the guest's IA32_S_CET like SSP, for which only
bits 63:N must be identical. IA32_S_CET has no such relaxation. With
IBT enumerated to L1, bits 63:10 of the field are not reserved, so a
non-canonical value such as 0x0000800000000000 passes
nested_vmx_check_guest_state() and is left to the hardware VM-Enter of
vmcs02.

Check it next to the SSP check.

Fixes: 62f7533a6b3a ("KVM: nVMX: Add consistency checks for CET states")
Signed-off-by: Zihui Guo <youzih27@gmail.com>
---
 arch/x86/kvm/vmx/nested.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 1a98f28651f7..92397516885d 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -3384,6 +3384,10 @@ static int nested_vmx_check_guest_state(struct kvm_vcpu *vcpu,
 		 */
 		if (CC(!__is_canonical_address(vmcs12->guest_ssp, max_host_virt_addr_bits() + 1)))
 			return -EINVAL;
+
+		/* Unlike SSP, IA32_S_CET must be canonical (SDM 29.3.1.1). */
+		if (CC(is_noncanonical_msr_address(vmcs12->guest_s_cet, vcpu)))
+			return -EINVAL;
 	}
 
 	if (nested_check_guest_non_reg_state(vmcs12))
-- 
2.43.0


  reply	other threads:[~2026-12-03  5:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  5:34 [PATCH 0/3] KVM: nVMX: Add missing guest-state checks on nested VM-Enter Zihui Guo
2026-12-03  5:34 ` Zihui Guo [this message]
2026-12-03  5:34 ` [PATCH 2/3] KVM: nVMX: Reject nested VM-Enter to HLT with a non-zero SS.DPL Zihui Guo
2026-12-03  5:34 ` [PATCH 3/3] KVM: nVMX: Check the event injected into the HLT state on nested VM-Enter Zihui Guo

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=20261203053449.25917-2-youzih27@gmail.com \
    --to=youzih27@gmail.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=chao.gao@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /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®