acrn-kernel/arch/x86/kvm/vmx
Sean Christopherson eb1a542824 KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
commit 26a0652cb4 upstream.

Reject KVM_SET_SREGS{2} with -EINVAL if the incoming CR0 is invalid,
e.g. due to setting bits 63:32, illegal combinations, or to a value that
isn't allowed in VMX (non-)root mode.  The VMX checks in particular are
"fun" as failure to disallow Real Mode for an L2 that is configured with
unrestricted guest disabled, when KVM itself has unrestricted guest
enabled, will result in KVM forcing VM86 mode to virtual Real Mode for
L2, but then fail to unwind the related metadata when synthesizing a
nested VM-Exit back to L1 (which has unrestricted guest enabled).

Opportunistically fix a benign typo in the prototype for is_valid_cr4().

Cc: stable@vger.kernel.org
Reported-by: syzbot+5feef0b9ee9c8e9e5689@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/000000000000f316b705fdf6e2b4@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230613203037.1968489-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-03 10:24:08 +02:00
..
capabilities.h KVM: x86: Track supported PERF_CAPABILITIES in kvm_caps 2023-05-17 11:53:27 +02:00
evmcs.c
evmcs.h KVM: VMX: Fix crash due to uninitialized current_vmcs 2023-03-10 09:34:11 +01:00
nested.c KVM: VMX: Make CR0.WP a guest owned bit 2023-05-17 11:53:29 +02:00
nested.h
pmu_intel.c KVM: x86: Track supported PERF_CAPABILITIES in kvm_caps 2023-05-17 11:53:27 +02:00
posted_intr.c
posted_intr.h
run_flags.h
sgx.c KVM: VMX: Resume guest immediately when injecting #GP on ECREATE 2023-01-07 11:11:47 +01:00
sgx.h
vmcs.h
vmcs12.c
vmcs12.h
vmcs_shadow_fields.h
vmenter.S KVM: x86: use a separate asm-offsets.c file 2022-11-09 12:10:17 -05:00
vmx.c KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid 2023-08-03 10:24:08 +02:00
vmx.h KVM: VMX: Make CR0.WP a guest owned bit 2023-05-17 11:53:29 +02:00
vmx_ops.h