• Peter Gonda's avatar
    KVM: SEV: Acquire vcpu mutex when updating VMSA · bb18a677
    Peter Gonda authored
    The update-VMSA ioctl touches data stored in struct kvm_vcpu, and
    therefore should not be performed concurrently with any VCPU ioctl
    that might cause KVM or the processor to use the same data.
    
    Adds vcpu mutex guard to the VMSA updating code. Refactors out
    __sev_launch_update_vmsa() function to deal with per vCPU parts
    of sev_launch_update_vmsa().
    
    Fixes: ad73109a ("KVM: SVM: Provide support to launch and run an SEV-ES guest")
    Signed-off-by: default avatarPeter Gonda <pgonda@google.com>
    Cc: Marc Orr <marcorr@google.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Brijesh Singh <brijesh.singh@amd.com>
    Cc: kvm@vger.kernel.org
    Cc: stable@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Message-Id: <20210915171755.3773766-1-pgonda@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    bb18a677
sev.c 65.7 KB