[PATCH 1/3] KVM: nVMX: Check that the guest's IA32_S_CET is canonical on VM-Enter

From: Zihui Guo

Date: Thu Dec 03 2026 - 00:35:03 EST


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@xxxxxxxxx>
---
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