From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,ziy@nvidia.com,yuzhao@google.com,
willy@infradead.org,tz2294@columbia.edu,stable@vger.kernel.org,
rppt@kernel.org,osalvador@suse.de,nao.horiguchi@gmail.com,
muchun.song@linux.dev,mike.kravetz@oracle.com,linmiaohe@huawei.com,
kaitao.cheng@linux.dev,jane.chu@oracle.com,david@kernel.org,
mt4022@columbia.edu,akpm@linux-foundation.org
Subject: + mm-hugetlb-clear-the-hugetlb-flag-before-leaking-a-hwpoisoned-folio.patch added to mm-new branch
Date: Wed, 18 Nov 2026 23:07:07 -0800 [thread overview]
Message-ID: <20261119070707.684D41F000C4@smtp.kernel.org> (raw)
In-Reply-To: <20261103-hugetlb-hwpoison-leak-v2-2-98085750c145@columbia.edu>
The patch titled
Subject: mm/hugetlb: clear the hugetlb flag before leaking a hwpoisoned folio
has been added to the -mm mm-new branch. Its filename is
mm-hugetlb-clear-the-hugetlb-flag-before-leaking-a-hwpoisoned-folio.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb-clear-the-hugetlb-flag-before-leaking-a-hwpoisoned-folio.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: Mani Tofigh <mt4022@columbia.edu>
Subject: mm/hugetlb: clear the hugetlb flag before leaking a hwpoisoned folio
Date: Tue, 03 Nov 2026 16:00:50 -0500
If hugetlb_update_hwpoison() fails to allocate a raw_hwp_page, the folio
is marked raw_hwp_unreliable and __update_and_free_hugetlb_folio() leaks
it intentionally. With hugetlb_free_vmemmap=on, it's leaked before the
hugetlb flag is cleared, since commit 32c877191e02 ("hugetlb: do not
clear hugetlb dtor until allocating vmemmap") doesn't remove the flag
until the vmemmap is restored. The leaked folio is then a hugetlb folio
with refcount 0 and on no list (the same state as a hugetlb folio that
is being freed), but nothing is freeing it, and
dissolve_free_hugetlb_folio() keeps retrying on it. Offlining its
memory block then never completes, even on SIGKILL, and other tasks
block on the memory hotplug lock:
[ 3.271255] Memory failure: 0x20007: recovery action for free huge page: Failed
[ 41.729695] INFO: task hugeoffline:77 blocked for more than 20 seconds.
...
[ 41.733014] get_online_mems+0xc1/0xd0
[ 41.733026] soft_offline_page+0xfd/0x9b0
alloc_and_dissolve_hugetlb_folio() loops on it the same way. The
refcount is 0 since commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race
with speculative PFN walkers"). Before that these paths failed with
-EBUSY.
Check raw_hwp_unreliable after the hugetlb flag is cleared so that the
folio is leaked as a non-hugetlb folio, as without vmemmap
optimization. unpoison_memory() keeps refusing to unpoison it. With
the fix, offlining retries as it does for any page it can't isolate,
and stops on a signal.
Link: https://patch.msgid.link/20261103-hugetlb-hwpoison-leak-v2-2-98085750c145@columbia.edu
Fixes: 32c877191e02 ("hugetlb: do not clear hugetlb dtor until allocating vmemmap")
Fixes: bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative PFN walkers")
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Kaitao Cheng <kaitao.cheng@linux.dev>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Tal Zussman <tz2294@columbia.edu>
Cc: <stable@vger.kernel.org>
mm/hugetlb.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/mm/hugetlb.c~mm-hugetlb-clear-the-hugetlb-flag-before-leaking-a-hwpoisoned-folio
+++ a/mm/hugetlb.c
@@ -1515,13 +1515,6 @@ static void __update_and_free_hugetlb_fo
}
/*
- * If we don't know which subpages are hwpoisoned, we can't free
- * the hugepage, so it's leaked intentionally.
- */
- if (folio_test_hugetlb_raw_hwp_unreliable(folio))
- return;
-
- /*
* If folio is not vmemmap optimized (!clear_flag), then the folio
* is no longer identified as a hugetlb page. hugetlb_vmemmap_restore_folio
* can only be passed hugetlb pages and will BUG otherwise.
@@ -1549,6 +1542,14 @@ static void __update_and_free_hugetlb_fo
}
/*
+ * If we don't know which subpages are hwpoisoned, we can't free
+ * the hugepage, so it's leaked intentionally, but only once it is
+ * no longer a hugetlb folio.
+ */
+ if (folio_test_hugetlb_raw_hwp_unreliable(folio))
+ return;
+
+ /*
* Move PageHWPoison flag from head page to the raw error pages,
* which makes any healthy subpages reusable.
*/
_
Patches currently in -mm which might be from mt4022@columbia.edu are
mm-swapfile-drop-a-large-unmapped-swap-in-folio-in-unuse_pte.patch
mm-memory-failure-dont-unpoison-a-leaked-raw_hwp_unreliable-folio.patch
mm-hugetlb-clear-the-hugetlb-flag-before-leaking-a-hwpoisoned-folio.patch
next prev parent reply other threads:[~2026-11-19 7:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 21:00 [PATCH v2 0/2] mm/hugetlb: clear the hugetlb flag before leaking a hwpoisoned folio Mani Tofigh via B4 Relay
2026-11-03 21:00 ` [PATCH v2 1/2] mm/memory-failure: don't unpoison a leaked raw_hwp_unreliable folio Mani Tofigh via B4 Relay
2026-11-19 6:39 ` Miaohe Lin
2026-11-19 7:11 ` Andrew Morton
2026-11-19 7:30 ` Miaohe Lin
2026-11-19 7:07 ` + mm-memory-failure-dont-unpoison-a-leaked-raw_hwp_unreliable-folio.patch added to mm-new branch Andrew Morton
2026-11-03 21:00 ` [PATCH v2 2/2] mm/hugetlb: clear the hugetlb flag before leaking a hwpoisoned folio Mani Tofigh via B4 Relay
2026-11-19 6:40 ` Miaohe Lin
2026-11-19 7:07 ` Andrew Morton [this message]
2026-11-19 7:06 ` [PATCH v2 0/2] " Andrew Morton
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=20261119070707.684D41F000C4@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jane.chu@oracle.com \
--cc=kaitao.cheng@linux.dev \
--cc=linmiaohe@huawei.com \
--cc=mike.kravetz@oracle.com \
--cc=mm-commits@vger.kernel.org \
--cc=mt4022@columbia.edu \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tz2294@columbia.edu \
--cc=willy@infradead.org \
--cc=yuzhao@google.com \
--cc=ziy@nvidia.com \
/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