Re: [Linaro-mm-sig] Re: [PATCH] dma-buf: Require VM_PFNMAP vma for mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 23.11.22 um 13:46 schrieb Jason Gunthorpe:
On Wed, Nov 23, 2022 at 11:06:55AM +0100, Daniel Vetter wrote:

Maybe a GFP flag to set the page reference count to zero or something
like this?
Hm yeah that might work. I'm not sure what it will all break though?
And we'd need to make sure that underflowing the page refcount dies in
a backtrace.
Mucking with the refcount like this to protect against crazy out of
tree drives seems horrible..

Well not only out of tree drivers. The intree KVM got that horrible wrong as well, those where the latest guys complaining about it.


The WARN_ON(pag_count(p) != 1) seems like a reasonable thing to do
though, though you must combine this with the special PTE flag..

That's not sufficient. The pages are released much later than things actually go wrong. In most cases this WARN_ON here won't hit.

Christian.


Jason




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux