[PATCH v2 01/47] mm/mglru: don't use stack pointers when walking PUD and PMD tables

SJ Park sj at kernel.org
Thu Oct 29 17:20:03 PDT 2026


'get_maintainer.pl --nogit --nogit-fallback' suggests adding below recipients.
But I can show there are already quite a number of recipients, so I'm just
noting here.

- Brian Geffon <bgeffon at google.com>
- Oleksandr Natalenko <oleksandr at natalenko.name>
- Steven Barrett <steven at liquorix.net>
- Yu Zhao <yuzhao at google.com>

On Thu, 29 Oct 2026 21:32:56 +0100 "David Hildenbrand (Arm)" <david at kernel.org> wrote:

> From: Josef Bacik <josef at toxicpanda.com>
> 
> MGLRU passes stack copies of page-table entries in walk_pud_range() and
> walk_pmd_range() when walking to the next level. These copies can become
> stale when khugepaged or MADV_DONTNEED (CONFIG_PT_RECLAIM) removes a PTE
> table concurrently.
> 
> This pattern dates back to commit bd74fdaea146 ("mm: multi-gen LRU:
> support page table walks"). Likely, earlier locking masked the latent
> bug. Later changes exposed it: commit 1d65b771bc08 ("mm/khugepaged:
> retract_page_tables() without mmap or vma lock") allowed concurrent
> retraction, and commit cf4a65539c13 ("memcg-v1: no need for memcg locking
> for MGLRU") dropped the walker's outer RCU protection.
> 
> The fix is simple, so just fix the original commit so we don't have to
> speculate. To fix it, pass the actual PMD/PUD pointers. This restores the
> RCU-protected lookup and validation against the live PMD. Note that the PUD
> handling is required as well to handle folded page tables correctly in all
> cases.
> 
> Fix generated by an LLM and sent by Josef Bacik in private.
> 
> [ david: handle walk_pud_range() as well, clarify+simplify description,
>          adjust Fixes: ]

Looks all good to me.

> 
> Fixes: bd74fdaea146 ("mm: multi-gen LRU: support page table walks")
> Cc: stable at vger.kernel.org
> Signed-off-by: Josef Bacik <josef at toxicpanda.com>
> Reviewed-by: Rik van Riel <riel at surriel.com>
> Reviewed-by: Qi Zheng <qi.zheng at linux.dev>
> Reviewed-by: Dev Jain <dev.jain at arm.com>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> Reviewed-by: Kairui Song <kasong at tencent.com>
> Tested-by: Muhammad Usama Anjum <usama.anjum at arm.com>
> Reviewed-by: Harry Yoo (Meta) <harry at kernel.org>
> Reviewed-by: Barry Song <baohua at kernel.org>
> Reviewed-by: Baolin Wang <baolin.wang at linux.alibaba.com>
> Reviewed-by: Pedro Falcato <pfalcato at suse.de>
> Reviewed-by: Kiryl Shutsemau (Meta) <kas at kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>

Reviewed-by: SJ Park <sj at kernel.org>


Thanks,
SJ

[...]



More information about the kexec mailing list