Re: [PATCH v2 1/2] mm/pagewalk: fix stale walk->action escaping walk_pmd_range()
From: Andrew Morton
Date: Tue Aug 11 2026 - 15:41:59 EST
On Wed, 12 Aug 2026 01:18:57 +0900 Hyunwoo Kim <imv4bel@xxxxxxxxx> wrote:
> If ->pmd_entry() sets walk->action = ACTION_AGAIN, the pmd_none()
> check is retried. The PMD entry may be cleared at the point of retry.
>
> In this case, if walk->ops->install_pte is not specified, the code
> continues to the next PMD entry in the range without resetting
> walk->action to ACTION_SUBTREE.
>
> This leaves walk->action erroneously set to ACTION_AGAIN, which is
> incorrect.
>
> This was incorrect but not problematic up until commit 3b89863c3fa4
> ("mm/pagewalk: fix race between concurrent split and refault")
> which updated walk_pud_range() to check for walk->action ==
> ACTION_AGAIN upon walk_pmd_range()'s return, causing the PUD walk
> to be retried.
>
> In this case this results in duplicate walk callbacks being
> invoked, which is erroneous and will break any caller that is not
> idempotent with respect to this (and waste time for those which
> are).
"break". Please describe the breakage completely. It's really the
most important information in the whole effort.
IOW, when fixing a bug please describe the userspace-visible runtime
effects of that bug.
eg, what were the results of the fuzzer? Is there a Link:? A stack
trace?
> A specific example of this breaking things is mincore which walks
> an internal cursor data structure a byte at a time on assumption
> that page table entry callbacks are called only once for each
> entry.
>
> Fix the problem by resetting walk->action to ACTION_SUBTREE prior
> to the none check.
>
> The pattern also exists in walk_pud_range() so fix it there too.
>
> This issue was found through AI-based fuzzing.
>
> Fixes: 3b89863c3fa4 ("mm/pagewalk: fix race between concurrent split and refault")
It's good to cc the relevant Author(s).
> Cc: stable@xxxxxxxxxxxxxxx
We really should tell -stable maintainers (and all other users of
earlier kernels) all about the above things.
> mm/pagewalk.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
This depends on the above info, but I'd prefer to process the bugfix
promptly and defer consideration of the selftest until the next -rc
cycle.