Skip to contentSkip to conversation

mm-uffd-pte_marker_uffd_wp.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 13, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/uffd: PTE_MARKER_UFFD_WP
has been removed from the -mm tree. Its filename was
mm-uffd-pte_marker_uffd_wp.patch

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

------------------------------------------------------
From: Peter Xu <[email protected]>
Subject: mm/uffd: PTE_MARKER_UFFD_WP

This patch introduces the 1st user of pte marker: the uffd-wp marker.

When the pte marker is installed with the uffd-wp bit set, it means this pte was wr-protected by uffd.

We will use this special pte to arm the ptes that got either unmapped or swapped out for a file-backed region that was previously wr-protected. This special pte could trigger a page fault just like swap entries.

This idea is greatly inspired by Hugh and Andrea in the discussion, which is referenced in the links below.

Some helpers are introduced to detect whether a swap pte is uffd wr-protected. After the pte marker introduced, one swap pte can be wr-protected in two forms: either it is a normal swap pte and it has _PAGE_SWP_UFFD_WP set, or it's a pte marker that has PTE_MARKER_UFFD_WP set.

---

 include/linux/swapops.h       |    3 +-
 include/linux/userfaultfd_k.h |   47 ++++++++++++++++++++++++++++++++
 mm/Kconfig                    |    9 ++++++
 3 files changed, 58 insertions(+), 1 deletion(-)
include/linux/swapops.h renamed from include/linux/swapops.h~mm-uffd-pte_marker_uffd_wp +2 -1
@@ -276,7 +276,8 @@ static inline int is_readable_migration_
 
 typedef unsigned long pte_marker;
 
-#define  PTE_MARKER_MASK     (0)
+#define  PTE_MARKER_UFFD_WP  BIT(0)
+#define  PTE_MARKER_MASK     (PTE_MARKER_UFFD_WP)
 
 #ifdef CONFIG_PTE_MARKER
 
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~mm-uffd-pte_marker_uffd_wp +47 -0

57 lines not on this page · raw message

mm/Kconfig renamed from mm/Kconfig~mm-uffd-pte_marker_uffd_wp +9 -0
@@ -915,6 +915,15 @@ config PTE_MARKER
 	help
 	  Allows to create marker PTEs for file-backed memory.
 
+config PTE_MARKER_UFFD_WP
+	bool "Marker PTEs support for userfaultfd write protection"
+	depends on PTE_MARKER && HAVE_ARCH_USERFAULTFD_WP
+
+	help
+	  Allows to create marker PTEs for userfaultfd write protection
+	  purposes.  It is required to enable userfaultfd write protection on
+	  file-backed memory types like shmem and hugetlbfs.
+
 source "mm/damon/Kconfig"
 
 endmenu

_

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