mm: Support the kernel address sanitizer

Signed-off-by: chenwei23 <chenwei23@xiaomi.com>
This commit is contained in:
chenwei23
2021-10-09 15:22:28 +08:00
committed by Gustavo Henrique Nihei
parent 5cb6b042aa
commit 39cdd99d77
12 changed files with 625 additions and 20 deletions
+5
View File
@@ -31,6 +31,7 @@
#include <nuttx/mm/mm.h>
#include "mm_heap/mm.h"
#include "kasan/kasan.h"
/****************************************************************************
* Public Functions
@@ -86,6 +87,10 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart,
DEBUGASSERT(heapsize <= MMSIZE_MAX + 1);
#endif
/* Register to KASan for access check */
kasan_register(heapstart, &heapsize);
DEBUGVERIFY(mm_takesemaphore(heap));
/* Adjust the provided heap start and size so that they are both aligned