On Tue, Sep 14, 2021 at 11:32 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > On Tue, Sep 14, 2021, Peter Gonda wrote: > > Copying an ASID into new vCPUs will not work for SEV-ES since the vCPUs > > VMSAs need to be setup and measured before SEV_LAUNCH_FINISH. Return an > > error if a users tries to KVM_CAP_VM_COPY_ENC_CONTEXT_FROM from an > > SEV-ES guest. > > What happens if userspace does KVM_CAP_VM_COPY_ENC_CONTEXT_FROM before the source > has created vCPUs, i.e. before it has done SEV_LAUNCH_FINISH? That's not enough. If you wanted to be able to mirror SEV-ES you'd also need to call LAUNCH_UPDATE_VMSA on the mirror's vCPUs before SEV_LAUNCH_FINISH. That is do-able but I was writing a small change to fix this bug. If mirroring of SEV-ES is wanted it's a much bigger change. > > Might be worth noting that the destination cannot be an SEV guest, and therefore > can't be an SEV-ES guest either. sev_guest() implies sev_es_guest() so I think this case is covered. > > > Fixes: 54526d1fd593 ("KVM: x86: Support KVM VMs sharing SEV context") > > Cc: stable@xxxxxxxxxxxxxxx Oops. I'll update in the V2 if needed. Added to this thread for now.