Skip to contentSkip to conversation

mm-gup-explicitly-define-and-check-internal-gup-flags-disallow-foll_touch.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 18, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH
has been removed from the -mm tree. Its filename was
mm-gup-explicitly-define-and-check-internal-gup-flags-disallow-foll_touch.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: Lorenzo Stoakes <[email protected]>
Subject: mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH
Date: Tue, 3 Oct 2023 00:14:52 +0100

Rather than open-coding a list of internal GUP flags in is_valid_gup_args(), define which ones are internal.

In addition, explicitly check to see if the user passed in FOLL_TOUCH somehow, as this appears to have been accidentally excluded.

---

 mm/gup.c      |    5 ++---
 mm/internal.h |    3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-gup-explicitly-define-and-check-internal-gup-flags-disallow-foll_touch +2 -3
@@ -2227,12 +2227,11 @@ static bool is_valid_gup_args(struct pag
 	/*
 	 * These flags not allowed to be specified externally to the gup
 	 * interfaces:
-	 * - FOLL_PIN/FOLL_TRIED/FOLL_FAST_ONLY are internal only
+	 * - FOLL_TOUCH/FOLL_PIN/FOLL_TRIED/FOLL_FAST_ONLY are internal only
 	 * - FOLL_REMOTE is internal only and used on follow_page()
 	 * - FOLL_UNLOCKABLE is internal only and used if locked is !NULL
 	 */
-	if (WARN_ON_ONCE(gup_flags & (FOLL_PIN | FOLL_TRIED | FOLL_UNLOCKABLE |
-				      FOLL_REMOTE | FOLL_FAST_ONLY)))
+	if (WARN_ON_ONCE(gup_flags & INTERNAL_GUP_FLAGS))
 		return false;
 
 	gup_flags |= to_set;
mm/internal.h renamed from mm/internal.h~mm-gup-explicitly-define-and-check-internal-gup-flags-disallow-foll_touch +3 -0
@@ -1017,6 +1017,9 @@ enum {
 	FOLL_UNLOCKABLE = 1 << 21,
 };
 
+#define INTERNAL_GUP_FLAGS (FOLL_TOUCH | FOLL_TRIED | FOLL_REMOTE | FOLL_PIN | \
+			    FOLL_FAST_ONLY | FOLL_UNLOCKABLE)
+
 /*
  * Indicates for which pages that are write-protected in the page table,
  * whether GUP has to trigger unsharing via FAULT_FLAG_UNSHARE such that the

_

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