Skip to content
  • Sean Christopherson's avatar
    db888065
    i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs · db888065
    Sean Christopherson authored
    
    
    On real hardware, on systems that supports SGX Launch Control, those
    MSRs are initialized to digest of Intel's signing key; on systems that
    don't support SGX Launch Control, those MSRs are not available but
    hardware always uses digest of Intel's signing key in EINIT.
    
    KVM advertises SGX LC via CPUID if and only if the MSRs are writable.
    Unconditionally initialize those MSRs to digest of Intel's signing key
    when CPU is realized and reset to reflect the fact. This avoids
    potential bug in case kvm_arch_put_registers() is called before
    kvm_arch_get_registers() is called, in which case guest's virtual
    SGX_LEPUBKEYHASH MSRs will be set to 0, although KVM initializes those
    to digest of Intel's signing key by default, since KVM allows those MSRs
    to be updated by Qemu to support live migration.
    
    Save/restore the SGX Launch Enclave Public Key Hash MSRs if SGX Launch
    Control (LC) is exposed to the guest. Likewise, migrate the MSRs if they
    are writable by the guest.
    
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarKai Huang <kai.huang@intel.com>
    Signed-off-by: default avatarYang Zhong <yang.zhong@intel.com>
    Message-Id: <20210719112136.57018-11-yang.zhong@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    db888065
    i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs
    Sean Christopherson authored
    
    
    On real hardware, on systems that supports SGX Launch Control, those
    MSRs are initialized to digest of Intel's signing key; on systems that
    don't support SGX Launch Control, those MSRs are not available but
    hardware always uses digest of Intel's signing key in EINIT.
    
    KVM advertises SGX LC via CPUID if and only if the MSRs are writable.
    Unconditionally initialize those MSRs to digest of Intel's signing key
    when CPU is realized and reset to reflect the fact. This avoids
    potential bug in case kvm_arch_put_registers() is called before
    kvm_arch_get_registers() is called, in which case guest's virtual
    SGX_LEPUBKEYHASH MSRs will be set to 0, although KVM initializes those
    to digest of Intel's signing key by default, since KVM allows those MSRs
    to be updated by Qemu to support live migration.
    
    Save/restore the SGX Launch Enclave Public Key Hash MSRs if SGX Launch
    Control (LC) is exposed to the guest. Likewise, migrate the MSRs if they
    are writable by the guest.
    
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarKai Huang <kai.huang@intel.com>
    Signed-off-by: default avatarYang Zhong <yang.zhong@intel.com>
    Message-Id: <20210719112136.57018-11-yang.zhong@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading