From: Matthew Salsamendi via B4 Relay <devnull+matthewsalsamendi.gmail.com@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <liam@infradead.org>,
Lorenzo Stoakes <ljs@kernel.org>
Cc: Chris Down <chris@chrisdown.name>,
Vlastimil Babka <vbabka@kernel.org>,
Muhammad Usama Anjum <usama.anjum@arm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
matthewsalsamendi@gmail.com, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
linux-fsdevel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH v2 1/2] fs/proc/task_mmu: reset walk_end before each pagemap walk
Date: Tue, 17 Nov 2026 16:26:17 -0800 [thread overview]
Message-ID: <20261118-pagemap-walk-end-v2-1-94cd92d838b3@gmail.com> (raw)
In-Reply-To: <20261118-pagemap-walk-end-v2-0-94cd92d838b3@gmail.com>
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);
next prev parent reply other threads:[~2026-11-18 0:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 0:26 [PATCH v2 0/2] fs/proc: fix PAGEMAP_SCAN walk_end after a buffer refill Matthew Salsamendi via B4 Relay
2026-11-18 0:26 ` Matthew Salsamendi via B4 Relay [this message]
2026-11-18 0:26 ` [PATCH v2 2/2] selftests/mm: cover PAGEMAP_SCAN refill and HugeTLB retry Matthew Salsamendi via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118-pagemap-walk-end-v2-1-94cd92d838b3@gmail.com \
--to=devnull+matthewsalsamendi.gmail.com@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chris@chrisdown.name \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=matthewsalsamendi@gmail.com \
--cc=pfalcato@suse.de \
--cc=stable@vger.kernel.org \
--cc=usama.anjum@arm.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®