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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtbCLmsIF3On+aEv@chenyu5-mobl2>
Date: Tue, 3 Sep 2024 16:00:46 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: Christoph Hellwig <hch@....de>
CC: Marek Szyprowski <m.szyprowski@...sung.com>, Robin Murphy
	<robin.murphy@....com>, Baolu Lu <baolu.lu@...el.com>, Kevin Tian
	<kevin.tian@...el.com>, <iommu@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dma-direct: fix the page free when it is not addressable

Hi Christoph,

On 2024-09-03 at 09:35:21 +0200, Christoph Hellwig wrote:
> On Sat, Aug 31, 2024 at 07:01:19PM +0800, Chen Yu wrote:
> > When the CMA allocation succeeds but isn't addressable, its
> > buffer has already been released and the page is set to NULL.
> > So later when the normal page allocation succeeds but isn't
> > addressable, __free_pages() should be used to free that normal
> > page rather than freeing continuous page(CMA).
> 
> So the patch is obviously correct and probably useful, but I don't think
> the existing code is buggy.
> 
> dma_free_contiguous calls into cma_release, which uses cma_pages_valid to
> check if the page belongs to the CMA pool and retuns early if not,
> letting dma_free_contiguous fall back to __free_pages eventually.
>
> What am I missing here?
> 
Thanks for taking a look. Your are right, the pfn will be checked in
cma_pages_valid() to see it is within the CMA range, if not, it prints
some messages and return false, finally falls into __free_pages(). From
the functional point of view, there is no bug. From the efficiency point
of view(extra checks/printed message), and from the code readability to
avoid confusing, maybe we can refine it?

thanks,
Chenyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ