Skip to contentSkip to conversation

kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.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: disable kmalloc_memmove_invalid_size for HW_TAGS
has been removed from the -mm tree. Its filename was
kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch

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

------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS

The HW_TAGS mode doesn't check memmove for negative size. As a result, the kmalloc_memmove_invalid_size test corrupts memory, which can result in a crash.

Disable this test with HW_TAGS KASAN.

---

 lib/test_kasan.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
lib/test_kasan.c renamed from lib/test_kasan.c~kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags +7 -1
@@ -501,11 +501,17 @@ static void kmalloc_memmove_invalid_size
 	size_t size = 64;
 	volatile size_t invalid_size = -2;
 
+	/*
+	 * Hardware tag-based mode doesn't check memmove for negative size.
+	 * As a result, this test introduces a side-effect memory corruption,
+	 * which can result in a crash.
+	 */
+	KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_HW_TAGS);
+
 	ptr = kmalloc(size, GFP_KERNEL);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
 
 	memset((char *)ptr, 0, 64);
-
 	KUNIT_EXPECT_KASAN_FAIL(test,
 		memmove((char *)ptr, (char *)ptr + 4, invalid_size));
 	kfree(ptr);

_

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