Re: [PATCH v4 3/6] mm: gup: move gup_must_unshare() and INTERNAL_GUP_FLAGS to gup.c

From: Rik van Riel

Date: Wed Nov 18 2026 - 12:00:45 EST


On Tue, 2026-11-10 at 22:52 +0000, Yeoreum Yun wrote:
>
> +static inline bool gup_must_unshare(struct vm_area_struct *vma,
> +     unsigned int flags, struct page
> *page)
> +{
> + /*
> + * FOLL_WRITE is implicitly handled correctly as the page
> table entry
> + * has to be writable -- and if it references (part of) an
> anonymous
> + * folio, that part is required to be marked exclusive.
> + */
> + if ((flags & (FOLL_WRITE | FOLL_PIN)) != FOLL_PIN)
> + return false;

While I was playing around with some AI loop to
automatically improve review-prompts, one of the
AI engines (out of 6 different ones) spotted a
bug with this code, as used in this series.

I have a reproducer to verify it, and will send
in the fix with v6 of my GUP series later this
week.

--
All Rights Reversed.