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: <ba82816c-3d43-4256-17d7-bd3d358e942b@huawei.com>
Date:   Wed, 7 Sep 2022 11:10:50 +0100
From:   John Garry <john.garry@...wei.com>
To:     Ethan Zhao <haifeng.zhao@...ux.intel.com>,
        Robin Murphy <robin.murphy@....com>, <joro@...tes.org>,
        <will@...nel.org>
CC:     <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
        <linuxarm@...wei.com>
Subject: Re: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks

On 07/09/2022 10:58, Ethan Zhao wrote:

Hi Ethan,

>> Or also add this:
>>
>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>> index 0d6d8edf782d..e8f0b8f47f45 100644
>> --- a/drivers/iommu/dma-iommu.c
>> +++ b/drivers/iommu/dma-iommu.c
>> @@ -578,6 +578,12 @@ static int iommu_dma_init_domain(struct 
>> iommu_domain *domain, dma_addr_t base,
>>              goto done_unlock;
>>          }
>>
>> +        if (!iovad->rcaches) {
>> +            pr_warn("IOVA domain rcache not properly initialised\n");
>> +            ret = -EFAULT;
>> +            goto done_unlock;
>> +        }
>> +
>>          ret = 0;
>>          goto done_unlock;
>>
> If the iovad->rcaches allocation failed, will skip iommu domain dma ops, 
> so no need *any* iovad,->rcaches check, right ?
> 
> and there is already warning about the fallback.

It's not as simple as that. We use the iovad->start_pfn member as a flag 
for the IOVA domain being initialized. However that does not mean always 
properly initialized. As above, the rcache init may fail, but in this 
case we still set start_pfn.

This comes into play when we have multiple devices in the same IOMMU 
group, for example, as I mentioned yesterday.

Thanks,
John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ