OSDN Git Service

x86/kvm/hyper-v: don't allow to turn on unsupported VMX controls for nested guests
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 5 Feb 2020 12:30:34 +0000 (13:30 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 5 Feb 2020 14:55:26 +0000 (15:55 +0100)
commita83502314ce303c6341b249c41121759c7477ba1
treec9d5920403b6af1f8c81a297960149be36673cb2
parent31de3d2500e49e9f44fdda1830a37f4d9735bcdd
x86/kvm/hyper-v: don't allow to turn on unsupported VMX controls for nested guests

Sane L1 hypervisors are not supposed to turn any of the unsupported VMX
controls on for its guests and nested_vmx_check_controls() checks for
that. This is, however, not the case for the controls which are supported
on the host but are missing in enlightened VMCS and when eVMCS is in use.

It would certainly be possible to add these missing checks to
nested_check_vm_execution_controls()/_vm_exit_controls()/.. but it seems
preferable to keep eVMCS-specific stuff in eVMCS and reduce the impact on
non-eVMCS guests by doing less unrelated checks. Create a separate
nested_evmcs_check_controls() for this purpose.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/evmcs.c
arch/x86/kvm/vmx/evmcs.h
arch/x86/kvm/vmx/nested.c