Skip to contentSkip to conversation

mm-zsmalloc-copy-kmsan-metadata-in-zs_page_migrate.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 29 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/zsmalloc: copy KMSAN metadata in zs_page_migrate()
has been removed from the -mm tree. Its filename was
mm-zsmalloc-copy-kmsan-metadata-in-zs_page_migrate.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: Shigeru Yoshida <[email protected]>
Subject: mm/zsmalloc: copy KMSAN metadata in zs_page_migrate()
Date: Sat, 21 Mar 2026 22:29:11 +0900

zs_page_migrate() uses copy_page() to copy the contents of a zspage page during migration. However, copy_page() is not instrumented by KMSAN, so the shadow and origin metadata of the destination page are not updated.

As a result, subsequent accesses to the migrated page are reported as use-after-free by KMSAN, despite the data being correctly copied.

Add a kmsan_copy_page_meta() call after copy_page() to propagate the KMSAN metadata to the new page, matching what copy_highpage() does internally.

Fixes afb2d666d025 ("zsmalloc: use copy_page for full page copy")
Cc Mark-PK Tsai <[email protected]>
Cc Minchan Kim <[email protected]>

---

 mm/zsmalloc.c |    1 +
 1 file changed, 1 insertion(+)
mm/zsmalloc.c renamed from mm/zsmalloc.c~mm-zsmalloc-copy-kmsan-metadata-in-zs_page_migrate +1 -0
@@ -1753,6 +1753,7 @@ static int zs_page_migrate(struct page *
 	 */
 	d_addr = kmap_local_zpdesc(newzpdesc);
 	copy_page(d_addr, s_addr);
+	kmsan_copy_page_meta(zpdesc_page(newzpdesc), zpdesc_page(zpdesc));
 	kunmap_local(d_addr);
 
 	for (addr = s_addr + offset; addr < s_addr + PAGE_SIZE;

_

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