Skip to contentSkip to conversation

mm-kmsan-fix-poisoning-of-high-order-non-compound-pages.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jan 13 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: kmsan: fix poisoning of high-order non-compound pages
has been removed from the -mm tree. Its filename was
mm-kmsan-fix-poisoning-of-high-order-non-compound-pages.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Ryan Roberts <[email protected]>
Subject: mm: kmsan: fix poisoning of high-order non-compound pages
Date: Sun, 4 Jan 2026 13:43:47 +0000

kmsan_free_page() is called by the page allocator's free_pages_prepare() during page freeing. Its job is to poison all the memory covered by the page. It can be called with an order-0 page, a compound high-order page or a non-compound high-order page. But page_size() only works for order-0 and compound pages. For a non-compound high-order page it will incorrectly return PAGE_SIZE.

The implication is that the tail pages of a high-order non-compound page do not get poisoned at free, so any invalid access while they are free could go unnoticed. It looks like the pages will be poisoned again at allocation time, so that would bookend the window.

Fix this by using the order parameter to calculate the size.

Fixes b073d7f8aee4 ("mm: kmsan: maintain KMSAN metadata for page operations")
Cc Dmitriy Vyukov <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Marco Elver <[email protected]>
Cc Ryan Roberts <[email protected]>

---

 mm/kmsan/shadow.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kmsan/shadow.c renamed from mm/kmsan/shadow.c~mm-kmsan-fix-poisoning-of-high-order-non-compound-pages +1 -1
@@ -207,7 +207,7 @@ void kmsan_free_page(struct page *page,
 	if (!kmsan_enabled || kmsan_in_runtime())
 		return;
 	kmsan_enter_runtime();
-	kmsan_internal_poison_memory(page_address(page), page_size(page),
+	kmsan_internal_poison_memory(page_address(page), PAGE_SIZE << order,
 				     GFP_KERNEL & ~(__GFP_RECLAIM),
 				     KMSAN_POISON_CHECK | KMSAN_POISON_FREE);
 	kmsan_leave_runtime();

_

Patches currently in -mm which might be from [email protected] are