Skip to content

KVM: x86: CET vs. nVMX fix and hardening

Sean Christopherson kvm lkml 2 versions – Applied

Status from this message: Applied patch 1 to "fixes", patch 2 to "misc", and patch 3 to "vmx.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 13 repliesApplied
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps()arch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c +1 more+23 -136 replies
2/3KVM: x86: Harden against unexpected adjustments to kvm_cpu_capsarch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h arch/x86/kvm/svm/svm.c +1 more+25 -54 replies
3/3KVM: VMX: Print out "bad" offsets+value on VMCS config mismatcharch/x86/kvm/vmx/vmx.c+16 -12 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchXiaoyao LiBinbin Wu
1/3R-b R-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening

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/[email protected]

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

Signature · 1 line
2.52.0.457.g6b5491de43-goog