• Sean Christopherson's avatar
    KVM: VMX: Sanitize VM-Entry/VM-Exit control pairs at kvm_intel load time · f5a81d0e
    Sean Christopherson authored
    Sanitize the VM-Entry/VM-Exit control pairs (load+load or load+clear)
    during setup instead of checking both controls in a pair at runtime.  If
    only one control is supported, KVM will report the associated feature as
    not available, but will leave the supported control bit set in the VMCS
    config, which could lead to corruption of host state.  E.g. if only the
    VM-Entry control is supported and the feature is not dynamically toggled,
    KVM will set the control in all VMCSes and load zeros without restoring
    host state.
    
    Note, while this is technically a bug fix, practically speaking no sane
    CPU or VMM would support only one control.  KVM's behavior of checking
    both controls is mostly pedantry.
    
    Cc: Chenyi Qiang <chenyi.qiang@intel.com>
    Cc: Lei Wang <lei4.wang@intel.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20220527170658.3571367-2-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    f5a81d0e
vmx.c 239 KB