kasan-add-test-for-invalid-size-in-memmove.patch removed from -mm tree
The patch titled
Subject: kasan: add test for invalid size in memmove
has been removed from the -mm tree. Its filename was
kasan-add-test-for-invalid-size-in-memmove.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Walter Wu <[email protected]>
Subject: kasan: add test for invalid size in memmove
Test negative size in memmove in order to verify whether it correctly get KASAN report.
Casting negative numbers to size_t would indeed turn up as a large size_t, so it will have out-of-bounds bug and be detected by KASAN.
[[email protected]: fix -Wstringop-overflow warning]
Signed-off-by Walter Wu <[email protected]>
Reviewed-by Dmitry Vyukov <[email protected]>
Reviewed-by Andrey Ryabinin <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc kernel test robot <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
lib/test_kasan.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
lib/test_kasan.c renamed from lib/test_kasan.c~kasan-add-test-for-invalid-size-in-memmove +19 -0
@@ -285,6 +285,24 @@ static noinline void __init kmalloc_oob_kfree (ptr); } +static noinline void __init kmalloc_memmove_invalid_size(void) +{ +char *ptr; +size_t size =64 ; +volatile size_t invalid_size =-2 ; + +pr_info ("invalid size in memmove\n" ); + ptr =kmalloc (size,GFP_KERNEL ); +if (!ptr) { +pr_err ("Allocation failed\n" ); +return ; + } + +memset ((char *)ptr,0 ,64 ); +memmove ((char *)ptr, (char *)ptr +4 , invalid_size); +kfree (ptr); +} + static noinline void __init kmalloc_uaf(void) {char *ptr;
@@ -799,6 +817,7 @@ static int __init kmalloc_tests_init(voikmalloc_oob_memset_4 ();kmalloc_oob_memset_8 ();kmalloc_oob_memset_16 (); +kmalloc_memmove_invalid_size ();kmalloc_uaf ();kmalloc_uaf_memset ();kmalloc_uaf2 ();
_
Patches currently in -mm which might be from [email protected] are