Re: [PATCH 2/4] mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH

From: Jason Gunthorpe
Date: Mon Oct 09 2023 - 18:19:31 EST


On Sun, Oct 01, 2023 at 05:00:03PM +0100, Lorenzo Stoakes wrote:
> Rather than open-coding a list of internal GUP flags in
> is_valid_gup_args(), define which ones are internal.
>
> In addition, we were not explicitly checking to see if the user passed in
> FOLL_TOUCH somehow, this patch fixes that.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@xxxxxxxxx>
> ---
> mm/gup.c | 5 ++---
> mm/internal.h | 3 +++
> 2 files changed, 5 insertions(+), 3 deletions(-)

Does gup_test still work? It uses FOLL_TOUCH?

Hmm. I guess it was broken for a while anyhow:

/* Just the flags we need, copied from mm.h: */
#define FOLL_WRITE 0x01 /* check pte is writable */
#define FOLL_TOUCH 0x02 /* mark page accessed */

Aside from that this seems OK

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason