Skip to contentSkip to conversation

kmsan-enter-the-runtime-around-kmsan_internal_memmove_metadata-call.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 21, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kmsan: enter the runtime around kmsan_internal_memmove_metadata() call
has been removed from the -mm tree. Its filename was
kmsan-enter-the-runtime-around-kmsan_internal_memmove_metadata-call.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: Alexander Potapenko <[email protected]>
Subject: kmsan: enter the runtime around kmsan_internal_memmove_metadata() call
Date: Wed, 7 May 2025 18:00:11 +0200

kmsan_internal_memmove_metadata() transitively calls stack_depot_save() (via kmsan_internal_chain_origin() and kmsan_save_stack_with_flags()), which may allocate memory. Guard it with kmsan_enter_runtime() and kmsan_leave_runtime() to avoid recursion.

This bug was spotted by CONFIG_WARN_CAPABILITY_ANALYSIS=y

---

 mm/kmsan/hooks.c |    2 ++
 1 file changed, 2 insertions(+)
mm/kmsan/hooks.c renamed from mm/kmsan/hooks.c~kmsan-enter-the-runtime-around-kmsan_internal_memmove_metadata-call +2 -0
@@ -275,8 +275,10 @@ void kmsan_copy_to_user(void __user *to,
 		 * Don't check anything, just copy the shadow of the copied
 		 * bytes.
 		 */
+		kmsan_enter_runtime();
 		kmsan_internal_memmove_metadata((void *)to, (void *)from,
 						to_copy - left);
+		kmsan_leave_runtime();
 	}
 	user_access_restore(ua_flags);
 }

_

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