Received: by 10.192.165.156 with SMTP id m28csp70142imm; Tue, 10 Apr 2018 16:38:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/u86vc6R1TpntmvIp9agN/eVofM/n8gIjkr2TZ+pD9FQax91CHpRPAyqIh6F/VIVngpHkj X-Received: by 2002:a17:902:585e:: with SMTP id f30-v6mr2437759plj.254.1523403491658; Tue, 10 Apr 2018 16:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403491; cv=none; d=google.com; s=arc-20160816; b=RvC6ghJuv+5JfoRJrug+Jyq0SfG+NcsjJ62Py7zHh3wM8fw2L+7MYHBYChg6jX861r C0Aw2NzUOmp8jcJn2biXKTC5zz9pjFXI169pIV2bUrwNp11x4+74Kwy78SgicQhngzzo 7zeB30KnD2v98X+GLJOqHY5UL3i16mzFrL1NHvxDu9UUqKStxVq4yFlp/5LYLXWK1HxZ BimPaCG87nQjgAp37d63Z5fxHcljCbQtvfLT+wFzm9E7Hv3bzKWupIhd4BuLQWMognwu UmA40PEOVRVWtbP1HwB4v1hV5rZla55ySMIef6EFEd6Dsi36oTd5YKKEaIgCAQqRX+Uz thkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=gVjk4LX3DjJmPGv6xaFtO4BI3LL4rCymxJEfOJEdtvU=; b=aDjVgQLK4LrnVR0O7yxN2j83lsDCiOv5wkruYxfiHxdLh6KbRaaSHK7I09TkfnC5K/ VfOWrxnmuNiIp+hzCCqMBWObIJaK/8RAsyOl6F+m33CIb/xH4y1my+2SswMXGW84jLjI k9gU8sR7cy6Ypng6+8UZYLCVYUe5JdJm+cKyPm4CrUiyb19ZLpqb0VqDa6vP0flU1Miq E39arXeOKGi9b9nKeDNqV8q14IldE3fQPLDEuxpMT93wREEbvtbibRjWLklH42Reh1KT Q4S3hp6pMwIBPc15223gavKlA60P3bQqJ0/6ScHK38MtpeLlolGlrabDs5G/4OR+9eFo uIfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si2325160pgc.87.2018.04.10.16.37.35; Tue, 10 Apr 2018 16:38:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754876AbeDJXdS (ORCPT + 99 others); Tue, 10 Apr 2018 19:33:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40618 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754296AbeDJXdR (ORCPT ); Tue, 10 Apr 2018 19:33:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC16D8163AD4; Tue, 10 Apr 2018 23:33:16 +0000 (UTC) Received: from redhat.com (ovpn-120-92.rdu2.redhat.com [10.10.120.92]) by smtp.corp.redhat.com (Postfix) with SMTP id 82746215CDAF; Tue, 10 Apr 2018 23:33:16 +0000 (UTC) Date: Wed, 11 Apr 2018 02:33:16 +0300 From: "Michael S. Tsirkin" To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+6304bf97ef436580fede@syzkaller.appspotmail.com, Jason Wang , "David S. Miller" , Stefan Hajnoczi Subject: Re: [PATCH 4.14 134/138] vhost: validate log when IOTLB is enabled Message-ID: <20180411023210-mutt-send-email-mst@kernel.org> References: <20180410212902.121524696@linuxfoundation.org> <20180410212917.818627954@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410212917.818627954@linuxfoundation.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 10 Apr 2018 23:33:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 10 Apr 2018 23:33:16 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 12:25:24AM +0200, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Jason Wang > > > [ Upstream commit d65026c6c62e7d9616c8ceb5a53b68bcdc050525 ] > > Vq log_base is the userspace address of bitmap which has nothing to do > with IOTLB. So it needs to be validated unconditionally otherwise we > may try use 0 as log_base which may lead to pin pages that will lead > unexpected result (e.g trigger BUG_ON() in set_bit_to_user()). > > Fixes: 6b1e6cc7855b0 ("vhost: new device IOTLB API") > Reported-by: syzbot+6304bf97ef436580fede@syzkaller.appspotmail.com > Signed-off-by: Jason Wang > Acked-by: Michael S. Tsirkin > Signed-off-by: David S. Miller > Signed-off-by: Greg Kroah-Hartman > --- > drivers/vhost/vhost.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -1252,14 +1252,12 @@ static int vq_log_access_ok(struct vhost > /* Caller should have vq mutex and device mutex */ > int vhost_vq_access_ok(struct vhost_virtqueue *vq) > { > - if (vq->iotlb) { > - /* When device IOTLB was used, the access validation > - * will be validated during prefetching. > - */ > - return 1; > - } > - return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used) && > - vq_log_access_ok(vq, vq->log_base); > + int ret = vq_log_access_ok(vq, vq->log_base); > + > + if (ret || vq->iotlb) That's a bug, davem just queued a patch to fix this upstream. > + return ret; > + > + return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used); > } > EXPORT_SYMBOL_GPL(vhost_vq_access_ok); > >