Skip to contentSkip to conversation

userfaultfd-avoid-huge_zero_page-in-uffdio_move.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jan 12, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: userfaultfd: avoid huge_zero_page in UFFDIO_MOVE
has been removed from the -mm tree. Its filename was
userfaultfd-avoid-huge_zero_page-in-uffdio_move.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: userfaultfd: avoid huge_zero_page in UFFDIO_MOVE
Date: Thu, 11 Jan 2024 17:39:35 -0800

While testing UFFDIO_MOVE ioctl, syzbot triggered VM_BUG_ON_PAGE caused by a call to PageAnonExclusive() with a huge_zero_page as a parameter. UFFDIO_MOVE does not yet handle zeropages and returns EBUSY when one is encountered. Add an early huge_zero_page check in the PMD move path to avoid this situation.

Fixes adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
Reported-by [email protected]
Cc Andrea Arcangeli <[email protected]>
Cc Peter Xu <[email protected]>
Cc Stephen Rothwell <[email protected]>

---

 mm/userfaultfd.c |    6 ++++++
 1 file changed, 6 insertions(+)
mm/userfaultfd.c renamed from mm/userfaultfd.c~userfaultfd-avoid-huge_zero_page-in-uffdio_move +6 -0
@@ -1393,6 +1393,12 @@ ssize_t move_pages(struct userfaultfd_ct
 				err = -ENOENT;
 				break;
 			}
+			/* Avoid moving zeropages for now */
+			if (is_huge_zero_pmd(*src_pmd)) {
+				spin_unlock(ptl);
+				err = -EBUSY;
+				break;
+			}
 
 			/* Check if we can move the pmd without splitting it. */
 			if (move_splits_huge_pmd(dst_addr, src_addr, src_start + len) ||

_

Patches currently in -mm which might be from [email protected] are