All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sohil Mehta" <sohil.mehta@intel.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v2 1/3] KVM: VMX: Support the secondary VM-exit controls
Date: Thu, 03 Dec 2026 07:16:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-247271@kernel.org> (raw)
In-Reply-To: <20261203065149.2952509-2-sohil.mehta@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: VMX: evmcs_sanitize_exec_ctrls() omits
  vmcs_conf->vmexit_2nd_ctrl
--

commit c3fad2255d445005d76a89541e2fce2975f5ba30
Author: Xin Li (Intel) <xin@zytor.com>

KVM: VMX: Support the secondary VM-exit controls

This commit adds the VMCS field, controls shadow, and vmcs_config plumbing
for the 64-bit secondary VM-exit controls, activating them in vmcs01 when
supported and copying them into vmcs02.

> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 68fa251dda600..3752a86c3fca6 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c

[ ... ]

> @@ -2935,6 +2951,7 @@ static int setup_vmcs_config(struct vmcs_config *vmcs_conf,
>  	vmcs_conf->cpu_based_2nd_exec_ctrl = _cpu_based_2nd_exec_control;
>  	vmcs_conf->cpu_based_3rd_exec_ctrl = _cpu_based_3rd_exec_control;
>  	vmcs_conf->vmexit_ctrl         = _vmexit_control;
> +	vmcs_conf->vmexit_2nd_ctrl     = _vmexit_2nd_control;
>  	vmcs_conf->vmentry_ctrl        = _vmentry_control;
>  	vmcs_conf->misc	= misc_msr;

[Severity: Low]
Should evmcs_sanitize_exec_ctrls() also sanitize vmcs_conf->vmexit_2nd_ctrl?

setup_vmcs_config() calls evmcs_sanitize_exec_ctrls() right after this when
enlightened_vmcs is enabled.  In arch/x86/kvm/vmx/vmx_onhyperv.c, it strips
VM_EXIT_ACTIVATE_SECONDARY_CONTROLS from vmcs_conf->vmexit_ctrl, but leaves
vmcs_conf->vmexit_2nd_ctrl untouched.

KVM_OPTIONAL_VMX_SECONDARY_VM_EXIT_CONTROLS is 0 today, so this is latent.
Once a feature sets a bit there, Hyper-V eVMCSv1 leaves vmexit_2nd_ctrl
non-zero despite lacking SECONDARY_VM_EXIT_CONTROLS, so capability checks
on vmcs_config.vmexit_2nd_ctrl would falsely report support.

Adding a 0ULL mask in arch/x86/kvm/vmx/hyperv_evmcs.h and sanitizing
vmexit_2nd_ctrl in evmcs_sanitize_exec_ctrls(), matching
EVMCS1_SUPPORTED_3RDEXEC for cpu_based_3rd_exec_ctrl, would keep vmcs_config
consistent under eVMCS.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203065149.2952509-1-sohil.mehta@intel.com?part=1

  reply	other threads:[~2026-12-03  7:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  6:51 [PATCH v2 0/3] KVM: VMX: Support the secondary VM-exit controls Sohil Mehta
2026-12-03  6:51 ` [PATCH v2 1/3] " Sohil Mehta
2026-12-03  7:16   ` sashiko-bot [this message]
2026-12-03 13:14   ` Chao Gao
2026-12-03 20:42     ` Sohil Mehta
2026-12-03 21:25   ` Sohil Mehta
2026-12-03  6:51 ` [PATCH v2 2/3] KVM: VMX: Treat partial support of an entry/exit pair as inconsistent Sohil Mehta
2026-12-03 14:22   ` Binbin Wu
2026-12-03 19:48     ` Sohil Mehta
2026-12-03  6:51 ` [PATCH v2 3/3] KVM: VMX: Dump the secondary VM-exit controls in dump_vmcs() Sohil Mehta
2026-12-03 14:24   ` Binbin Wu
2026-12-03 13:24 ` [PATCH v2 0/3] KVM: VMX: Support the secondary VM-exit controls Chao Gao
2026-12-03 23:16 ` Sohil Mehta

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-247271@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sohil.mehta@intel.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.