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] [thread-next>] [day] [month] [year] [list]
Message-ID: <36f2bee7-f4d4-4e1e-9a68-cd7a5210eb1a@suse.com>
Date: Mon, 16 Sep 2024 10:05:29 +0200
From: Jürgen Groß <jgross@...e.com>
To: Jan Beulich <jbeulich@...e.com>
Cc: Stefano Stabellini <sstabellini@...nel.org>,
 Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
 xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org,
 iommu@...ts.linux.dev
Subject: Re: [PATCH v2 2/2] xen/swiotlb: fix allocated size

On 16.09.24 09:59, Jan Beulich wrote:
> On 16.09.2024 08:47, Juergen Gross wrote:
>> The allocated size in xen_swiotlb_alloc_coherent() and
>> xen_swiotlb_free_coherent() is calculated wrong for the case of
>> XEN_PAGE_SIZE not matching PAGE_SIZE. Fix that.
>>
>> Fixes: 7250f422da04 ("xen-swiotlb: use actually allocated size on check physical continuous")
>> Reported-by: Jan Beulich <jbeulich@...e.com>
>> Signed-off-by: Juergen Gross <jgross@...e.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@...e.com>
> 
>> --- a/drivers/xen/swiotlb-xen.c
>> +++ b/drivers/xen/swiotlb-xen.c
>> @@ -147,7 +147,7 @@ xen_swiotlb_alloc_coherent(struct device *dev, size_t size,
>>   	void *ret;
>>   
>>   	/* Align the allocation to the Xen page size */
>> -	size = 1UL << (order + XEN_PAGE_SHIFT);
>> +	size = ALIGN(size, XEN_PAGE_SIZE);
> 
> The way you're doing it has further positive effects, as the size
> is now also no longer needlessly over-aligned. May want mentioning
> in the description. Hope of course is that no-one came to rely on
> the up-to-next-power-of-2 allocation anywhere (which of course
> would be a bug there, yet might end in a perceived regression).

Quite unlikely IMHO, as this is a Xen-only behavior. I'm not aware of
any hardware used with Xen only. So for a regression to happen the driver
allocating DMA memory would need to have a Xen-specific handling relying
on the higher alignment.


Juergen

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3684 bytes)

Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ