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] [day] [month] [year] [list]
Message-ID: <b8237590-e26d-48d4-be44-c0d884e3f703@oldschoolsolutions.biz>
Date: Tue, 4 Jun 2024 10:04:26 +0200
From: Jens Glathe <jens.glathe@...schoolsolutions.biz>
To: Robin Murphy <robin.murphy@....com>, joro@...tes.org
Cc: iommu@...ts.linux.dev, will@...nel.org, linux-kernel@...r.kernel.org,
 Jon Hunter <jonathanh@...dia.com>, Jerry Snitselaar <jsnitsel@...hat.com>
Subject: Re: [PATCH v2] iommu/dma: Fix domain init

Hi Robin,

I just tested this on my Windows Dev Kit 2023 running on EL2. This works
now, thank you!

with best regards

Jens

Tested-by: Jens Glathe <jens.glathe@...schoolsolutions.biz>

On 5/29/24 17:54, Robin Murphy wrote:
> Despite carefully rewording the kerneldoc to describe the new direct
> interaction with dma_range_map, it seems I managed to confuse myself in
> removing the redundant force_aperture check and ended up making the code
> not do that at all. This led to dma_range_maps inadvertently being able
> to set iovad->start_pfn = 0, and all the nonsensical chaos which ensues
> from there. Restore the correct behaviour of constraining base_pfn to
> the domain aperture regardless of dma_range_map, and not trying to apply
> dma_range_map constraints to the basic IOVA domain since they will be
> properly handled with reserved regions later.
>
> Reported-by: Jon Hunter <jonathanh@...dia.com>
> Reported-by: Jerry Snitselaar <jsnitsel@...hat.com>
> Fixes: ad4750b07d34 ("iommu/dma: Make limit checks self-contained")
> Tested-by: Jerry Snitselaar <jsnitsel@...hat.com>
> Reviewed-by: Jerry Snitselaar <jsnitsel@...hat.com>
> Signed-off-by: Robin Murphy <robin.murphy@....com>
> ---
>
> Since I've now got round to rebasing on -rc1, I figured I may as well
> send a v2 with updated tags to avoid any confusion.
>
>   drivers/iommu/dma-iommu.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index f731e4b2a417..43520e7275cc 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -686,15 +686,15 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, struct device *dev
>
>   	/* Check the domain allows at least some access to the device... */
>   	if (map) {
> -		dma_addr_t base = dma_range_map_min(map);
> -		if (base > domain->geometry.aperture_end ||
> +		if (dma_range_map_min(map) > domain->geometry.aperture_end ||
>   		    dma_range_map_max(map) < domain->geometry.aperture_start) {
>   			pr_warn("specified DMA range outside IOMMU capability\n");
>   			return -EFAULT;
>   		}
> -		/* ...then finally give it a kicking to make sure it fits */
> -		base_pfn = max(base, domain->geometry.aperture_start) >> order;
>   	}
> +	/* ...then finally give it a kicking to make sure it fits */
> +	base_pfn = max_t(unsigned long, base_pfn,
> +			 domain->geometry.aperture_start >> order);
>
>   	/* start_pfn is always nonzero for an already-initialised domain */
>   	mutex_lock(&cookie->mutex);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ