Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM
From: Jason Gunthorpe
Date: Mon Oct 05 2020 - 19:41:11 EST
On Tue, Oct 06, 2020 at 12:43:31AM +0200, Daniel Vetter wrote:
> > iow I think I can outright delete the frame vector stuff.
>
> Ok this doesn't work, because dma_mmap always uses a remap_pfn_range,
> which is a VM_IO | VM_PFNMAP vma and so even if it's cma backed and
> not a carveout, we can't get the pages.
If CMA memory has struct pages it probably should be mmap'd with
different flags, and the lifecycle of the CMA memory needs to respect
the struct page refcount?
> Plus trying to move the cma pages out of cma for FOLL_LONGTERM would
> be kinda bad when they've been allocated as a contig block by
> dma_alloc_coherent :-)
Isn't holding a long term reference to a CMA page one of those really
scary use-after-free security issues I've been talking about?
I know nothing about CMA, so can't say too much, sorry
Jason