[PATCH v2 0/4] mm: userfaultfd: assorted fixes and cleanups

From: Tal Zussman
Date: Sat Jun 07 2025 - 02:40:26 EST


Two fixes and two cleanups for userfaultfd.

I added a patch converting BUG_ON()s in the userfaultfd code to
VM_WARN_ON_ONCE() this time around.

Note that the third patch yields a small change in the ABI, but we seem
to have concluded that that's acceptable in this case.

---
Changes in v2:
- Remove Pavel Emelyanov <xemul@xxxxxxxxxxxxx> from To: due to bouncing
email.
- Propagate tags. (David, Peter)
- Add a patch converting userfaultfd BUG_ON()s to VM_WARN_ON_ONCE().
- Move the "different uffd" check in Patch 3 (prev. Patch 2) before the
vma_can_userfault() check due to the wp_async bug, as per James.
- Change the added BUG_ON() in Patch 3 to a VM_WARN_ON_ONCE, as per
James and David.
- Reorder the assertions in Patch 3 to simplify them and avoid the
wp_async bug, as per James.
- Update the Patch 3 commit message to include more details, as per
Peter.
- Link to v1: https://lore.kernel.org/r/20250603-uffd-fixes-v1-0-9c638c73f047@xxxxxxxxxxxx

---
Tal Zussman (4):
userfaultfd: correctly prevent registering VM_DROPPABLE regions
userfaultfd: remove (VM_)BUG_ON()s
userfaultfd: prevent unregistering VMAs through a different userfaultfd
userfaultfd: remove UFFD_CLOEXEC, UFFD_NONBLOCK, and UFFD_FLAGS_SET

fs/userfaultfd.c | 76 +++++++++++++++++++++++--------------------
include/linux/userfaultfd_k.h | 6 +---
mm/userfaultfd.c | 66 ++++++++++++++++++-------------------
3 files changed, 74 insertions(+), 74 deletions(-)
---
base-commit: 546b1c9e93c2bb8cf5ed24e0be1c86bb089b3253
change-id: 20250531-uffd-fixes-142331b15e63

Best regards,
--
Tal Zussman <tz2294@xxxxxxxxxxxx>