From 0e9a891b34361968bb9fb30db8682704bd98b2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:24:00 +0000 Subject: [PATCH 1/9] =?UTF-8?q?HalSecureContextFree=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5=E5=8F=82secure?= =?UTF-8?q?Context=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83=E5=9B=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c index db9a4f9a..7220107b 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c @@ -74,6 +74,16 @@ OS_CMSE_NS_ENTRY OsSecureContext *HalSecureContextAlloc(UINT32 size) OS_CMSE_NS_ENTRY VOID HalSecureContextFree(OsSecureContext *secureContext) { + if (secureContext == NULL) { + return; + } + + SecureHeapInfo heapInfo = HalGetSecureHeapInfo(); + if (secureContext < heapInfo.start || + (secureContext + sizeof(OsSecureContext)) > (heapInfo.start + heapInfo.size)) { + return; + } + UINT32 ipsr; OS_IPSR_READ(ipsr); -- Gitee From 28f3bd62c2f5c8d4bf0dc4a5b3efd7c4b3c0a808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:24:57 +0000 Subject: [PATCH 2/9] =?UTF-8?q?HalSecureContextFree=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5=E5=8F=82secure?= =?UTF-8?q?Context=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83=E5=9B=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c index 7f0077e0..78e2267d 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c @@ -228,3 +228,10 @@ OS_CMSE_NS_ENTRY VOID HalSecureFree(VOID *ptr) OsSecureHeapFreeNode(node); } +OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void) +{ + SecureHeapInfo info; + info.start = g_secureHeap; + info.size = LOSCFG_SECURE_HEAP_SIZE; + return info; +} \ No newline at end of file -- Gitee From 5c5dfde95caaf3181c5a8134451600613afa32f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:25:42 +0000 Subject: [PATCH 3/9] =?UTF-8?q?HalSecureContextFree=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5=E5=8F=82secure?= =?UTF-8?q?Context=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83=E5=9B=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h index d3ee1aad..2548a6e8 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h @@ -40,6 +40,12 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ +typedef struct { + UINT8 *start; + UINT32 size; +} SecureHeapInfo; + +OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void); VOID *HalSecureMalloc(UINT32 size); VOID HalSecureFree(VOID *ptr); -- Gitee From a25042e3c58b5f5cea35a230af142fdf52f0a3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:45:17 +0000 Subject: [PATCH 4/9] =?UTF-8?q?Revert=20"HalSecureContextFree=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5?= =?UTF-8?q?=E5=8F=82secureContext=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=A0=A1=E9=AA=8C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5c5dfde95caaf3181c5a8134451600613afa32f7. --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h index 2548a6e8..d3ee1aad 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h @@ -40,12 +40,6 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -typedef struct { - UINT8 *start; - UINT32 size; -} SecureHeapInfo; - -OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void); VOID *HalSecureMalloc(UINT32 size); VOID HalSecureFree(VOID *ptr); -- Gitee From fb08497c201160e10f487977c9d64e8895855ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:46:11 +0000 Subject: [PATCH 5/9] =?UTF-8?q?Revert=20"HalSecureContextFree=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5?= =?UTF-8?q?=E5=8F=82secureContext=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=A0=A1=E9=AA=8C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 28f3bd62c2f5c8d4bf0dc4a5b3efd7c4b3c0a808. --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c index 78e2267d..7f0077e0 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c @@ -228,10 +228,3 @@ OS_CMSE_NS_ENTRY VOID HalSecureFree(VOID *ptr) OsSecureHeapFreeNode(node); } -OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void) -{ - SecureHeapInfo info; - info.start = g_secureHeap; - info.size = LOSCFG_SECURE_HEAP_SIZE; - return info; -} \ No newline at end of file -- Gitee From 164c4c274530cdc6395b3b889948def3397a5d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:46:38 +0000 Subject: [PATCH 6/9] =?UTF-8?q?Revert=20"HalSecureContextFree=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5?= =?UTF-8?q?=E5=8F=82secureContext=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=A0=A1=E9=AA=8C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0e9a891b34361968bb9fb30db8682704bd98b2be. --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c index 7220107b..db9a4f9a 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c @@ -74,16 +74,6 @@ OS_CMSE_NS_ENTRY OsSecureContext *HalSecureContextAlloc(UINT32 size) OS_CMSE_NS_ENTRY VOID HalSecureContextFree(OsSecureContext *secureContext) { - if (secureContext == NULL) { - return; - } - - SecureHeapInfo heapInfo = HalGetSecureHeapInfo(); - if (secureContext < heapInfo.start || - (secureContext + sizeof(OsSecureContext)) > (heapInfo.start + heapInfo.size)) { - return; - } - UINT32 ipsr; OS_IPSR_READ(ipsr); -- Gitee From 637dffb3822412297fcbf5ca52b5e58e88858771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:48:10 +0000 Subject: [PATCH 7/9] =?UTF-8?q?HalSecureContextFree=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=20=E5=85=A5=E5=8F=82secure?= =?UTF-8?q?Context=E7=9A=84=E5=9C=B0=E5=9D=80=E8=8C=83=E5=9B=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 石子怡 --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c index db9a4f9a..7220107b 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_context.c @@ -74,6 +74,16 @@ OS_CMSE_NS_ENTRY OsSecureContext *HalSecureContextAlloc(UINT32 size) OS_CMSE_NS_ENTRY VOID HalSecureContextFree(OsSecureContext *secureContext) { + if (secureContext == NULL) { + return; + } + + SecureHeapInfo heapInfo = HalGetSecureHeapInfo(); + if (secureContext < heapInfo.start || + (secureContext + sizeof(OsSecureContext)) > (heapInfo.start + heapInfo.size)) { + return; + } + UINT32 ipsr; OS_IPSR_READ(ipsr); -- Gitee From c9c834a353b9f1bcf8c4b0d4d20469bb9491cd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:48:39 +0000 Subject: [PATCH 8/9] update arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 石子怡 --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c index 7f0077e0..78e2267d 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.c @@ -228,3 +228,10 @@ OS_CMSE_NS_ENTRY VOID HalSecureFree(VOID *ptr) OsSecureHeapFreeNode(node); } +OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void) +{ + SecureHeapInfo info; + info.start = g_secureHeap; + info.size = LOSCFG_SECURE_HEAP_SIZE; + return info; +} \ No newline at end of file -- Gitee From 8676f3179b3b7002995953023fb3a96d8d656f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=AD=90=E6=80=A1?= Date: Tue, 25 Mar 2025 07:49:00 +0000 Subject: [PATCH 9/9] update arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 石子怡 --- arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h index d3ee1aad..2548a6e8 100644 --- a/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h +++ b/arch/arm/cortex-m33/iar/TZ/secure/los_secure_heap.h @@ -40,6 +40,12 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ +typedef struct { + UINT8 *start; + UINT32 size; +} SecureHeapInfo; + +OS_CMSE_NS_ENTRY SecureHeapInfo HalGetSecureHeapInfo(void); VOID *HalSecureMalloc(UINT32 size); VOID HalSecureFree(VOID *ptr); -- Gitee