summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorMike Rapoport (Microsoft) <rppt@kernel.org>2026-10-31 20:14:03 +0200
committerAndrew Morton <akpm@linux-foundation.org>2026-11-09 22:44:28 -0800
commit111894c595a078d8481db34f3355e8531990668e (patch)
tree01832f35f6d3d60432bc59949a65c1ccd14ae1e3 /tools/perf/scripts/python
parentcd5f5bf781b4ead6a6571818d5613ea2ed0145f3 (diff)
userfaultfd: clear uffd state in child PTEs if uffd is released during fork
With UFFD_FEATURE_EVENT_FORK the userfaultfd context is duplicated for the child process, the child VMAs are registered with the new context, and uffd protection state from the parent PTEs is copied into the child. If the parent's userfaultfd is released before the fork event is read, userfaultfd_release_new() resets the VMA flags but keeps uffd state in the child PTEs. This leaves the child's VMAs in an inconsistent state: they are not registered with userfaultfd but their mappings carry uffd protection state. If the child registers the range with userfaultfd again, the stale state turns into protection the child never asked for. When a write fault makes such a PTE writable without copying the page, the uffd bit remains set and page_table_check_pte_flags() warns about it. Split resolving of the uffd PTE state out of userfaultfd_clear_vma() and call it from userfaultfd_release_new() before resetting the VMA. Link: https://lore.kernel.org/20261031-uffd-prot-bits-fork-event-v2-1-c448e57df417@kernel.org Fixes: f369b07c8614 ("mm/uffd: reset write protection when unregister with wp-mode") Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com> Tested-by: Jose A. Perez de Azpillaga <azpijr@gmail.com> Reviewed-by: Tal Zussman <tz2294@columbia.edu> Tested-by: Tal Zussman <tz2294@columbia.edu> Cc: Peter Xu <peterx@redhat.com> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions