[PATCH 25/46] mm/userfaultfd: wake waiters when registration modes are removed
Mike Rapoport
rppt at kernel.org
Tue Oct 27 01:21:54 PDT 2026
On Tue, Oct 27, 2026 at 12:17:45AM +0100, David Hildenbrand (Arm) wrote:
> UFFDIO_REGISTER can replace MISSING or MINOR tracking without waking
> faults that are already queued. For example, switching an anonymous
> range from MISSING to WP leaves a missing-fault waiter asleep until
> userspace explicitly wakes it.
>
> When a registration change removes a UFFD mode, wake waiters in the
> affected interval after updating the VMA. The VMA is write-locked at
> this point, so no new faults can queue under the old modes and woken
> threads cannot retry until mmap_write_unlock(). Waiters for retained
> modes in the same interval may also wake and refault.
>
> The hang reproduces for MISSING-to-WP and MINOR-to-MISSING transitions,
> with both read and unread fault events.
>
> Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
> Cc: stable at vger.kernel.org
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
> ---
> mm/userfaultfd.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
--
Sincerely yours,
Mike.
More information about the kexec
mailing list