Re: [PATCH v2 2/6] mm/hugetlb: Fix uffd-wp bit lost when unsharing happens

From: Andrew Morton
Date: Mon Apr 17 2023 - 19:48:31 EST


On Mon, 17 Apr 2023 15:53:13 -0400 Peter Xu <peterx@xxxxxxxxxx> wrote:

> When we try to unshare a pinned page for a private hugetlb, uffd-wp bit can
> get lost during unsharing. Fix it by carrying it over.
>
> This should be very rare, only if an unsharing happened on a private
> hugetlb page with uffd-wp protected (e.g. in a child which shares the same
> page with parent with UFFD_FEATURE_EVENT_FORK enabled).

What are the user-visible consequences of the bug?

> Cc: linux-stable <stable@xxxxxxxxxxxxxxx>

When proposing a backport, it's better to present the patch as a
standalone thing, against current -linus. I'll then queue it in
mm-hotfixes and shall send it upstream during this -rc cycle.

As presented, this patch won't go upstream until after 6.3 is released,
and as it comes later in time, more backporting effort might be needed.

I can rework things if this fix is reasonably urgent (the "user-visible
consequences" info is the guide). If not urgent, we can leave things
as they are.