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]
Message-ID: <Z8H09l8PzqfGjC8s@Asurada-Nvidia>
Date: Fri, 28 Feb 2025 09:40:06 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Robin Murphy <robin.murphy@....com>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <joro@...tes.org>,
	<will@...nel.org>, <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/4] iommu: Add private_data_owner to iommu_domain

On Fri, Feb 28, 2025 at 04:29:17PM +0000, Robin Murphy wrote:
> On 28/02/2025 1:31 am, Nicolin Chen wrote:
> > @@ -435,6 +436,7 @@ int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base)
> >   	cookie->msi_iova = base;
> >   	domain->iova_cookie = cookie;
> >   	iommu_domain_set_sw_msi(domain, iommu_dma_sw_msi);
> > +	domain->private_data_owner = IOMMU_DOMAIN_DATA_OWNER_DMA;
> 
> This doesn't help all that much when it can still be called on any old
> unmanaged domain and silently overwrite whatever the previous user thought
> they owned...

We could add another validation on top of this function to reject
private_data_owner != IOMMU_DOMAIN_DATA_OWNER_NONE?

> And really the "owner" of MSI cookies is VFIO, it just happens that all the
> code for them still lives in iommu-dma because it was written to piggyback
> off the same irqchip hooks. TBH I've long been keen on separating them
> further from "real" IOVA cookies, and generalising said hooks really removes
> any remaining reason to keep the implementations tied together at all,
> should they have cause to diverge further (e.g. with makign the MSI cookie
> window programmable). What I absolutely want to avoid is a notion of having
> two types of MSI-mapping cookies, one of which is two types of MSI-mapping
> cookies.
> 
> Hopefully that is all clear in the patch I proposed.

Yea, decoupling the MSI cookie from the iova_cookie makes sense
to me. I had the same feeling last week when I was preparing the
cleanup patch that added a iommu_put_msi_cookie(), but hesitated
after foreseeing a big rework that I was not sure you would like
or not. Glad that you did it..

With your patch now we even merged the two unions, which is nicer
from my point of view.

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ