Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1938207pxk; Sat, 3 Oct 2020 03:03:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlbuIC7MHX+71fW/o6YXOq6TEMw5Lgc/KGqBHWzvOrhORvmQWL1orw3ygvpKW21QzrV6nU X-Received: by 2002:a50:ccc6:: with SMTP id b6mr7507645edj.329.1601719404636; Sat, 03 Oct 2020 03:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601719404; cv=none; d=google.com; s=arc-20160816; b=rgbSRKz+klqyZxqHqa4PZDmlQdFbOWOfGEh37jwnvyNBxFXjpGocUlrVAIGU8wd2WS CrRGv/EFFQvdYkIOWejZz3MrQjOaQu2dI+kjRMw9gsbXGxF47hLtJ7xOpCdYo6b8C6Yr XpqYZlCNHlbc8jzDrF6nkw6V7LaL5E7FStsO3brQr3pVpHrZKdQeXSQmYZuyGlKsgv/d fk7hlSpryG+tu1IEL5kOJr9K+VN//ryRWYFj2UMNDm+PpQek+a6/zJq+qRAIE943kVR6 SD63z8ZIDr2aZdpCaJKvjBtzoNeB5eGOxvNVLm+NkUJ+t1VQvyyuuu0877CqB1/JtC+l ZhJA== 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:message-id:date:cc:to:from:subject; bh=rTqwGvVish1W4vuZFcOXldJSjN4CZo2OJhPpmgcS240=; b=uQMmfQggIavd4LqBfuTIR3ESVzXqnYOBNYcgTfBkUbpsHil7CTLMS5beEGkAYzr0iX BTuTxqeAuuFG1VhxIuEKQF+bqfsg6omQaNEI4Gb43jiEWl4NCJRCRbPSvlcFaFgc1hGe UEMwC6liROCCmVc2+XlbObToZbvKD1dBExdxOm+LiZeYxt1Kej23lUuf+CsfSYo0kY4C tkzVomTIJHJ1ieZLXJQA+7NRkoJjVBKde68scIW5PspITmMlz9by6SldqTeQX5XNfKYI Y0B7k6IOPDKn4SzhnylJUpVc+DAvj5IM4v1iQCLgfXJRjSIfmfbvoii65tTYMpB743Fn +SCg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si3439167edm.62.2020.10.03.03.03.02; Sat, 03 Oct 2020 03:03:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725829AbgJCKBx convert rfc822-to-8bit (ORCPT + 99 others); Sat, 3 Oct 2020 06:01:53 -0400 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:28150 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgJCKBv (ORCPT ); Sat, 3 Oct 2020 06:01:51 -0400 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-582-uNrKKprfMHOGpQcR7fbb3Q-1; Sat, 03 Oct 2020 06:01:48 -0400 X-MC-Unique: uNrKKprfMHOGpQcR7fbb3Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D849B801ADE; Sat, 3 Oct 2020 10:01:46 +0000 (UTC) Received: from bahia.lan (ovpn-112-192.ams2.redhat.com [10.36.112.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C6135D9D3; Sat, 3 Oct 2020 10:01:41 +0000 (UTC) Subject: [PATCH v3 0/3] vhost: Skip access checks on GIOVAs From: Greg Kurz To: "Michael S. Tsirkin" , Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, Laurent Vivier , David Gibson Date: Sat, 03 Oct 2020 12:01:40 +0200 Message-ID: <160171888144.284610.4628526949393013039.stgit@bahia.lan> User-Agent: StGit/0.21 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series addresses some misuse around vring addresses provided by userspace when using an IOTLB device. The misuse cause failures of the VHOST_SET_VRING_ADDR ioctl on POWER, which in turn causes QEMU to crash at migration time. Jason suggested that we should use vhost_get_used_size() during the review of v2. Fixed this in a preliminary patch (patch 2) and rebased the vq_log_used_access_ok() helper on top (patch 3). Note that I've also posted a patch for QEMU so that it skips the used structure GIOVA when allocating the log bitmap. Otherwise QEMU fails to allocate it because POWER puts GIOVAs very high in the address space (ie. over 0x800000000000000ULL). https://patchwork.ozlabs.org/project/qemu-devel/patch/160105498386.68108.2145229309875282336.stgit@bahia.lan/ v3: - patch 1: added Jason's ack - patch 2: new patch to use vhost_get_used_size() - patch 3: rebased patch 2 from v2 v2: - patch 1: move the (vq->ioltb) check from vhost_vq_access_ok() to vq_access_ok() as suggested by MST - patch 2: new patch --- Greg Kurz (3): vhost: Don't call access_ok() when using IOTLB vhost: Use vhost_get_used_size() in vhost_vring_set_addr() vhost: Don't call log_access_ok() when using IOTLB drivers/vhost/vhost.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) -- Greg