Skip to content

KVM: nVMX: Fix 2nd exec controls override goofs

Sean Christopherson kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 10 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: nVMX: Properly expose ENABLE_USR_WAIT_PAUSE control to L1arch/x86/kvm/vmx/nested.c+2 -12 replies
2/4KVM: nVMX: Don't stuff secondary execution control if it's not supportedarch/x86/kvm/vmx/vmx.c+10 -00 replies
3/4KVM: nVMX: Don't muck with allowed sec exec controls on CPUID changesarch/x86/kvm/vmx/capabilities.h arch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/vmx.c+9 -23 replies
4/4KVM: selftests: Test KVM's handling of VMX's sec exec MSR on KVM_SET_CPUIDtools/testing/selftests/kvm/include/x86_64/processor.h tools/testing/selftests/kvm/include/x86_64/vmx.h tools/testing/selftests/kvm/x86_64/vmx_msrs_test.c+95 -20 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchJim Mattson
1/4R-b
2/4
3/4
4/4

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/4] KVM: nVMX: Fix 2nd exec controls override goofs

Fix bugs in KVM's (mis)handling of secondary execution controls.

KVM overrides the secondary execution control VMX MSR during KVM_SET_CPUID. Similar to the somewhat recent reverts

8805875aa473 ("Revert "KVM: nVMX: Do not expose MPX VMX controls when guest MPX disabled"") 9389d5774aca ("Revert "KVM: nVMX: Expose load IA32_PERF_GLOBAL_CTRL VM-{Entry,Exit} control"")

undo misguided KVM behavior where KVM overrides allowed-1 settings in the secondary execution controls in response to changes to the guest's CPUID model. To avoid breaking userspace that doesn't take ownership of the VMX MSRs, go hands off if and only if userpace sets the MSR in question.

Before fixing that, fix another bug it was hiding where the umwait/tpause control was being exposed to L1 for nVMX only after KVM_SET_CPUID, and harden KVM against similar bugs in the future.

v2: Fix the ENABLE_USR_WAIT_PAUSE bug too. [Aaron]

v1: https://lore.kernel.org/all/[email protected]

Sean Christopherson (4):
KVM: nVMX: Properly expose ENABLE_USR_WAIT_PAUSE control to L1
KVM: nVMX: Don't stuff secondary execution control if it's not
supported
KVM: nVMX: Don't muck with allowed sec exec controls on CPUID changes
KVM: selftests: Test KVM's handling of VMX's sec exec MSR on
KVM_SET_CPUID

 arch/x86/kvm/vmx/capabilities.h               |  1 +
 arch/x86/kvm/vmx/nested.c                     |  6 +-
 arch/x86/kvm/vmx/vmx.c                        | 17 +++-
 .../selftests/kvm/include/x86_64/processor.h  |  1 +
 .../selftests/kvm/include/x86_64/vmx.h        |  4 +-
 .../selftests/kvm/x86_64/vmx_msrs_test.c      | 92 +++++++++++++++++++
 6 files changed, 116 insertions(+), 5 deletions(-)

base-commit: 02076de83f4de19a045227b9d44084a30e936c26

Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog