Re: [PATCH] mm/gup: disallow GUP writing to file-backed mappings by default

From: Jason Gunthorpe
Date: Mon Apr 24 2023 - 13:49:45 EST


On Sun, Apr 23, 2023 at 11:56:48PM +0100, Lorenzo Stoakes wrote:

> This warned upon check should in reality not occur, because it implies the
> GUP user is trying to do something broken and is _not_ explicitly telling
> GUP that it knows it's doing it and can live with the consequences. And on
> that basis, is worthy of a warning so we know we have to go put this flag
> in that place (and know it is a source of problematic GUP usage), or fix
> the caller.

It is fine for debugging, but we can't merge user triggerable
WARN_ONs..

Since the GUP caller has no idea if userspace might be maliciously
passing in a file VMA we can't throw warnings.

Jason