Re: [PATCH 11/12] mm/madvise: send UFFD_EVENT_REMOVE when installing guard regions

From: Kiryl Shutsemau

Date: Wed Nov 11 2026 - 15:14:35 EST


On Wed, Nov 11, 2026 at 12:55:19PM -0500, Tal Zussman wrote:
> On an anonymous VMA, the zap drops uffd-wp and RWP protection along with
> the pages. Writes and accesses to the range after the guard is removed
> are then not reported, and the manager cannot know that it has to
> protect the range again.

For RWP this only holds if the range is registered without MISSING.

The zap frees the pages, so with MISSING the first access after the
guard is removed is reported as a missing fault. And there is nothing to
protect again: RWP only covers present PTEs, and a page faulted back in
shows up as accessed in PAGEMAP_SCAN.

--
Kiryl Shutsemau / Kirill A. Shutemov