Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp931147pxb; Tue, 14 Sep 2021 11:50:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb4+OXgxCK76EycqeZ0ZzQt1CSuyAhUPk6y/m9GApbnCBZHqnuxS2iWGAPDTsa+orjRNa8 X-Received: by 2002:a92:d8cc:: with SMTP id l12mr3284712ilo.166.1631645452009; Tue, 14 Sep 2021 11:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631645452; cv=none; d=google.com; s=arc-20160816; b=UFQjphWjVaXxYKGHIijTX4seMd96jmP+zpSWSwdt8dOygOVamWOPsFX1f3Ud24zURq wvKZoEmET3BTB2p9W7eo4wruTWSPizIZ0Ed/pBmMuW270+GxkaBINGRb1dEeb1MwDWNu nnbUSPdfHZR9YGSaA02VTOQQ7RsW+rIHh3Ib97CdG8DBBRsCmDfF5aFoKev49vcUH6Ry vHm/DHQABnTYffUPkW6W7dRqEwXynZ1ch2L58tIMvRuzwX/ciFQo56sgHm9rN7lJSXQ0 xOWzA3JBtb4FMcCgJE+e4WgFPrBq0dsIhxrS2Csstb7hklix54Rbmamas4Ifi+xuGkrQ /Ncw== 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=561Sii/7Vnw9t2pBiBSueXkca1YF3r2gcFv6BNuZUlY=; b=K3YbQrN2TavHLXjk1ylGBH3c6oLNUGZqDnz6k5pwbi4ArETOrp7xZ9BmEoP31hv++m cyjMdWEYA5UlH7iVQfKvdVYLRIrWsrJ1kCjVaZcXFZux24qExpgJzDDWMPxOS6fJL5HO EuUYoadYN1JXqPhS4xNXJHgqURG/vdSxD9ysIsIpToaXYH12wgYrHno47mQE8pbjQh0w Hn6868qFqocqewGOtUkIL5AFaWCy0OloAIb+CaHZksGOp0mheOnsMhSdMOjTVLAqbbmh fDnpXTOR46350XkVOZGPgqEnTiJOEXL1b53xHMsOaSNq/XPJI//wKF/sqP6FetiP+Q7Z Z77g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CU3iuOhK; 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 m43si10929930jav.131.2021.09.14.11.50.37; Tue, 14 Sep 2021 11:50:51 -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=CU3iuOhK; 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 S232177AbhINSvF (ORCPT + 99 others); Tue, 14 Sep 2021 14:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232102AbhINSu6 (ORCPT ); Tue, 14 Sep 2021 14:50:58 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A63C061574 for ; Tue, 14 Sep 2021 11:49:40 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id f21so6633630plb.4 for ; Tue, 14 Sep 2021 11:49:40 -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=561Sii/7Vnw9t2pBiBSueXkca1YF3r2gcFv6BNuZUlY=; b=CU3iuOhK9BrlY2sp64svAK319eSzl4i7OV0UM4XGwQGUtlXxAIdOw5MGZFb98qVQaC AgdKZO90Ph5BYBKt1POqky7wb5lJQg81Xb5aLjJ94nUeUy7YHNv29m/U1VbpdUsPf0vi 4gtWz36S7QywD3t/xQW3YcrmLGz/LQp0QU9HLAl1fDE24BlR9L0ZQlBR6ks5tT60X08M NOQ6Q4vl8QobyEmb3AWoC9EtdZJlAAbfkcDSEGtR8kmsrm4nvjQaDR3t8Xjqs36djp4/ nvBWFLZtNfEwHA58bTnFGm0W0etD9FZViZvn3nSyIk0W0ZilkekwtD4GfRVxq681wuw4 cGDQ== 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=561Sii/7Vnw9t2pBiBSueXkca1YF3r2gcFv6BNuZUlY=; b=Md7HXnUJimRkKCCn2xNcLckUcrf6aPmnuracDMDkxi2eOJ/CTDu/K2YcAvZlnsE8nY aWe4KHGK+PrfXXWnRHAUiSMEWlbfKnwteA6xL+Yk6YMVb02FYeYoAotw9dYFqzUsYObW 4tNXpoo9xy59kCEHtIEzVafQpOU4TWZq2iFDcCAETtww78/kD2wGySPDDtnuwEZT+2vF YvKFxgOU4sO/AVYkxrepFbQ8aSFYzwLDDKA/4/9g3yCWLIkpGMLo7j2Ha2SaTtvYBRrE dq65qxqumgBQEWsCIbnzmHMUqxgNM1RbtS0HAuvrKVVXGj6KjAtXv4s6WNYqnYmP/HGg deww== X-Gm-Message-State: AOAM530y5XfZOGOcn4clfc5kxRozu6WSICTMjY51rHiZW2rQfSt9n41G RzF2DYJXt8pCh5p0imNjtVv4/w== X-Received: by 2002:a17:90a:2:: with SMTP id 2mr3711554pja.77.1631645379434; Tue, 14 Sep 2021 11:49:39 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u15sm11739188pfl.14.2021.09.14.11.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 11:49:38 -0700 (PDT) Date: Tue, 14 Sep 2021 18:49:35 +0000 From: Sean Christopherson To: Peter Gonda Cc: kvm list , Marc Orr , Paolo Bonzini , Nathan Tempelman , Brijesh Singh , linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: SEV: Disable KVM_CAP_VM_COPY_ENC_CONTEXT_FROM for SEV-ES Message-ID: References: <20210914171551.3223715-1-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021, Peter Gonda wrote: > On Tue, Sep 14, 2021 at 12:41 PM Sean Christopherson wrote: > > > > -stable, for giggles > > > > On Tue, Sep 14, 2021, Peter Gonda wrote: > > > On Tue, Sep 14, 2021 at 11:32 AM Sean Christopherson 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. > > > > Is it doable without KVM updates? If so, then outright rejection may not be the > > correct behavior. > > I do not think so. You cannot call KVM_SEV_LAUNCH_UPDATE_VMSA on the mirror > because svm_mem_enc_op() blocks calls from the mirror. So either you have to > update vmsa from the mirror or have the original VM read through its mirror's > vCPUs when calling KVM_SEV_LAUNCH_UPDATE_VMSA. Not sure which way is better > but I don't see a way to do this without updating KVM. Ah, right, I forgot all of the SEV ioctls are blocked on the mirror. Put something to that effect into the changelog to squash any argument about whether or not this is the correct KVM behavior. Thanks!