From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
David Riley <d.riley@proxmox.com>
Subject: Re: [PATCH] KVM: VMX: introduce module parameter to disable CET
Date: Tue, 12 May 2026 16:55:01 -0700 [thread overview]
Message-ID: <agO91crdKElYuh1M@google.com> (raw)
In-Reply-To: <20260512150016.2979228-1-pbonzini@redhat.com>
On Tue, May 12, 2026, Paolo Bonzini wrote:
> There have been reports of host hangs caused by CET virtualization.
> Until these are analyzed further, introduce a module parameter that
> makes it possible to easily disable it.
>
> Link: https://lore.kernel.org/all/85548beb-1486-40f9-beb4-632c78e3360b@proxmox.com/
> Cc: David Riley <d.riley@proxmox.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/vmx/capabilities.h | 1 +
> arch/x86/kvm/vmx/vmcs12.c | 2 +-
> arch/x86/kvm/vmx/vmx.c | 17 +++++++++++++++--
> 3 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
> index 56cacc06225e..31568274d8bb 100644
> --- a/arch/x86/kvm/vmx/capabilities.h
> +++ b/arch/x86/kvm/vmx/capabilities.h
> @@ -14,6 +14,7 @@ extern bool __read_mostly flexpriority_enabled;
> extern bool __read_mostly enable_ept;
> extern bool __read_mostly enable_unrestricted_guest;
> extern bool __read_mostly enable_ept_ad_bits;
> +extern bool __read_mostly enable_cet;
> extern bool __read_mostly enable_pml;
> extern int __read_mostly pt_mode;
>
> diff --git a/arch/x86/kvm/vmx/vmcs12.c b/arch/x86/kvm/vmx/vmcs12.c
> index 1ebe67c384ad..9f96e21dc1b9 100644
> --- a/arch/x86/kvm/vmx/vmcs12.c
> +++ b/arch/x86/kvm/vmx/vmcs12.c
> @@ -202,7 +202,7 @@ static __init bool cpu_has_vmcs12_field(unsigned int idx)
> case HOST_S_CET:
> case HOST_SSP:
> case HOST_INTR_SSP_TABLE:
> - return cpu_has_load_cet_ctrl();
> + return enable_cet;
As implemented, cpu_has_vmcs12_field() checks raw CPU support, not what KVM is
using. E.g. EPT_POINTER checks cpu_has_vmx_ept(), not enable_ept. Whether or
not that's ideal/desirable, dunno. But I think we should at least be consistent.
An alternative approach would be to squash the controls themselves. Though again,
I'd probably only want to do that if we plan on taking that approach for all such
module params.
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 5c2c33a5f7dc..d4afc4bf6279 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -2818,6 +2818,11 @@ static int setup_vmcs_config(struct vmcs_config *vmcs_conf,
&_vmentry_control))
return -EIO;
+ if (!enable_cet) {
+ _vmentry_control &= ~VM_ENTRY_LOAD_CET_STATE;
+ _vmexit_control &= ~VM_EXIT_LOAD_CET_STATE;
+ }
+
if (vmx_check_entry_exit_pairs(vmcs_entry_exit_pairs,
_vmentry_control, _vmexit_control))
return -EIO;
next prev parent reply other threads:[~2026-05-12 23:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 15:00 [PATCH] KVM: VMX: introduce module parameter to disable CET Paolo Bonzini
2026-05-12 23:55 ` Sean Christopherson [this message]
2026-05-13 15:51 ` Paolo Bonzini
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=agO91crdKElYuh1M@google.com \
--to=seanjc@google.com \
--cc=d.riley@proxmox.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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