[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260113205441.506897-1-boudewijn@delta-utec.com>
Date: Tue, 13 Jan 2026 21:54:41 +0100
From: Boudewijn van der Heide <boudewijn@...ta-utec.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Vlastimil Babka <vbabka@...e.cz>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
Brendan Jackman <jackmanb@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Zi Yan <ziy@...dia.com>,
Naoya Horiguchi <nao.horiguchi@...il.com>,
Oscar Salvador <osalvador@...e.de>,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
boudewijn@...ta-utec.com
Subject: [PATCH] mm/page_alloc: Fix freeing of failed-split poisoned compound pages
free_pages_prepare() only handles poisoned order-0 pages.
In memory_failure() (hard offline), pages
are poisoned before attempting to split huge pages. If the split fails,
the page remains a compound (order > 0) but is already poisoned. However,
Soft-offline pages are always poisoned as order-0 after migration, so
they are unaffected.
The '!order' check causes these poisoned compound pages to skip
poison handling, leaving them in the buddy allocator.
Worst case, a poisoned compound page could be reallocated,
potentially leading to crashes, silent data corruption,
or unwanted memory containment actions before the poison bit is detected.
This patch removes the '&& !order' restriction. Cleanup functions in the
poison-handling block correctly handle non-zero order pages, making
this change safe.
Fixes: 79f5f8fab482 ("mm,hwpoison: rework soft offline for in-use pages")
Signed-off-by: Boudewijn van der Heide <boudewijn@...ta-utec.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c380f063e8b7..64d15e56706c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1344,7 +1344,7 @@ __always_inline bool free_pages_prepare(struct page *page,
count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages);
}
- if (unlikely(PageHWPoison(page)) && !order) {
+ if (unlikely(PageHWPoison(page))) {
/* Do not let hwpoison pages hit pcplists/buddy */
reset_page_owner(page, order);
page_table_check_free(page, order);
--
2.47.3
Powered by blists - more mailing lists