From 30f5ab89b72d45f596b15af82a8e8e01add7977d Mon Sep 17 00:00:00 2001 From: Haryslee Date: Tue, 15 Jun 2021 11:43:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E5=A0=86=E5=AE=8C=E6=95=B4=E6=80=A7=E6=A3=80=E6=9F=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=B8=AD=E8=AE=BF=E9=97=AE=E9=9D=9E=E6=B3=95=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=AF=BC=E8=87=B4=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内存完整性校验原有逻辑中当检测到非零异常指针后仍继续访问异常指针 next的内存域导致系统异常。 本次修改后的逻辑为:检测到非零异常指针后直接退出循环,将异常指针 的相关信息输出即可,增加了goto逻辑。对原有功能逻辑无影响。 close #I3VJZT Change-Id: I5be06a552cf9fd74d8bd78f5cdf04db06eab4f76 Signed-off-by: Haryslee --- kernel/base/mem/tlsf/los_memory.c | 2 ++ kernel/base/vm/los_vm_map.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/base/mem/tlsf/los_memory.c b/kernel/base/mem/tlsf/los_memory.c index 7db9db96..a958ce92 100644 --- a/kernel/base/mem/tlsf/los_memory.c +++ b/kernel/base/mem/tlsf/los_memory.c @@ -1595,10 +1595,12 @@ STATIC VOID OsMemPoolHeadCheck(const struct OsMemPoolHead *pool) flag = 1; PRINT_ERR("FreeListIndex: %u, node: %#x, bNode: %#x, prev: %#x, next: %#x\n", index, tmpNode, tmpNode->header.ptr.prev, tmpNode->prev, tmpNode->next); + goto OUT; } } } +OUT: if (flag) { PRINTK("mem pool info: poolAddr: %#x, poolSize: 0x%x\n", pool, pool->info.totalSize); #if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES) diff --git a/kernel/base/vm/los_vm_map.c b/kernel/base/vm/los_vm_map.c index 28f853a7..0ad9ae65 100644 --- a/kernel/base/vm/los_vm_map.c +++ b/kernel/base/vm/los_vm_map.c @@ -1135,7 +1135,7 @@ DONE: LosMux *OsGVmSpaceMuxGet(VOID) { - return &g_vmSpaceListMux; + return &g_vmSpaceListMux; } STATIC INLINE BOOL OsMemLargeAlloc(UINT32 size)