[PATCH 0/3] KVM: x86: CR0 vs. KVM_SET_SREGS and !URG

From: Sean Christopherson
Date: Tue Jun 13 2023 - 16:30:45 EST


Fix a longstanding bug where KVM doesn't check the incoming CR0 provided
by userspace via KVM_SET_SREGS, and then fix a VMX specific bug that let
the missing CR0 check escalate from "just" a failed VM-Entry, to a "KVM is
all kinds of confused and generates a WARN" issue.

Expand the set_sregs_test selftest to provide basic CR0 coverage

Sean Christopherson (3):
KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest
KVM: selftests: Expand x86's sregs test to cover illegal CR0 values

arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 3 +-
arch/x86/kvm/svm/svm.c | 6 ++
arch/x86/kvm/vmx/vmx.c | 41 ++++++++---
arch/x86/kvm/x86.c | 34 +++++----
.../selftests/kvm/x86_64/set_sregs_test.c | 70 +++++++++++--------
6 files changed, 100 insertions(+), 55 deletions(-)


base-commit: 24ff4c08e5bbdd7399d45f940f10fed030dfadda
--
2.41.0.162.gfafddb0af9-goog