You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/01 17:44:55 UTC

[incubator-nuttx] 01/02: mm/kasan: node header should updated from unpoisoning memory

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 87cb224b1ca01e9b97c15d44e69b5bd64dd7e5db
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Aug 1 15:53:24 2022 +0800

    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 <an...@xiaomi.com>
---
 mm/mm_heap/mm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h
index b139da9c39..f82bc30881 100644
--- a/mm/mm_heap/mm.h
+++ b/mm/mm_heap/mm.h
@@ -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