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] [day] [month] [year] [list]
Message-ID: <e87aa091-5c02-4cd6-9636-0cb6c0015768@arm.com>
Date: Fri, 15 Aug 2025 15:43:25 +0100
From: Robin Murphy <robin.murphy@....com>
To: Joerg Roedel <joro@...tes.org>,
 XianLiang Huang <huangxianliang@...xincomputing.com>
Cc: tjeznach@...osinc.com, markus.elfring@....de, will@...nel.org,
 paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
 alex@...ti.fr, iommu@...ts.linux.dev, linux-riscv@...ts.infradead.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] iommu/riscv: prevent NULL deref in iova_to_phys

On 15/08/2025 11:01 am, Joerg Roedel wrote:
> On Fri, Aug 15, 2025 at 03:12:44PM +0800, XianLiang Huang wrote:
>> diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
>> index 2d0d31ba2886..0eae2f4bdc5e 100644
>> --- a/drivers/iommu/riscv/iommu.c
>> +++ b/drivers/iommu/riscv/iommu.c
>> @@ -1283,7 +1283,7 @@ static phys_addr_t riscv_iommu_iova_to_phys(struct iommu_domain *iommu_domain,
>>   	unsigned long *ptr;
>>   
>>   	ptr = riscv_iommu_pte_fetch(domain, iova, &pte_size);
>> -	if (_io_pte_none(*ptr) || !_io_pte_present(*ptr))
>> +	if (!ptr)
>>   		return 0;
> 
> Zero is usually not an invalid physical address, or is it on RISC-V?

It's a valid PA on many systems of many architectures, but it's also 
been the "not mapped/error" value for the iova_to_phys operation all the 
way back to the very very first intel_iommu_iova_to_pfn() nearly 17 
years ago, so hey :)

Thanks,
Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ