mm/kasan: node header should updated from unpoisoning memory

| (gdb) bt
| #0  up_assert (filename=0x7fffffffdc6c "\001", lineno=0) at sim/up_assert.c:75
| #1  0x00005555555e636b in _assert (filename=0x555555627225 "kasan/kasan.c", linenum=104) at assert/lib_assert.c:36
| #2  0x00005555555a388e in kasan_report (addr=140737284458088, size=1, is_write=true) at kasan/kasan.c:104
| #3  0x00005555555a40a1 in __asan_storeN_noabort (addr=140737284458088, size=1) at kasan/kasan.c:297
| #4  0x00005555555a4519 in __asan_store1_noabort (addr=140737284458088) at kasan/kasan.c:348
| #5  0x00005555555a26d7 in memset (s=0x7ffff3d8c668, c=0, n=63) at string/lib_memset.c:169
| #6  0x00005555555a46a4 in mm_addregion (heap=0x7ffff3d8c000, heapstart=0x7ffff3d8c648, heapsize=66058656) at mm_heap/mm_initialize.c:131
| #7  0x00005555555a4a00 in mm_initialize (name=0x555555627068 "Umem", heapstart=0x7ffff3d8c648, heapsize=67107256) at mm_heap/mm_initialize.c:231
| #8  0x00005555555a33b1 in umm_initialize (heap_start=0x7ffff3d8c000, heap_size=67108864) at umm_heap/umm_initialize.c:84
| #9  0x000055555558f17c in nx_start () at init/nx_start.c:469
| #10 0x0000555555589559 in main (argc=1, argv=0x7fffffffdf58, envp=0x7fffffffdf68) at sim/up_head.c:131
| (gdb)

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-08-01 15:53:24 +08:00 committed by Xiang Xiao
parent 78381f9fc4
commit 87cb224b1c
1 changed files with 2 additions and 0 deletions

View File

@ -105,6 +105,7 @@
do \
{ \
FAR struct mm_allocnode_s *tmp = (FAR struct mm_allocnode_s *)(ptr); \
kasan_unpoison(tmp, SIZEOF_MM_ALLOCNODE); \
tmp->pid = getpid(); \
if ((heap)->mm_procfs.backtrace) \
{ \
@ -115,6 +116,7 @@
{ \
tmp->backtrace[0] = 0; \
} \
kasan_poison(tmp, SIZEOF_MM_ALLOCNODE); \
} \
while (0)
#else