All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zihui Guo" <youzih27@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: nVMX: Check that the guest's IA32_S_CET is canonical on VM-Enter
Date: Thu, 03 Dec 2026 05:54:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-247212@kernel.org> (raw)
In-Reply-To: <20261203053449.25917-2-youzih27@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: nVMX: duplicated IA32_S_CET canonicality check in guest
  state validation
--

commit 9bc88a8b241d767905cd44717c2ac408fdd9a0b3
Author: Zihui Guo <youzih27@gmail.com>

KVM: nVMX: Check that the guest's IA32_S_CET is canonical on VM-Enter

This commit adds a canonicality check for vmcs12->guest_s_cet in
nested_vmx_check_guest_state() when VM_ENTRY_LOAD_CET_STATE is set.

> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 1a98f28651f70..92397516885db 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;
>  	}

[Severity: Low]
Could this canonicality check move into nested_vmx_check_cet_state_common()
instead of duplicating it here and in nested_vmx_check_host_state()?

Now that guest IA32_S_CET must also be canonical, the check applies to both
host and guest state (with !ia32e host state still enforcing host_s_cet >> 32
== 0).  Moving it into nested_vmx_check_cet_state_common() next to ssp_tbl, or
into kvm_is_valid_u_s_cet(), avoids repeating the check in both callers.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203053449.25917-1-youzih27@gmail.com?part=1

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

Thread overview: 7+ 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 ` [PATCH 1/3] KVM: nVMX: Check that the guest's IA32_S_CET is canonical on VM-Enter Zihui Guo
2026-12-03  5:54   ` sashiko-bot [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
2026-12-03  5:55   ` sashiko-bot
2026-12-03  6:05     ` 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=sashiko-outbox-247212@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=youzih27@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.