• Sean Christopherson's avatar
    KVM: vmx: remove save/restore of host BNDCGFS MSR · cf81a7e5
    Sean Christopherson authored
    Linux does not support Memory Protection Extensions (MPX) in the
    kernel itself, thus the BNDCFGS (Bound Config Supervisor) MSR will
    always be zero in the KVM host, i.e. RDMSR in vmx_save_host_state()
    is superfluous.  KVM unconditionally sets VM_EXIT_CLEAR_BNDCFGS,
    i.e. BNDCFGS will always be zero after VMEXIT, thus manually loading
    BNDCFGS is also superfluous.
    
    And in the event the MPX kernel support is added (unlikely given
    that MPX for userspace is in its death throes[1]), BNDCFGS will
    likely be common across all CPUs[2], and at the least shouldn't
    change on a regular basis, i.e. saving the MSR on every VMENTRY is
    completely unnecessary.
    
    WARN_ONCE in hardware_setup() if the host's BNDCFGS is non-zero to
    document that KVM does not preserve BNDCFGS and to serve as a hint
    as to how BNDCFGS likely should be handled if MPX is used in the
    kernel, e.g. BNDCFGS should be saved once during KVM setup.
    
    [1] https://lkml.org/lkml/2018/4/27/1046
    [2] http://www.openwall.com/lists/kernel-hardening/2017/07/24/28Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    cf81a7e5
vmx.c 374 KB