kasan-fix-memory-corruption-in-kasan_bitops_tags-test.patch removed from -mm tree
The patch titled
Subject: kasan: fix memory corruption in kasan_bitops_tags test
has been removed from the -mm tree. Its filename was
kasan-fix-memory-corruption-in-kasan_bitops_tags-test.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: kasan: fix memory corruption in kasan_bitops_tags test
Since the hardware tag-based KASAN mode might not have a redzone that comes after an allocated object (when kasan.mode=prod is enabled), the kasan_bitops_tags() test ends up corrupting the next object in memory.
Change the test so it always accesses the redzone that lies within the allocated object's boundaries.
---
lib/test_kasan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/test_kasan.c renamed from lib/test_kasan.c~kasan-fix-memory-corruption-in-kasan_bitops_tags-test +5 -5
@@ -749,13 +749,13 @@ static void kasan_bitops_tags(struct kun/* This test is specifically crafted for tag-based modes. */ KASAN_TEST_NEEDS_CONFIG_OFF (test,CONFIG_KASAN_GENERIC ); -/* Allocation size will be rounded to up granule size, which is 16. */ - bits =kzalloc (sizeof (*bits),GFP_KERNEL ); +/* kmalloc-64 cache will be used and the last 16 bytes will be the redzone. */ + bits =kzalloc (48 ,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, bits); -/* Do the accesses past the 16 allocated bytes. */ -kasan_bitops_modify (test,BITS_PER_LONG , &bits[1 ]); -kasan_bitops_test_and_modify (test,BITS_PER_LONG +BITS_PER_BYTE , &bits[1 ]); +/* Do the accesses past the 48 allocated bytes, but within the redone. */ +kasan_bitops_modify (test,BITS_PER_LONG , (void *)bits +48 ); +kasan_bitops_test_and_modify (test,BITS_PER_LONG +BITS_PER_BYTE , (void *)bits +48 );kfree (bits); }
_
Patches currently in -mm which might be from [email protected] are
kfence-kasan-make-kfence-compatible-with-kasan-fix-2.patch kasan-mm-dont-save-alloc-stacks-twice.patch kasan-mm-optimize-kmalloc-poisoning.patch kasan-optimize-large-kmalloc-poisoning.patch kasan-clean-up-setting-free-info-in-kasan_slab_free.patch kasan-unify-large-kfree-checks.patch kasan-rework-krealloc-tests.patch kasan-mm-fail-krealloc-on-freed-objects.patch kasan-mm-optimize-krealloc-poisoning.patch kasan-ensure-poisoning-size-alignment.patch arm64-kasan-simplify-and-inline-mte-functions.patch kasan-inline-hw_tags-helper-functions.patch kasan-clarify-that-only-first-bug-is-reported-in-hw_tags.patch