fix: 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。

内存完整性校验原有逻辑中当检测到非零异常指针后仍继续访问异常指针
next的内存域导致系统异常。
本次修改后的逻辑为:检测到非零异常指针后直接退出循环,将异常指针
的相关信息输出即可,增加了goto逻辑。对原有功能逻辑无影响。

close #I3VJZT

Change-Id: I5be06a552cf9fd74d8bd78f5cdf04db06eab4f76
Signed-off-by: Haryslee <lihao189@huawei.com>
This commit is contained in:
Haryslee 2021-06-15 11:43:07 +08:00
parent 36e5124c0a
commit 30f5ab89b7
2 changed files with 3 additions and 1 deletions

View File

@ -1595,10 +1595,12 @@ STATIC VOID OsMemPoolHeadCheck(const struct OsMemPoolHead *pool)
flag = 1; flag = 1;
PRINT_ERR("FreeListIndex: %u, node: %#x, bNode: %#x, prev: %#x, next: %#x\n", PRINT_ERR("FreeListIndex: %u, node: %#x, bNode: %#x, prev: %#x, next: %#x\n",
index, tmpNode, tmpNode->header.ptr.prev, tmpNode->prev, tmpNode->next); index, tmpNode, tmpNode->header.ptr.prev, tmpNode->prev, tmpNode->next);
goto OUT;
} }
} }
} }
OUT:
if (flag) { if (flag) {
PRINTK("mem pool info: poolAddr: %#x, poolSize: 0x%x\n", pool, pool->info.totalSize); PRINTK("mem pool info: poolAddr: %#x, poolSize: 0x%x\n", pool, pool->info.totalSize);
#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) #if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES)

View File

@ -1135,7 +1135,7 @@ DONE:
LosMux *OsGVmSpaceMuxGet(VOID) LosMux *OsGVmSpaceMuxGet(VOID)
{ {
return &g_vmSpaceListMux; return &g_vmSpaceListMux;
} }
STATIC INLINE BOOL OsMemLargeAlloc(UINT32 size) STATIC INLINE BOOL OsMemLargeAlloc(UINT32 size)