Skip to contentSkip to conversation

mm-remove-the-access_ok-call-from-gup_fast_fallback.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 17, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: remove the access_ok() call from gup_fast_fallback()
has been removed from the -mm tree. Its filename was
mm-remove-the-access_ok-call-from-gup_fast_fallback.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: David Laight <[email protected]>
Subject: mm: remove the access_ok() call from gup_fast_fallback()
Date: Sun, 9 Feb 2025 17:47:11 +0000

Historiaclly the code relied on access_ok() to validate the address range. Commit 26f4c328079d7 added an explicit wrap check before access_ok(). Commit c28b1fc70390d then changed the wrap test to use check_add_overflow(). Commit 6014bc27561f2 relaxed the checks in x86-64's access_ok() and added
an explicit check for TASK_SIZE here to make up for it.
That left a pointless access_ok() call with its associated 'lfence' that can never actually fail.

So just delete the test.

Cc Thomas Gleixner <[email protected]>
Cc Andy Lutomirks^H^Hski <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jan Kara <[email protected]>
Cc John Hubbard <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Xu <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>

---

 mm/gup.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-remove-the-access_ok-call-from-gup_fast_fallback +1 -3
@@ -2760,7 +2760,7 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
  *
  *  *) ptes can be read atomically by the architecture.
  *
- *  *) access_ok is sufficient to validate userspace address ranges.
+ *  *) valid user addesses are below TASK_MAX_SIZE
  *
  * The last two assumptions can be relaxed by the addition of helper functions.
  *
@@ -3414,8 +3414,6 @@ static int gup_fast_fallback(unsigned lo
 		return -EOVERFLOW;
 	if (end > TASK_SIZE_MAX)
 		return -EFAULT;
-	if (unlikely(!access_ok((void __user *)start, len)))
-		return -EFAULT;
 
 	nr_pinned = gup_fast(start, end, gup_flags, pages);
 	if (nr_pinned == nr_pages || gup_flags & FOLL_FAST_ONLY)

_

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