public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening
@ 2026-01-28  1:43 Sean Christopherson
  2026-01-28  1:43 ` [PATCH v2 1/3] KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps() Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Sean Christopherson @ 2026-01-28  1:43 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: kvm, linux-kernel, Mathias Krause, John Allen, Rick Edgecombe,
	Chao Gao, Binbin Wu, Xiaoyao Li, Jim Mattson

Fix a bug where KVM will clear IBT and SHSTK bits after nested VMX MSRs
have been configured, e.g. if the kernel is built with CONFIG_X86_CET=y
but CONFIG_X86_KERNEL_IBT=n.  The late clearing results in kvm-intel.ko
refusing to load as the CPU compatible checks generate their VMCS configs
with IBT=n and SHSTK=n, ultimately causing a mismatch on the CET entry
and exit controls.

Patch 2 hardens against similar bugs in the future by adding a flag and
WARNs to yell if KVM sets or clear feature flags outside of the dedicated
flow.

Patch 3 adds (very, very) long overdue printing of the mistmatching offsets
in the VMCS configs.

Chao, I didn't include any of your Reviewed-by's, as every patch changed
quite a bit from v1.

v2:
 - Isolate kvm_setup_xss_caps() from kvm_finalize_cpu_caps(). [Xiaoyao]
 - Fix the pr_cont() printing. [Chao]

v1: https://lore.kernel.org/all/20260123221542.2498217-1-seanjc@google.com

Sean Christopherson (3):
  KVM: x86: Explicitly configure supported XSS from
    {svm,vmx}_set_cpu_caps()
  KVM: x86: Harden against unexpected adjustments to kvm_cpu_caps
  KVM: VMX: Print out "bad" offsets+value on VMCS config mismatch

 arch/x86/kvm/cpuid.c   | 10 ++++++++--
 arch/x86/kvm/cpuid.h   | 12 +++++++++++-
 arch/x86/kvm/svm/svm.c |  6 +++++-
 arch/x86/kvm/vmx/vmx.c | 23 +++++++++++++++++++++--
 arch/x86/kvm/x86.c     | 30 +++++++++++++++++-------------
 arch/x86/kvm/x86.h     |  2 ++
 6 files changed, 64 insertions(+), 19 deletions(-)


base-commit: e81f7c908e1664233974b9f20beead78cde6343a
-- 
2.52.0.457.g6b5491de43-goog


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-02-04  0:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28  1:43 [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening Sean Christopherson
2026-01-28  1:43 ` [PATCH v2 1/3] KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps() Sean Christopherson
2026-01-29  2:55   ` Xiaoyao Li
2026-01-29 15:03     ` Sean Christopherson
2026-01-29  7:34   ` Binbin Wu
2026-01-30  3:23     ` Xiaoyao Li
2026-01-30  5:06       ` Binbin Wu
2026-01-30  8:56   ` Binbin Wu
2026-01-28  1:43 ` [PATCH v2 2/3] KVM: x86: Harden against unexpected adjustments to kvm_cpu_caps Sean Christopherson
2026-01-29  3:09   ` Xiaoyao Li
2026-01-29 15:12     ` Sean Christopherson
2026-01-30  3:01       ` Xiaoyao Li
2026-01-30  8:59   ` Binbin Wu
2026-01-28  1:43 ` [PATCH v2 3/3] KVM: VMX: Print out "bad" offsets+value on VMCS config mismatch Sean Christopherson
2026-01-29  3:16   ` Xiaoyao Li
2026-01-30  9:17   ` Binbin Wu
2026-02-04  0:10 ` [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox