Re: [PATCH] mm/userfaultfd: Reset ptes when close() for wr-protected ones

From: Andrew Morton
Date: Mon Apr 22 2024 - 15:47:30 EST


On Mon, 22 Apr 2024 09:33:11 -0400 Peter Xu <peterx@xxxxxxxxxx> wrote:

> Userfaultfd unregister includes a step to remove wr-protect bits from all
> the relevant pgtable entries, but that only covered an explicit
> UFFDIO_UNREGISTER ioctl, not a close() on the userfaultfd itself. Cover
> that too.

We should include a description of the userspace-visible effects of the
bug, please. Always.

I see it triggers a WARN, but so what - why ca't we simply delete the
WARN statement if that's the only effect? Presumably there are other
consequences - what are they?

Also, a WARN-triggering bug should be fixed in -stable kernels so we'll
need a FIXES:, please?