[PATCH 0/4] userfaultfd: fixes for sashiko reports

From: Mike Rapoport (Microsoft)

Date: Wed Dec 02 2026 - 13:20:16 EST


These are fixes for userfaultfd bugs reported by sashiko, plus a THP
variant of one of them found while looking at the reports.

The first patch closes a race between closing a userfaultfd and uffd
operations of another userfaultfd of the same mm that can leave a
writable PTE with the uffd marker bit set.

The next two make UFFDIO_MOVE mark moved zero pages and THPs soft-dirty,
like it does for other PTEs and for the huge zero page.

The last one makes uffd-unit-tests free the test context when its setup
fails.

Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
Mike Rapoport (Microsoft) (4):
userfaultfd: write-lock the VMA before clearing its uffd state
userfaultfd: mark zero pages moved by UFFDIO_MOVE soft-dirty
userfaultfd: mark THPs moved by UFFDIO_MOVE soft-dirty
selftests/mm: free the test context when uffd_test_ctx_init() fails

mm/huge_memory.c | 1 +
mm/userfaultfd.c | 5 +++++
tools/testing/selftests/mm/uffd-common.c | 11 ++++++++---
3 files changed, 14 insertions(+), 3 deletions(-)
---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261202-fixes-uffd-sashiko-fb173c1557eb

--
Sincerely yours,
Mike.