@@ -72,6 +72,11 @@ static bool test_heap_memset(FAR struct mm_heap_s *heap, size_t size);
72
72
static bool test_heap_memcpy (FAR struct mm_heap_s * heap , size_t size );
73
73
static bool test_heap_memmove (FAR struct mm_heap_s * heap , size_t size );
74
74
75
+ #ifdef CONFIG_MM_KASAN_GLOBAL
76
+ static bool test_global_underflow (FAR struct mm_heap_s * heap , size_t size );
77
+ static bool test_global_overflow (FAR struct mm_heap_s * heap , size_t size );
78
+ #endif
79
+
75
80
/****************************************************************************
76
81
* Private Data
77
82
****************************************************************************/
@@ -87,11 +92,19 @@ const static testcase_t g_kasan_test[] =
87
92
{test_heap_unpoison , "heap unpoison" },
88
93
{test_heap_memset , "heap memset" },
89
94
{test_heap_memcpy , "heap memcpy" },
90
- {test_heap_memmove , "heap memmove" }
95
+ {test_heap_memmove , "heap memmove" },
96
+ #ifdef CONFIG_MM_KASAN_GLOBAL
97
+ {test_global_underflow , "globals underflow" },
98
+ {test_global_overflow , "globals overflow" },
99
+ #endif
91
100
};
92
101
93
102
static char g_kasan_heap [65536 ] aligned_data (8 );
94
103
104
+ #ifdef CONFIG_MM_KASAN_GLOBAL
105
+ static char g_kasan_globals [32 ];
106
+ #endif
107
+
95
108
/****************************************************************************
96
109
* Private Functions
97
110
****************************************************************************/
@@ -210,6 +223,20 @@ static bool test_heap_memmove(FAR struct mm_heap_s *heap, size_t size)
210
223
return false;
211
224
}
212
225
226
+ #ifdef CONFIG_MM_KASAN_GLOBAL
227
+ static bool test_global_underflow (FAR struct mm_heap_s * heap , size_t size )
228
+ {
229
+ memset (g_kasan_globals - 31 , 0x12 , sizeof (g_kasan_globals ));
230
+ return false;
231
+ }
232
+
233
+ static bool test_global_overflow (FAR struct mm_heap_s * heap , size_t size )
234
+ {
235
+ memset (g_kasan_globals , 0xef , sizeof (g_kasan_globals ) + 31 );
236
+ return false;
237
+ }
238
+ #endif
239
+
213
240
static int run_test (FAR const testcase_t * test )
214
241
{
215
242
size_t heap_size = 65536 ;
0 commit comments