Skip to contentSkip to conversation

kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 3, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: kasan: test: only do kmalloc_uaf_memset for generic mode
has been removed from the -mm tree. Its filename was
kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: kasan: test: only do kmalloc_uaf_memset for generic mode

kmalloc_uaf_memset() writes to freed memory, which is only safe with the GENERIC mode (as it uses quarantine). For other modes, this test corrupts kernel memory, which might result in a crash.

Only enable kmalloc_uaf_memset() for the GENERIC mode.

---

 lib/test_kasan.c |    6 ++++++
 1 file changed, 6 insertions(+)
lib/test_kasan.c renamed from lib/test_kasan.c~kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode +6 -0
@@ -534,6 +534,12 @@ static void kmalloc_uaf_memset(struct ku
 	char *ptr;
 	size_t size = 33;
 
+	/*
+	 * Only generic KASAN uses quarantine, which is required to avoid a
+	 * kernel memory corruption this test causes.
+	 */
+	KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_KASAN_GENERIC);
+
 	ptr = kmalloc(size, GFP_KERNEL);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
 

_

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