Skip to contentSkip to conversation

mm-prevent-userfaults-to-be-handled-under-per-vma-lock.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 6, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: prevent userfaults to be handled under per-vma lock
has been removed from the -mm tree. Its filename was
mm-prevent-userfaults-to-be-handled-under-per-vma-lock.patch

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

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: mm: prevent userfaults to be handled under per-vma lock
Date: Mon, 27 Feb 2023 09:36:26 -0800

Due to the possibility of handle_userfault dropping mmap_lock, avoid fault handling under VMA lock and retry holding mmap_lock. This can be handled more gracefully in the future.

---

 mm/memory.c |    9 +++++++++
 1 file changed, 9 insertions(+)
mm/memory.c renamed from mm/memory.c~mm-prevent-userfaults-to-be-handled-under-per-vma-lock +9 -0
@@ -5266,6 +5266,15 @@ retry:
 	if (!vma_start_read(vma))
 		goto inval;
 
+	/*
+	 * Due to the possibility of userfault handler dropping mmap_lock, avoid
+	 * it for now and fall back to page fault handling under mmap_lock.
+	 */
+	if (userfaultfd_armed(vma)) {
+		vma_end_read(vma);
+		goto inval;
+	}
+
 	/* Check since vm_start/vm_end might change before we lock the VMA */
 	if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
 		vma_end_read(vma);

_

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