Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp890174iog; Fri, 24 Jun 2022 17:14:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1snZoOQ0NOulRGIM/PzmGdajmQiJYTjSsuLlXSfo30mrMINZIKgi8OJwp7piha2Jw+/gESc X-Received: by 2002:a17:90b:390c:b0:1ec:ae13:c5aa with SMTP id ob12-20020a17090b390c00b001ecae13c5aamr6769102pjb.64.1656116051487; Fri, 24 Jun 2022 17:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656116051; cv=none; d=google.com; s=arc-20160816; b=HK0i6fWOWJA3MdgM1ZR6nGRld5Bj2gT0sQyJhri7iIKur/aDHboLWpNTh6tWolglfR tn5CQkY9qFAkmnrCcw9HsTk9XxF0Dtz90sKub02VTe2uLzdvjtTzwdp4ifNUqwsU6cPY /YfUcSCawmiGi08rwiFA7CrDvg8ForfS9fdecfwdWRbDa7EioasKWUWkAMgNzDM94xgV nEfgTEE/GbsGquk0KHaEJXHW+tMP4XKYCbvRt8ZCCQrxCIEpT/ywuuPZGauv8JuGTdgM DR3x6AAyt5zUFIUaDlWkZtwJU2dQyW7BKzHYqDaL0FcmK7vJ2JhQEYFmbbrhccV4GXvD l7MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+zgAHdqbW6KkxfirWh5m0boNH0Y6RXgaT47LaNHIE6s=; b=B9J8hN7UpICMzy1N4Fv7aWaYJI8uVpn+FUR0IADXrjGZUMY9O1TfkHPVGEyiwaqIAj RVp+DcLhqV/c4DuyFK63MQAJCy7vvYOWw5Hq58+4gs3a9grZTs8IgB1V31cQQBwtK8Bt iayaL/JLPbLgxkvMYzJxLzGnely658yMxO38o/aX44bdrWgMF+oTNJmPtG/N0yNYpHXx G341XIPQHAObCmKiiBO7ld2fy63zDXOflSkMI/uznFh0vTSvJC2M+5Cl7otpUMQRSMPQ UFzK8FrLYUVXPJVD5IGvyDPS4LErcF5dDaWBCOIqeLsbaAWBOy6w1mmVbVuHDlbifwnt gPHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=DVIjgeM5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a17090a891400b001e893885b7fsi4262267pjn.4.2022.06.24.17.14.00; Fri, 24 Jun 2022 17:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=DVIjgeM5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbiFYANH (ORCPT + 99 others); Fri, 24 Jun 2022 20:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbiFYANG (ORCPT ); Fri, 24 Jun 2022 20:13:06 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 219E9B866 for ; Fri, 24 Jun 2022 17:13:06 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id o43so6900147qvo.4 for ; Fri, 24 Jun 2022 17:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+zgAHdqbW6KkxfirWh5m0boNH0Y6RXgaT47LaNHIE6s=; b=DVIjgeM5e5IxUFbVXZ7bgClbz5kfHXGvHXEg2J3j1BQd6oPPHRoewezWMdHbNFicJ2 e88e2BFNzXDV37YHXmXCkVZ8MSZynmhSNdYhhX27BUG5Sv0V13MLWDtWVjaDI7tP4ZIV wUUpA7Nqf5AVDpycjUx5jjljv7kK0PZZj+WblkbWltwp9EJJGdAFrdXwS8EbEqhL7IcE GG4nTIuwZPLNIA3MQxPKlazpGmrlhY26HgvE07OM0dSC/zWljIjNtEQVaWF8pWhBjRMw d8jR8emTGFIO8TphCmMEppdJirurBjsHWFxc61kaA8Ox6IwpINQXlr7sqntF23mHQ99z 2w+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+zgAHdqbW6KkxfirWh5m0boNH0Y6RXgaT47LaNHIE6s=; b=Txqg40dHIfr5yRyWBSV90s8H3+8SDmtezmY5F+5rNUTWEIeKnFf9w6Ib90rE784RLC QdhTjiWcCX+rR9sKUZpy+EFXRW6AOGJpxxv+GLujljsQSnx0ipp1zvkZIOK/TdVqqppI bCVDk999qiqiwO+bHfmyUuT/VfY723K0iw7uGFlsZYXCwGuV/ONMLQ9Y8s6iJWG0tnZ9 PvoHDuY1dP6dFh36LEv6v9hhflDAd/rH368gDjrBl4oLVIuknON4+M0ZfGq8yOh/FNKQ KOabdv370B9eM8GuGGDjWx2NAjwl6jhqwwNUCAF1Q9lQtZZhp/OzXuN+p9WGxDVkO+JV IfBA== X-Gm-Message-State: AJIora/aNfJoo683PZAKFGlEWZLuNFiHr8DIPS6B1hT0iarnHpBX3fRi FFbP24JQggUxb2STilKz8UQhHQ== X-Received: by 2002:a05:622a:1884:b0:304:f534:cfe5 with SMTP id v4-20020a05622a188400b00304f534cfe5mr1433458qtc.544.1656115985828; Fri, 24 Jun 2022 17:13:05 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id u3-20020a05620a454300b006aef6a244a4sm3108346qkp.129.2022.06.24.17.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 17:13:05 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1o4tQ8-001Idy-Qd; Fri, 24 Jun 2022 21:13:04 -0300 Date: Fri, 24 Jun 2022 21:13:04 -0300 From: Jason Gunthorpe To: lizhe.67@bytedance.com Cc: alex.williamson@redhat.com, cohuck@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lizefan.x@bytedance.com Subject: Re: [RFC] vfio: remove useless judgement Message-ID: <20220625001304.GI23621@ziepe.ca> References: <20220623115603.22288-1-lizhe.67@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220623115603.22288-1-lizhe.67@bytedance.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2022 at 07:56:03PM +0800, lizhe.67@bytedance.com wrote: > From: Li Zhe > > In function vfio_dma_do_unmap(), we currently prevent process to unmap > vfio dma region whose mm_struct is different from the vfio_dma->task. > In our virtual machine scenario which is using kvm and qemu, this > judgement stops us from liveupgrading our qemu, which uses fork() && > exec() to load the new binary but the new process cannot do the > VFIO_IOMMU_UNMAP_DMA action during vm exit because of this judgement. > > This judgement is added in commit 8f0d5bb95f76 ("vfio iommu type1: Add > task structure to vfio_dma") for the security reason. But it seems that > no other task who has no family relationship with old and new process > can get the same vfio_dma struct here for the reason of resource > isolation. So this patch delete it. > > Signed-off-by: Li Zhe > --- > drivers/vfio/vfio_iommu_type1.c | 6 ------ > 1 file changed, 6 deletions(-) I'm inclined to agree with this reasoning and deliberately did not include a similar check in iommufd. Any process with access to the container FD should be able to manipulate the IOVA space. Reviewed-by: Jason Gunthorpe Jason