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: <12f7109f-5375-4301-ac69-077761a0106f@linux.ibm.com>
Date: Tue, 1 Apr 2025 10:08:20 -0400
From: Matthew Rosato <mjrosato@...ux.ibm.com>
To: Heiko Carstens <hca@...ux.ibm.com>
Cc: joro@...tes.org, will@...nel.org, robin.murphy@....com,
        gerald.schaefer@...ux.ibm.com, schnelle@...ux.ibm.com,
        gor@...ux.ibm.com, agordeev@...ux.ibm.com, svens@...ux.ibm.com,
        borntraeger@...ux.ibm.com, clg@...hat.com, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org
Subject: Re: [PATCH v4 5/5] iommu/s390: allow larger region tables

On 4/1/25 5:11 AM, Heiko Carstens wrote:
> On Mon, Mar 31, 2025 at 04:21:59PM -0400, Matthew Rosato wrote:
>> Extend the aperture calculation to consider sizes beyond the maximum
>> size of a region third table.  Attempt to always use the smallest
>> table size possible to avoid unnecessary extra steps during translation.
>> Update reserved region calculations to use the appropriate table size.
>>
>> Signed-off-by: Matthew Rosato <mjrosato@...ux.ibm.com>
>> ---
>>  arch/s390/include/asm/pci_dma.h |  1 +
>>  drivers/iommu/s390-iommu.c      | 71 ++++++++++++++++++++++++---------
>>  2 files changed, 53 insertions(+), 19 deletions(-)
> 
> ...
> 
>> +	spin_lock_irqsave(&zdev->dom_lock, flags);
>> +	if (zdev->s390_domain->type == IOMMU_DOMAIN_BLOCKED ||
>> +	    zdev->s390_domain->type == IOMMU_DOMAIN_IDENTITY)
>> +		goto out;
>> +
>> +	s390_domain = to_s390_domain(zdev->s390_domain);
>> +	if (zdev->end_dma < max_tbl_size(s390_domain)) {
>> +		end_resv = max_tbl_size(s390_domain) - zdev->end_dma;
>> +		region = iommu_alloc_resv_region(zdev->end_dma + 1, end_resv,
>> +						 0, IOMMU_RESV_RESERVED,
>> +						 GFP_KERNEL);
> 
> GFP_KERNEL allocation while holding a spinlock is not correct.

Looks like I broke this in v3 -- Thanks for catching it.  There's no need to hold this spinlock for as long as we do here, including over the allocation itself; I will re-arrange so we can safely use GFP_KERNEL here.  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ