kasan-fix-array-bounds-warnings-in-tests.patch removed from -mm tree
The quilt patch titled
Subject: kasan: fix array-bounds warnings in tests
has been removed from the -mm tree. Its filename was
kasan-fix-array-bounds-warnings-in-tests.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: Andrey Konovalov <[email protected]>
Subject: kasan: fix array-bounds warnings in tests
Date: Mon, 26 Sep 2022 20:08:47 +0200
GCC's -Warray-bounds option detects out-of-bounds accesses to statically-sized allocations in krealloc out-of-bounds tests.
Use OPTIMIZER_HIDE_VAR to suppress the warning.
Also change kmalloc_memmove_invalid_size to use OPTIMIZER_HIDE_VAR instead of a volatile variable.
---
mm/kasan/kasan_test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mm/kasan/kasan_test.c renamed from mm/kasan/kasan_test.c~kasan-fix-array-bounds-warnings-in-tests +8 -1
@@ -295,6 +295,9 @@ static void krealloc_more_oob_helper(str ptr2 =krealloc (ptr1, size2,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr2); +/* Suppress -Warray-bounds warnings. */ +OPTIMIZER_HIDE_VAR (ptr2); +/* All offsets up to size2 must be accessible. */ ptr2[size1 -1 ] ='x' ; ptr2[size1] ='x' ;
@@ -327,6 +330,9 @@ static void krealloc_less_oob_helper(str ptr2 =krealloc (ptr1, size2,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr2); +/* Suppress -Warray-bounds warnings. */ +OPTIMIZER_HIDE_VAR (ptr2); +/* Must be accessible for all modes. */ ptr2[size2 -1 ] ='x' ;
@@ -540,13 +546,14 @@ static void kmalloc_memmove_invalid_size {char *ptr;size_t size =64 ; -volatile size_t invalid_size = size; +size_t invalid_size = size; ptr =kmalloc (size,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr);memset ((char *)ptr,0 ,64 );OPTIMIZER_HIDE_VAR (ptr); +OPTIMIZER_HIDE_VAR (invalid_size);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