lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Aug 2023 08:24:49 +0000
From:   "Tian, Kevin" <kevin.tian@...el.com>
To:     Baolu Lu <baolu.lu@...ux.intel.com>,
        Joerg Roedel <joro@...tes.org>,
        "Will Deacon" <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        "Jason Gunthorpe" <jgg@...pe.ca>,
        Jean-Philippe Brucker <jean-philippe@...aro.org>,
        Nicolin Chen <nicolinc@...dia.com>
CC:     "Liu, Yi L" <yi.l.liu@...el.com>,
        Jacob Pan <jacob.jun.pan@...ux.intel.com>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 1/3] iommu: Make single-device group for PASID explicit

> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Tuesday, August 22, 2023 2:37 PM
> 
> On 2023/8/21 14:33, Tian, Kevin wrote:
> >> From: Baolu Lu <baolu.lu@...ux.intel.com>
> >> Sent: Monday, August 21, 2023 1:45 PM
> >>
> >> On 2023/8/18 11:56, Tian, Kevin wrote:
> >>>> From: Lu Baolu <baolu.lu@...ux.intel.com>
> >>>> Sent: Monday, August 14, 2023 9:18 AM
> >>>>
> >>>> The PASID interfaces have always supported only single-device groups.
> >>>> This was first introduced in commit 26b25a2b98e45 ("iommu: Bind
> >> process
> >>>> address spaces to devices"), and has been kept consistent in
> subsequent
> >>>> commits.
> >>>>
> >>>> However, the core code doesn't explicitly check for this requirement
> >>>> after commit 201007ef707a8 ("PCI: Enable PASID only when ACS RR &
> UF
> >>>> enabled on upstream path"), which made this requirement implicit.
> >>>>
> >>>> Restore the check to make it explicit that the PASID interfaces only
> >>>> support devices belonging to single-device groups.
> >>>>
> >>>> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
> >>>> ---
> >>>>    drivers/iommu/iommu.c | 5 +++++
> >>>>    1 file changed, 5 insertions(+)
> >>>>
> >>>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> >>>> index 71b9c41f2a9e..f1eba60e573f 100644
> >>>> --- a/drivers/iommu/iommu.c
> >>>> +++ b/drivers/iommu/iommu.c
> >>>> @@ -3408,6 +3408,11 @@ int iommu_attach_device_pasid(struct
> >>>> iommu_domain *domain,
> >>>>    		return -ENODEV;
> >>>>
> >>>>    	mutex_lock(&group->mutex);
> >>>> +	if (list_count_nodes(&group->devices) != 1) {
> >>>> +		ret = -EINVAL;
> >>>> +		goto out_unlock;
> >>>> +	}
> >>>> +
> >>>
> >>> I wonder whether we should also block adding new device to this
> >>> group once the single-device has pasid enabled. Otherwise the
> >>
> >> This has been guaranteed by pci_enable_pasid():
> >>
> >>           if (!pci_acs_path_enabled(pdev, NULL, PCI_ACS_RR | PCI_ACS_UF))
> >>                   return -EINVAL;
> >>
> >
> > well since you are adding generic core check then it's not good to
> > rely on the fact of a specific bus...
> 
> We attempted to do this in the patch linked below.
> 
> https://lore.kernel.org/linux-iommu/20220705050710.2887204-5-
> baolu.lu@...ux.intel.com/
> 
> After long discussion, we decided to move it to the pci_enable_pasid()
> interface. The non-static single device group is only relevant to PCI
> fabrics that support hot-plugging without ACS support on the upstream
> path.
> 

If that's the case better add a comment to include this fact. So 
another one looking at this code won't fall into the same puzzle
wondering what about a group becoming non-singleton after
above check. 😊

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ