Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp530766pxb; Wed, 13 Jan 2021 09:21:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfmUOce6QWmeuUKetvllBJ/00wCORPgDRR/U5aZ3hLRklBrXG95DomdP1GSYt8IMtbzTXX X-Received: by 2002:a50:e846:: with SMTP id k6mr2675466edn.245.1610558485395; Wed, 13 Jan 2021 09:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610558485; cv=none; d=google.com; s=arc-20160816; b=vITgNQ+CH1CC6RRT9d08Xlu3wTZQ/97igO0be4OKbSX/r+3XhGSIQxJ5Fcm/rsKAZE 1ENFl8+N3D93EKo9e8fGsFcIxLwGnzpA4dd3JZzCNHX39zrfSxuX8IeEZDlccb3uMp6P vuIyC5yJXXDGENbtjIyDA46HpMxw8oT5KIV/g++pbgPZgklq3NSRF9d45VlQnoMDn6EE OHvIclYRxSeTUCwxNIC9bek4ewfhclw32dYa+mSWyvZNZ2vTh5xRbrcvRMeNd4hplDj/ pAPfC5OGGdrWL2o5eJnylwT4/itLK2/An8+a5g5fjdLCQ/CnvbN5btnNL61SVPO76eEm oYdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=RtqK698Gz2UPmkSrQZ+1pqM9fJn9xrCeQ0Ydv7oehh8=; b=vDju5gJ6vvqximFkTEE6+KGAqO57AgANlSaYNbclyiLUqC7zT6xO1mAeJ8rhkBxEDc 6/o38o8+l8MOaELPRsVwz0DSR0aHM+KQ5Oyr5utT/t5UUifnfGRRYXEcUBWZP7W++Z2Z WqVgaYzKPDkWLQ+5JWMwqvHYJIXZCFw+6wVBqWpPVWjoGq5oWHEoT/Xne0oUfzSbbxOZ 8RtKJcpNUABro93L02V4glyMtOVd3dSrZTbYwxau31jU+1w1HPQ/53ylYQBWskyVcDSC PtmXg8DpvITii9KCPNdjeqxPrUFKUEbu8Fn3ueWa4BldjWmnwh5eC0Do/GFBFeL6Wpj0 FK+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iIKHIaaz; 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 18si1216682eju.589.2021.01.13.09.21.01; Wed, 13 Jan 2021 09:21:25 -0800 (PST) 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=iIKHIaaz; 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 S1728281AbhAMRT6 (ORCPT + 99 others); Wed, 13 Jan 2021 12:19:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21575 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728034AbhAMRT5 (ORCPT ); Wed, 13 Jan 2021 12:19:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610558311; 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=RtqK698Gz2UPmkSrQZ+1pqM9fJn9xrCeQ0Ydv7oehh8=; b=iIKHIaaz1gbya8B3lnbR6afcNY6/GsKsxYtxumDZACzeiD+W73yqzaWs4yK8dLhHOliTQG MGxy7mvHNCSZoTyFY93JSPXX61lwKh2+QRkMA/0Bn1gWBBYrRjyEuDlX2qlIvtWQ6DiZWA 3dbWfjSpS3xXAbwssPFG9Uconwp6gsw= 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-551-wnXSPicHN36julsnJPTxOA-1; Wed, 13 Jan 2021 12:18:26 -0500 X-MC-Unique: wnXSPicHN36julsnJPTxOA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3243F1081B2F; Wed, 13 Jan 2021 17:18:25 +0000 (UTC) Received: from [10.36.114.165] (ovpn-114-165.ams2.redhat.com [10.36.114.165]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7812660BF1; Wed, 13 Jan 2021 17:18:22 +0000 (UTC) Subject: Re: [PATCH 2/9] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read To: Alexandru Elisei , eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, drjones@redhat.com Cc: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com References: <20201212185010.26579-1-eric.auger@redhat.com> <20201212185010.26579-3-eric.auger@redhat.com> <888cf519-8c0e-f781-98a1-86594bdfacb1@arm.com> From: Auger Eric Message-ID: Date: Wed, 13 Jan 2021 18:18:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <888cf519-8c0e-f781-98a1-86594bdfacb1@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexandru, On 1/6/21 6:12 PM, Alexandru Elisei wrote: > Hi Eric, > > The patch looks correct to me. kvm_vgic_addr() masks out all the bits except index > from addr, so we don't need to do it in vgic_get_common_attr(): > > Reviewed-by: Alexandru Elisei > > One nitpick below. > > On 12/12/20 6:50 PM, Eric Auger wrote: >> The doc says: >> "The characteristics of a specific redistributor region can >> be read by presetting the index field in the attr data. >> Only valid for KVM_DEV_TYPE_ARM_VGIC_V3" >> >> Unfortunately the existing code fails to read the input attr data >> and thus the index always is 0. > > addr is allocated on the stack, I don't think it will always be 0. I removed this statement in the commit message. Thanks! Eric > > Thanks, > Alex >> >> Fixes: 04c110932225 ("KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") >> Cc: stable@vger.kernel.org#v4.17+ >> Signed-off-by: Eric Auger >> --- >> arch/arm64/kvm/vgic/vgic-kvm-device.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c >> index 44419679f91a..2f66cf247282 100644 >> --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c >> +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c >> @@ -226,6 +226,9 @@ static int vgic_get_common_attr(struct kvm_device *dev, >> u64 addr; >> unsigned long type = (unsigned long)attr->attr; >> >> + if (copy_from_user(&addr, uaddr, sizeof(addr))) >> + return -EFAULT; >> + >> r = kvm_vgic_addr(dev->kvm, type, &addr, false); >> if (r) >> return (r == -ENODEV) ? -ENXIO : r; >