--- a/lib/test_kasan.c~kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode +++ a/lib/test_kasan.c @@ -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);