From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48E63351C25 for ; Tue, 12 May 2026 23:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778630106; cv=none; b=UYY5wF+0G2uzF6LtXLbu65mn30DV8aJfpHzUt6aVx4IfFPXvhEfzpaMhVX43ZOwnk3abmSJYl6yyDudyFe55zF+M353y+QsVFk+6AVOtZWYMOfaZgYnuems7IThqB31cwA1FxoZxPycs8dDp6L0IYD173JU3lcwjIQ/XJVBsMKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778630106; c=relaxed/simple; bh=yqx0AjZGZxPl3saua6UZMZdAh5t6qb6IEwHXZrkryZg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cfW1ungln0KHtl1JWfju/gWV6LX9CQ/SoZ048/5WGE6YZ+9hAAdMv9Hu1m2rZIXpC1T9jTFGyj+i29sJFD85KlvbuFxeXMAGtbNA2sWoBl1j9FxEiIJ63oD/WQ6ybiikR4Ujqv02foH0MWUDTc3Chw5VQpFmTTLq+qM7s/Ap84A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=H3eziE3F; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="H3eziE3F" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bd04e4fe3dso22915385ad.3 for ; Tue, 12 May 2026 16:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778630102; x=1779234902; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=idjjIV85cN5FoIWvSVQA+tFF64SQCfddrgXmCpwuKDI=; b=H3eziE3FvN93zU4f8ipd7EEen7iwYZK6E9lLeQcXHYcooMCufTuL9IW7C3DTtUkw+m z62/noS/4n9ZJ7O7YYhJOXs2E/aNl+FWqEBcb0Mv2g89Mhtlpze+yyFIDXfsegHoZ9OM TFGUZyo+5a4YPVUhDVn1V83RZZSjKwk5EIV5gsOsZkNUBNUijmDjG6dYtL0oqpypdCMI 01IFxI9PsuxbnPt4IP8eIdkiuiUESxcqme4gPXR3ELDYXTtgnoPrGdf4EypuVafSRb0/ bxziZb6iy+MpFUdCimjxx5dQa2WskF5MONkJyt9o/JZLrm0hqT2L78QbXKleStn/kbCA yCFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778630102; x=1779234902; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=idjjIV85cN5FoIWvSVQA+tFF64SQCfddrgXmCpwuKDI=; b=NaceDxqqUeLKImEc9j852YoUr1BcaKu2EtWhqydGdUlxrdnE7gY3nzz9vf/mnbZP9G PSRy08ngPDkFr22Xf1EH+DnCDjKMo9qkpzC7XAKtsbWe+kk+uo/cAR4WxX8e7N+hgSGc yyi/nRKARuhihgP7vCEQxq2/Or/3/yGhu9NCthZ0a4lHaWv+j/jyZRFoPzXVgr9bydx7 nHRQyV1oYtE2/8mBi1DUFl0fkSumxHyieckbNEWsT2YTmQB0D4nSoe0HSLLmE21uljKP Orvvf60Bhq6Ycx6io6lkVpQ+5R4UkrZlLUYM4BFyp3bCG6V2bxNXAcn9TvQ8Jq7KFfKG 7YvQ== X-Gm-Message-State: AOJu0YyWDgSocjf+uUXQifjtODqdS3vyWJ6iH6QPVgsi4SdNgcaflf92 fAS+/5GtlM/SlDZlS8qqm79RAs9KkJgb+j3o1HF7A/dmnyNRAD8SXF3IxMGADwsIgZCmyVuIGOY ksGi+Ig== X-Received: from plyd17.prod.google.com ([2002:a17:902:cb91:b0:2bc:f38f:2ca3]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ea09:b0:2ba:df8c:11d3 with SMTP id d9443c01a7336-2bd303365bbmr3551705ad.32.1778630102393; Tue, 12 May 2026 16:55:02 -0700 (PDT) Date: Tue, 12 May 2026 16:55:01 -0700 In-Reply-To: <20260512150016.2979228-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260512150016.2979228-1-pbonzini@redhat.com> Message-ID: Subject: Re: [PATCH] KVM: VMX: introduce module parameter to disable CET From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Riley Content-Type: text/plain; charset="us-ascii" 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 > Signed-off-by: Paolo Bonzini > --- > 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;