Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v2 1/2] fs/proc/task_mmu: reset walk_end before each pagemap walk
       [not found] <20261118-pagemap-walk-end-v2-0-94cd92d838b3@gmail.com>
@ 2026-11-18  0:26 ` Matthew Salsamendi via B4 Relay
  2026-11-25  2:19   ` + fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch added to mm-new branch Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Salsamendi via B4 Relay @ 2026-11-18  0:26 UTC (permalink / raw)
  To: Andrew Morton, Liam R. Howlett, Lorenzo Stoakes
  Cc: Chris Down, Vlastimil Babka, Muhammad Usama Anjum, linux-mm,
	linux-kernel, matthewsalsamendi, Jann Horn, Pedro Falcato,
	linux-fsdevel, stable

From: Matthew Salsamendi <matthewsalsamendi@gmail.com>

When PAGEMAP_SCAN resumes after filling its buffer, it can return ranges
beyond a stale walk_end. This aborts a production game server during
dirty-page tracking.

Reset walk_end before each walk so a completed scan reports the end and
a partial HugeTLB write-protect request keeps its retry address.

Codex assisted with diagnosis, validation and this message.

Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
Suggested-by: Chris Down <chris@chrisdown.name>
Suggested-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: stable@vger.kernel.org # 6.7+
Signed-off-by: Matthew Salsamendi <matthewsalsamendi@gmail.com>
---
v2: Use the per-walk reset suggested by Chris and Lorenzo.
    Verified the 513-range refill and 2 MiB HugeTLB retry on x86-64.

Stable: The bug is present in v6.7. The hunk needs a context adjustment
on v6.7 and applies unchanged to v6.8.

 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index b87d3e86442d..8723ffbff77c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -3155,6 +3155,7 @@ static long do_pagemap_scan(struct mm_struct *mm, unsigned long uarg)
 			mmu_notifier_invalidate_range_start(&range);
 		}
 
+		p.arg.walk_end = 0; /* Reset partial walks. */
 		ret = walk_page_range(mm, walk_start, p.arg.end,
 				      &pagemap_scan_ops, &p);
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* + fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch added to mm-new branch
  2026-11-18  0:26 ` [PATCH v2 1/2] fs/proc/task_mmu: reset walk_end before each pagemap walk Matthew Salsamendi via B4 Relay
@ 2026-11-25  2:19   ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-11-25  2:19 UTC (permalink / raw)
  To: mm-commits, vbabka, usama.anjum, stable, pfalcato, ljs, liam,
	jannh, chris, matthewsalsamendi, akpm


The patch titled
     Subject: fs/proc/task_mmu: reset walk_end before each pagemap walk
has been added to the -mm mm-new branch.  Its filename is
     fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Matthew Salsamendi <matthewsalsamendi@gmail.com>
Subject: fs/proc/task_mmu: reset walk_end before each pagemap walk
Date: Tue, 17 Nov 2026 16:26:17 -0800

Patch series "fs/proc: fix PAGEMAP_SCAN walk_end after a buffer refill",
v2.


This patch (of 2):

When PAGEMAP_SCAN resumes after filling its buffer, it can return ranges
beyond a stale walk_end. This aborts a production game server during
dirty-page tracking.

Reset walk_end before each walk so a completed scan reports the end and
a partial HugeTLB write-protect request keeps its retry address.

Codex assisted with diagnosis, validation and this message.

Link: https://lore.kernel.org/20261118-pagemap-walk-end-v2-0-94cd92d838b3@gmail.com
Link: https://patch.msgid.link/20261118-pagemap-walk-end-v2-1-94cd92d838b3@gmail.com
Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
Signed-off-by: Matthew Salsamendi <matthewsalsamendi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Chris Down <chris@chrisdown.name>
Suggested-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@arm.com>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: <stable@vger.kernel.org> # 6.7+

 fs/proc/task_mmu.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/proc/task_mmu.c~fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk
+++ a/fs/proc/task_mmu.c
@@ -3199,6 +3199,7 @@ static long do_pagemap_scan(struct mm_st
 			mmu_notifier_invalidate_range_start(&range);
 		}
 
+		p.arg.walk_end = 0; /* Reset partial walks. */
 		ret = walk_page_range(mm, walk_start, p.arg.end,
 				      &pagemap_scan_ops, &p);
 
_

Patches currently in -mm which might be from matthewsalsamendi@gmail.com are

fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch
selftests-mm-cover-pagemap_scan-refill-and-hugetlb-retry.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261118-pagemap-walk-end-v2-0-94cd92d838b3@gmail.com>
2026-11-18  0:26 ` [PATCH v2 1/2] fs/proc/task_mmu: reset walk_end before each pagemap walk Matthew Salsamendi via B4 Relay
2026-11-25  2:19   ` + fs-proc-task_mmu-reset-walk_end-before-each-pagemap-walk.patch added to mm-new branch Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox