[merged mm-stable] mm-huge_memory-move-softleaf_to_folio-inside-migration-branch.patch removed from -mm tree
Andrew Morton <[email protected]> Thu, 30 Jul 2026 19:41:52 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm/huge_memory: move softleaf_to_folio() inside migration branch
has been removed from the -mm tree. Its filename was
mm-huge_memory-move-softleaf_to_folio-inside-migration-branch.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: Usama Arif <[email protected]>
Subject: mm/huge_memory: move softleaf_to_folio() inside migration branch
Date: Mon, 6 Jul 2026 04:42:06 -0700
change_non_present_huge_pmd() calls softleaf_to_folio() unconditionally at
the top of the function. softleaf_to_folio() extracts a PFN from the
entry and converts it to a folio pointer, which is only meaningful for
migration and device_private entries that encode a real PFN.
A swap entry encodes a swap offset instead, so softleaf_to_folio() would
produce a bogus pointer and crash on mprotect() when a PMD swap entry is
present.
Move the call into the migration_write branch where the folio is actually
used, so the function is safe for any non-present PMD type.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Usama Arif <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Reviewed-by: Dev Jain <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Chris Li <[email protected]>
Cc: "Huang, Ying" <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Kairui Song <[email protected]>
Cc: Kemeng Shi <[email protected]>
Cc: Kiryl Shutsemau <[email protected]>
Cc: Lance Yang <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Nhat Pham <[email protected]>
Cc: Nico Pache <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/huge_memory.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/huge_memory.c~mm-huge_memory-move-softleaf_to_folio-inside-migration-branch
+++ a/mm/huge_memory.c
@@ -2557,11 +2557,12 @@ static void change_non_present_huge_pmd(
bool uffd_wp_resolve)
{
softleaf_t entry = softleaf_from_pmd(*pmd);
- const struct folio *folio = softleaf_to_folio(entry);
pmd_t newpmd;
VM_WARN_ON(!pmd_is_valid_softleaf(*pmd));
if (softleaf_is_migration_write(entry)) {
+ const struct folio *folio = softleaf_to_folio(entry);
+
/*
* A protection check is difficult so
* just be safe and disable write
_
Patches currently in -mm which might be from [email protected] are
mm-mempolicy-skip-non-present-pmds-when-queueing-folios.patch
mm-madvise-skip-device-private-pmds-in-cold-and-pageout-walks.patch
mm-huge_memory-skip-device-private-pmds-in-madvise_free_huge_pmd.patch
mm-vmstat-mm-memcontrol-add-_monotonic-vmstat-readers.patch
mm-vmscan-reduce-lru_lock-contention-via-vmstat-derived-scan-balance-cost.patch