Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1113360pxb; Thu, 21 Oct 2021 16:12:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYIplLp3jGBpL/55xe8rGt63BRpS59SeGG5m7/uILh5DcJk6wiyCMwCuh9fva4ivD/ZUv0 X-Received: by 2002:a17:90a:4f07:: with SMTP id p7mr9964289pjh.139.1634857929666; Thu, 21 Oct 2021 16:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634857929; cv=none; d=google.com; s=arc-20160816; b=l5GygPHsphqHND5m+K5XgDl7R0/6Di0JPQC5W2egCQhRZIXQTVIaz8KGdPat1CFkvt jQ5skTjoI2e9gXv7rU7y4YQZdVnp49E7Mu83WS3UD10mRPTeYYARbyS+CzKEPjyh0A6+ 0gU5xqisd77cVUIwJAvDbQxYpDT09iWb9kFqfT6dvLEsNjd0GwS9tvPp0/wMUigfsyZl GwLM9Es8OiYZ3o+sgFRfDbjvCeWLmQPOICxkh80zRjeiONOR2wX+rHnhJzJX9I7A5H2g NlUx2WzeUrYJWAd25r1Tvr3kk0irkzW5+/4vVslarjcMZbelpt810jK/QAzpoD5LewBz mBPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=XYdsUZzx5QU5AAt5z09EOuFHW+CZ0X7lELgHpIVoMrc=; b=vqffq/KOxo4PJs7yp9thoaa8T5d3V61EjLQXX3W58Odl4gKXJRV8ak7dLAkI6XDUV4 Zf5EahY93xCfERiuVmcSV9KuFwKN0v69mxbj8fku8xN6TNIJqKBVdKDaJPW9emeLf+UB 09N7zSlfyLZHemZyO0AWKIxlQ5HESLpHk7nGVU6ZK4S0YqOos7+FdXmnlNE9tYYAvgQS aKbN/IbmuXBafGo/s3xEfHSSwCP4bnim692sS/eBJZ7t3imApnR/MxNAJq6YrtUNp93T R2Tepu+J3CUt0P+++LiYo4EhlvW+JjIOcNjyG8z5SN0jEI5jUkfPTV6tS4dLxOPiJwwU du8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EYPWy8BA; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si11646383plf.362.2021.10.21.16.11.57; Thu, 21 Oct 2021 16:12:09 -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=@redhat.com header.s=mimecast20190719 header.b=EYPWy8BA; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbhJUXMf (ORCPT + 99 others); Thu, 21 Oct 2021 19:12:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32890 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhJUXMd (ORCPT ); Thu, 21 Oct 2021 19:12:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634857816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XYdsUZzx5QU5AAt5z09EOuFHW+CZ0X7lELgHpIVoMrc=; b=EYPWy8BAfRaaGnSHPVgA/Z66P1T9zjK/YCUjvFtXWBooaG1wVNr6Y8ME7plAFO5ynLSUeD 4U4DKek+yCC/gKKvxlKjJWa5dtDREiWcgrx7GnmSyqBITa/1jgTFBlkxNEtQ7eLICaqB3K wEsMwwMpNWmcogN4sXCuSLibFqu6h7A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-db70K_CON-i4hMUocFdsLQ-1; Thu, 21 Oct 2021 19:10:13 -0400 X-MC-Unique: db70K_CON-i4hMUocFdsLQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D5F29126B; Thu, 21 Oct 2021 23:10:12 +0000 (UTC) Received: from starship (unknown [10.40.192.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BC276788F; Thu, 21 Oct 2021 23:10:09 +0000 (UTC) Message-ID: Subject: Re: [PATCH 1/8] KVM: SEV-ES: fix length of string I/O From: Maxim Levitsky To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: fwilhelm@google.com, seanjc@google.com, oupton@google.com, stable@vger.kernel.org Date: Fri, 22 Oct 2021 02:10:08 +0300 In-Reply-To: <20211013165616.19846-2-pbonzini@redhat.com> References: <20211013165616.19846-1-pbonzini@redhat.com> <20211013165616.19846-2-pbonzini@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-10-13 at 12:56 -0400, Paolo Bonzini wrote: > The size of the data in the scratch buffer is not divided by the size of > each port I/O operation, so vcpu->arch.pio.count ends up being larger > than it should be by a factor of size. > > Cc: stable@vger.kernel.org > Fixes: 7ed9abfe8e9f ("KVM: SVM: Support string IO operations for an SEV-ES guest") > Signed-off-by: Paolo Bonzini > --- > 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 c36b5fe4c27c..e672493b5d8d 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -2583,7 +2583,7 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) > return -EINVAL; > > return kvm_sev_es_string_io(&svm->vcpu, size, port, > - svm->ghcb_sa, svm->ghcb_sa_len, in); > + svm->ghcb_sa, svm->ghcb_sa_len / size, in); > } > > void sev_es_init_vmcb(struct vcpu_svm *svm) This ends in kvm_sev_es_ins/outs and both indeed expect count of operations which they pass to emulator_pio_{out|in}_emulated Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky