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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fed2bf95-4edd-4517-9e00-4252595d0eb9@arm.com>
Date: Mon, 24 Nov 2025 17:40:24 +0000
From: Robin Murphy <robin.murphy@....com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>, iommu@...ts.linux.dev,
 linux-kernel@...r.kernel.org, Joerg Roedel <joro@...tes.org>,
 Will Deacon <will@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>
Subject: Re: [PATCH] iommu/dma: add missing support for DMA_ATTR_MMIO for
 dma_iova_unlink()

On 2025-11-24 5:20 pm, Leon Romanovsky wrote:
> On Mon, Nov 24, 2025 at 05:15:48PM +0000, Robin Murphy wrote:
>> On 2025-11-24 5:09 pm, Marek Szyprowski wrote:
>>> Commit c288d657dd51 added support for DMA_ATTR_MMIO attribute in the
>>> dma_iova_link() code path, but missed that the CPU cache is being also
>>> touched in the dma_iova_unlink() path. Fix this.
>>>
>>> Fixes: c288d657dd51 ("iommu/dma: implement DMA_ATTR_MMIO for dma_iova_link().")
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
>>> ---
>>>    drivers/iommu/dma-iommu.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>>> index e52d19d2e833..c92088855450 100644
>>> --- a/drivers/iommu/dma-iommu.c
>>> +++ b/drivers/iommu/dma-iommu.c
>>> @@ -2008,7 +2008,7 @@ static void iommu_dma_iova_unlink_range_slow(struct device *dev,
>>>    			end - addr, iovad->granule - iova_start_pad);
>>>    		if (!dev_is_dma_coherent(dev) &&
>>> -		    !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
>>> +		    !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))
>>>    			arch_sync_dma_for_cpu(phys, len, dir);
>>>    		swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs);
>>> @@ -2032,7 +2032,8 @@ static void __iommu_dma_iova_unlink(struct device *dev,
>>>    	size_t unmapped;
>>>    	if ((state->__size & DMA_IOVA_USE_SWIOTLB) ||
>>> -	    (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)))
>>> +	    (!dev_is_dma_coherent(dev) &&
>>> +	     !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))))
>>
>> This isn't needed, since there's no way an MMIO mapping could have used
>> SWIOTLB.
> 
> This "if" is taken even for non-SWIOTLB path, because of "||" operator
> in line above.

Oof, clearly it's already time to stop trying to read code and go home... :)

Thanks,
Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ