Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp617254pxj; Thu, 27 May 2021 07:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSJbikuHDOR/vVBtwCVUOCrIqKoPt4YQ5BLSGmK/j1EO8mNOLc7aV88e4eU/QzwEvYlZhe X-Received: by 2002:a17:906:2894:: with SMTP id o20mr4168973ejd.520.1622127406437; Thu, 27 May 2021 07:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622127406; cv=none; d=google.com; s=arc-20160816; b=WbdHHNPstx8g4g5dHhz8EJEXHIVYi0uLS7U56QNtx3rjC9PZ5xtnPwBvFaB/katpYM II6jgZN6vSpxpnJnEuGcoxS1FEtE21s4lrr2ikI1DkODRiKMUA3lUbZQhnkg5Y7Re7Fd +nkjGGmZObgk9tO3rxs0U7W98F/N94OjCaobHxh/jelj4Nf2TGdmqR0nzkP3GIDSmkto /4HXT/QraXNh7fVU9yp5Ma0VCHYIH4RwSAdPVCcEyTrtX2j4SJQk584/b4P4udWdqxIW 0bhcpsKYToL6ZLmIizpNBh8Nbm58OXghl2cC1W7qpOqGEAAbG9d0uDiqa9FGT0I8Ajfz Mqvw== 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=x9KH/1lPiIkcCQPmeLo86wbSmxo1qWbgqdCukC2V65M=; b=mHnN7xmi959lTFYLv99dRc61k4QqpMCSbfaZmFWroHpOZaljOfGVX/48JTHpcs4m+D waX3oHkJwj0qRyfD01YtNZYSx0JXSdHlVXFo4sL9e1yMc/WScNWEpMxUDTrJ4hitILc2 M6lM22KiMlnhPnGpFCwfCoLMmGvwIqECWGULqs7pquNpN65ZQahZN+eamC/Xa1GUTeku Cgw4mrrU13CsThpyBcL2aG8+hBbQGKgCPl7kVZLFA9HZm4ZqJ2ntciPKq1yIdk3WboZF 672h7EJ4V7vUDrZjLJgykrc1B+wqrFbSwOO3dKSkys9JlnKbkOce4bTMDqkgm0k6jVof 8f1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=fMUbeAdG; 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 k13si2348073ejb.687.2021.05.27.07.56.19; Thu, 27 May 2021 07:56:46 -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; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=fMUbeAdG; 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 S234832AbhE0HOO (ORCPT + 99 others); Thu, 27 May 2021 03:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234709AbhE0HOD (ORCPT ); Thu, 27 May 2021 03:14:03 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F81C061574; Thu, 27 May 2021 00:12:25 -0700 (PDT) Received: by ozlabs.org (Postfix, from userid 1007) id 4FrJsx3nZ0z9sX5; Thu, 27 May 2021 17:12:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1622099541; bh=Lefrtr63WtZPzxCJD/a0Dt0CwKqdjDj9tbK9ydRsQZA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fMUbeAdG8FfOw30NsEJoAerE2i88uoQM3TbXYsIqJzw49r1s6kG8D5t4trO1VCikP +rVJ2VxCicTOzRkJBR0xiHrYjWjJgK1YyFW/0R83MMdBht/clN1NyHUc7DS35Yjt17 S75HTnNVpEtzMDbFQRWK1Q6j/r/BpiosihFY3ZeM= Date: Thu, 27 May 2021 15:00:12 +1000 From: David Gibson To: Kirti Wankhede Cc: Jason Gunthorpe , Alex Williamson , "Liu, Yi L" , Jacob Pan , Auger Eric , Jean-Philippe Brucker , "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" , Alexey Kardashevskiy , Neo Jia Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: References: <20210428145622.GU1370958@nvidia.com> <20210503161518.GM1370958@nvidia.com> <20210513135938.GG1002214@nvidia.com> <20210524233744.GT1002214@nvidia.com> <20210525195257.GG1002214@nvidia.com> <6b13399d-cf03-1e71-3624-c39d4d05e958@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Z64+IwN5nyf9pBFr" Content-Disposition: inline In-Reply-To: <6b13399d-cf03-1e71-3624-c39d4d05e958@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Z64+IwN5nyf9pBFr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 26, 2021 at 02:48:03AM +0530, Kirti Wankhede wrote: >=20 >=20 > On 5/26/2021 1:22 AM, Jason Gunthorpe wrote: > > On Wed, May 26, 2021 at 12:56:30AM +0530, Kirti Wankhede wrote: > >=20 > > > 2. iommu backed mdev devices for SRIOV where mdev device is created p= er > > > VF (mdev device =3D=3D VF device) then that mdev device has same iommu > > > protection scope as VF associated to it. > >=20 > > This doesn't require, and certainly shouldn't create, a fake group. > >=20 > > Only the VF's real IOMMU group should be used to model an iommu domain > > linked to a VF. Injecting fake groups that are proxies for real groups > > only opens the possibility of security problems like David is > > concerned with. > >=20 >=20 > I think this security issue should be addressed by letting mdev device > inherit its parent's iommu_group, i.e. VF's iommu_group here. No, that doesn't work. AIUI part of the whole point of mdevs is to allow chunks of a single PCI function to be handed out to different places, because they're isolated from each other not by the system IOMMU, but by a combination of MMU hardware in the hardware (e.g. in a GPU card) and software in the mdev driver. If mdevs inherited the group of their parent device they wouldn't count as isolated from each other, which they should. >=20 > Kirti >=20 > > Max's series approaches this properly by fully linking the struct > > pci_device of the VF throughout the entire VFIO scheme, including the > > group and container, while still allowing override of various VFIO > > operations. > >=20 > > Jason > >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Z64+IwN5nyf9pBFr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmCvJ1wACgkQbDjKyiDZ s5LA1A/9HdoNik7wBiSYXbYApT72IFI+LhekrRCOipo8yeKeq0f2VM5RS34wrfFw 1Uhvw2jZYG8HWgG6XQczVwGyXtXtKQQL/S8djvv2Nqp3xY+++sPj2HO1xy7051m6 UpAR0ILjYOHTzj4DQI4uR7iRt6JcfK6+gedGouV++4suDp95Ta4xBo5rLBkjqn8l VrPRt6AVMCYvVRcDb6iRhofAvhFOIjGJfarivrhPS3BzDCBrk2/BXxQ61lYy1dR9 8qqb3CFFQWbyfgtaQXz8gAQLULpWX10Ob2tUaQRrWz3iZG0H/Iq5ffX3PPuQUsjg fIs8GH7xxWe0/7tUVzS+iwhGwcS7TmA5uktxiITJHNB/aDG3yQpzLNoLGn9fQP6h POpSLPQY1MyPvTO9ZF91celXdAZialXuchORnG+zHmzDcG0z1NPUYORzmR0G8D8V tuCAUL/3ayA5pR6j0X4zcpWmn32CQyC6WJ113cDDQga7fFXCbyw7zilXISGRcxHY 7PA6tsnrBbVpuuYsJINgP/NM/eHgW1U07NSiNyIjj8UNPJPjGYFm/8obYwwXTIbF Fqv0tBPGrmq9rKbfG9Xl12SVKMdmF7f1wHVNLc6SUvUiAIVswax4YPMJmiBBoSZ9 dbzfFlE13orgt8fbZ+nYuBx9L7xc2E+kNJcw/7a45nldRaqkH8U= =yhde -----END PGP SIGNATURE----- --Z64+IwN5nyf9pBFr--