From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Wang Subject: Re: [PATCH] vhost: relax log address alignment Date: Tue, 17 Nov 2015 13:40:55 +0800 Message-ID: <564ABDE7.4040700@redhat.com> References: <1447685995-16282-1-git-send-email-mst@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1447685995-16282-1-git-send-email-mst@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org List-Id: virtualization@lists.linuxfoundation.org On 11/16/2015 11:00 PM, Michael S. Tsirkin wrote: > commit 5d9a07b0de512b77bf28d2401e5fe3351f00a240 ("vhost: relax used > address alignment") fixed the alignment for the used virtual address, > but not for the physical address used for logging. > > That's a mistake: alignment should clearly be the same for virtual and > physical addresses, > > Signed-off-by: Michael S. Tsirkin > --- > drivers/vhost/vhost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index eec2f11..080422f 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) > BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); > if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || > (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || > - (a.log_guest_addr & (sizeof(u64) - 1))) { > + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { > r = -EINVAL; > break; > } Acked-by: Jason Wang From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbbKQFlF (ORCPT ); Tue, 17 Nov 2015 00:41:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40529 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbbKQFlD (ORCPT ); Tue, 17 Nov 2015 00:41:03 -0500 Subject: Re: [PATCH] vhost: relax log address alignment To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org References: <1447685995-16282-1-git-send-email-mst@redhat.com> Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org From: Jason Wang Message-ID: <564ABDE7.4040700@redhat.com> Date: Tue, 17 Nov 2015 13:40:55 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1447685995-16282-1-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/2015 11:00 PM, Michael S. Tsirkin wrote: > commit 5d9a07b0de512b77bf28d2401e5fe3351f00a240 ("vhost: relax used > address alignment") fixed the alignment for the used virtual address, > but not for the physical address used for logging. > > That's a mistake: alignment should clearly be the same for virtual and > physical addresses, > > Signed-off-by: Michael S. Tsirkin > --- > drivers/vhost/vhost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index eec2f11..080422f 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) > BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); > if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || > (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || > - (a.log_guest_addr & (sizeof(u64) - 1))) { > + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { > r = -EINVAL; > break; > } Acked-by: Jason Wang