Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp946016pxb; Tue, 14 Sep 2021 12:13:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGS+UVFkK5CUkXdXWpmi4tig6Eyogj1M5GoyvxWBafM8FCNny7juL54LZPx8YND8WXgMC9 X-Received: by 2002:a6b:3c16:: with SMTP id k22mr15082887iob.130.1631646824547; Tue, 14 Sep 2021 12:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631646824; cv=none; d=google.com; s=arc-20160816; b=iDR5Tagefgh0t5vwgvSTfKzWZRBzuOVyTeFZTtfNPAYWtfWmb1DkwMF3yJjgVKNiTG z+ahECLPv1Y48UoEvuHC5wxemc8omJAY69hILoXK9Otyq7pRAvnIYjyfpC4rmJgB9cYR umrKCz3pq7wK1f+Chp5diF3DFYWGTFJUuPylAeujm00LGUi7oy2u1QIrVwNOos+LOvhT FuaZlJqEBIiRZ4+2fOi9AigH5qB3o2aBkBSiJNlyIoVVIBKrHTlxuJ22wTWwdfPw4qU+ vxh4tx7ddMpNBZK6538owm3nKYzDTB1UiNLBHttgVsKvw2QtvYE59qzUPvQJtpCW/4TS HVAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JavJkkOpz22nHzp7w49aNBW1DkmZK4vezafTuT+JB/Q=; b=M19VgsB20O7pV23jNa+5wYhjK7m8yRhy5sD86Gq7vkiRfU3GMG21s0058ulZCoZ+Cz 0ys3PpM+oumX7TZTeK/YHmym9/aoVsAvAfKpvOm7DeWmfIuq1+x0EHCWgrU/MWoSI8un Nc4dORFvR5QY4aqTKZ3NfjRrdbQ0tAYY8SAh28xIPXYzjqkhr3c387vFQgLJlCXTS6iN eDl+ZiZ7q2qR8puWBvepCFtiIvE1sQJWWRs0dz5Re0skJbDBWj4vsKyzAtOowANa8DrA 3FaksJtW31sritUWNhHMTmQ+3W4USUj8hqxvs48b/Qj28BNM2CFyYIDTiISk1fcU0NSG JUAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tXfF+z4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si9889842ion.66.2021.09.14.12.13.33; Tue, 14 Sep 2021 12:13:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tXfF+z4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232853AbhINTN5 (ORCPT + 99 others); Tue, 14 Sep 2021 15:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233399AbhINTNu (ORCPT ); Tue, 14 Sep 2021 15:13:50 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABAB9C0613C1 for ; Tue, 14 Sep 2021 12:12:25 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id 17so157433pgp.4 for ; Tue, 14 Sep 2021 12:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JavJkkOpz22nHzp7w49aNBW1DkmZK4vezafTuT+JB/Q=; b=tXfF+z4Yp+j8wWRQ41nGFR/bXPMSsEbE/fDdg9Ns4z8fATNJ/9CmhIyx7vMmciv2sS URPJp/bYnqqm6wnuQVv5PLqBxYPDevjCgEdRXIf6irJlaBZJW2Sllz792nFeQAKz1iEO VAilgKi1UEnb0ptCIEVmobEbo9Ir7l59XB6VfJGEj9KErgoP/CFurKO0p1Ykov6cUvQH Bg03uL9DzFdnrrq4VXEoFjjm5830Rj0EvGlmkBPxfhBhxKN12Y3ucm9GC8gxLivYI/RB kVdGHmmfZtqLW/XJZLKcxABywnOXIoK8nmx62ep4A0IpVC+JyhKvIvs4MuvvjUJp0HID x7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JavJkkOpz22nHzp7w49aNBW1DkmZK4vezafTuT+JB/Q=; b=DddUB21q0SPaZMR11jO/4XGOAh/G4hsvDjIC8JRqOu+VtUU1m0VksZYoZjYdV17fyg Pff578t6CuzIBrnjtoCq9JHQBirHSCk0T0rGJ+I3B7Q/9ez8eAP4u+UQILJJ/Gk/qcJT FreQcfYcIC94pH7oyzpr9pSDyjNDvh5lBe1NI+KAlHyg61Wy1K9ARxy7UKxSFWVTMJtY ypzZsLoHnjLP/sGg174UbZ7lvuC/be8fvDIgdqVthIzbtemR5svW8SHkgsOUNQs1RCIA AAHBtwOSVuhRs+Th/CQtP1fe4iY3PBbS0/hzJxKgUEOF3D0GtSlfJeq4JDG0vGny9h+R /ZLA== X-Gm-Message-State: AOAM532FjNPfOmSPtekPskPIkSJRcf7+JwsoAtqd8rXWM/NnDfzKb2+7 ULyiLVhZmbAbYqKSt/M3HOjnKA== X-Received: by 2002:a63:1247:: with SMTP id 7mr16718436pgs.366.1631646744947; Tue, 14 Sep 2021 12:12:24 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id p27sm6765934pfq.164.2021.09.14.12.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 12:12:24 -0700 (PDT) Date: Tue, 14 Sep 2021 19:12:20 +0000 From: Sean Christopherson To: Peter Gonda Cc: kvm@vger.kernel.org, Marc Orr , Paolo Bonzini , Nathan Tempelman , Brijesh Singh , stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] KVM: SEV: Disable KVM_CAP_VM_COPY_ENC_CONTEXT_FROM for SEV-ES Message-ID: References: <20210914190125.3289256-1-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210914190125.3289256-1-pgonda@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The destination VM is already checked for SEV and SEV-ES > with sev_guest(), so this ioctl already fails if the destination is SEV > enabled. > > Enabling mirroring a VM or copying its encryption context with an SEV-ES > VM is more involved and should happen in its own feature patch if that's > needed. This is because the vCPUs of SEV-ES VMs need to be updated with > LAUNCH_UPDATE_VMSA before LAUNCH_FINISH. This needs KVM changes because > the mirror VM has all its SEV ioctls blocked and the original VM doesn't > know about the mirrors vCPUs. mirror's, or I guess mirrors'? :-) > Fixes: 54526d1fd593 ("KVM: x86: Support KVM VMs sharing SEV context") > > V2: > * Updated changelog with more information and added stable CC. Nit, but this in the section ignored by git (below the ---) so that omitted from the committed changelog. > Signed-off-by: Peter Gonda > Cc: Marc Orr > Cc: Paolo Bonzini > Cc: Sean Christopherson > Cc: Nathan Tempelman > Cc: Brijesh Singh > Cc: kvm@vger.kernel.org > Cc: stable@vger.kernel.org > Cc: linux-kernel@vger.kernel.org Reviewed-by: Sean Christopherson > --- Git ignores stuff in this section. > arch/x86/kvm/svm/sev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index 75e0b21ad07c..8a279027425f 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -1728,7 +1728,7 @@ int svm_vm_copy_asid_from(struct kvm *kvm, unsigned int source_fd) > source_kvm = source_kvm_file->private_data; > mutex_lock(&source_kvm->lock); > > - if (!sev_guest(source_kvm)) { > + if (!sev_guest(source_kvm) || sev_es_guest(source_kvm)) { > ret = -EINVAL; > goto e_source_unlock; > } > -- > 2.33.0.309.g3052b89438-goog >