Re: [PATCH v2 01/17] mm/gup: Fixup p*_access_permitted()

From: Linus Torvalds
Date: Fri Dec 15 2017 - 21:28:45 EST


On Fri, Dec 15, 2017 at 5:25 PM, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> I think the reason we needed VMA and PTE checks was the
> get_user_pages_fast() path not having a VMA.

That is indeed the point of get_user_pages_fast(): no vma lookup, no
locking, just "do the default case as streamlined as possible".

But part of it is also that we should fall back to the slow case if
the fast case doesn't work (eg because the page isn't there or
whatever).

So what we could do - perhaps - is to just make get_user_pages_fast()
check whether any of the protection key bits are set, and fail for
that case.

If we care, that is.

Linus