diff options
| author | Scott Larson <[email protected]> | 2020-10-16 11:57:42 -0700 |
|---|---|---|
| committer | Scott Larson <[email protected]> | 2020-10-16 11:57:42 -0700 |
| commit | 6773d468ae877ce36feda1c86842510fb33501a3 (patch) | |
| tree | f151f40723c3f794adc97f302f3df54a74c081b8 /ports/cortex_m23 | |
| parent | c2df92c885c06b85a3800617b46f291342ea184e (diff) | |
6.1.1 patch: add stack sealing to armv8-m, fix misra warning, fix stack check link errorv6.1.1_rel
Diffstat (limited to 'ports/cortex_m23')
8 files changed, 135 insertions, 49 deletions
diff --git a/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct b/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct index abbe02af..a833a90d 100644 --- a/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct +++ b/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct @@ -71,4 +71,8 @@ LR_ROM __RO_BASE __RO_SIZE { ; load region size_region ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack } + SEAL +0 + { + *.o(.seal+FIRST) + } } diff --git a/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c b/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c index 30dc1dfd..eb5fdfc5 100644 --- a/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c +++ b/ports/cortex_m23/ac5/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c @@ -117,6 +117,9 @@ extern const pFunc __VECTOR_TABLE[240]; #pragma GCC diagnostic pop #endif +/* The linker will place this value at the bottom of the stack to seal the secure main stack. */ +const int stack_seal __attribute__((section (".seal"))) = 0xFEF5EDA5; + /*---------------------------------------------------------------------------- Reset Handler called on controller reset *----------------------------------------------------------------------------*/ diff --git a/ports/cortex_m23/ac5/src/tx_thread_secure_stack.c b/ports/cortex_m23/ac5/src/tx_thread_secure_stack.c index 43a31427..ad4a7119 100644 --- a/ports/cortex_m23/ac5/src/tx_thread_secure_stack.c +++ b/ports/cortex_m23/ac5/src/tx_thread_secure_stack.c @@ -41,6 +41,10 @@ #define TX_THREAD_SECURE_STACK_MAXIMUM 1024 #endif +/* 8 bytes added to stack size to "seal" stack. */ +#define TX_THREAD_STACK_SEAL_SIZE 8 +#define TX_THREAD_STACK_SEAL_VALUE 0xFEF5EDA5 + /* Secure stack info struct to hold stack start, stack limit, current stack pointer, and pointer to owning thread. This will be allocated for each thread with a secure stack. */ @@ -59,7 +63,7 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_initialize Cortex-M23/AC5 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -91,7 +95,9 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -116,7 +122,7 @@ void _tx_thread_secure_stack_initialize(void) /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_allocate Cortex-M23/AC5 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -155,7 +161,10 @@ void _tx_thread_secure_stack_initialize(void) /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* added stack sealing, */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -191,8 +200,8 @@ ULONG sp; if(info_ptr != TX_NULL) { - /* If stack info allocated, allocate a stack. */ - stack_mem = malloc(stack_size); + /* If stack info allocated, allocate a stack & seal. */ + stack_mem = malloc(stack_size + TX_THREAD_STACK_SEAL_SIZE); if(stack_mem != TX_NULL) { @@ -202,6 +211,9 @@ ULONG sp; info_ptr -> tx_thread_secure_stack_ptr = info_ptr -> tx_thread_secure_stack_start; info_ptr -> tx_thread_ptr = thread_ptr; + /* Seal bottom of stack. */ + *(ULONG*)info_ptr -> tx_thread_secure_stack_start = TX_THREAD_STACK_SEAL_VALUE; + /* Save info pointer in thread. */ thread_ptr -> tx_thread_secure_stack_context = info_ptr; @@ -240,7 +252,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_free Cortex-M23/AC5 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -272,7 +284,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -321,7 +335,7 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_save Cortex-M23/AC5 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -353,7 +367,9 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -403,7 +419,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_restore Cortex-M23/AC5 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -434,7 +450,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) diff --git a/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct b/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct index abbe02af..a833a90d 100644 --- a/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct +++ b/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/ARMCM23_ac6.sct @@ -71,4 +71,8 @@ LR_ROM __RO_BASE __RO_SIZE { ; load region size_region ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack } + SEAL +0 + { + *.o(.seal+FIRST) + } } diff --git a/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c b/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c index 30dc1dfd..eb5fdfc5 100644 --- a/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c +++ b/ports/cortex_m23/ac6/example_build/demo_secure_zone/RTE/Device/ARMCM23_TZ/startup_ARMCM23.c @@ -117,6 +117,9 @@ extern const pFunc __VECTOR_TABLE[240]; #pragma GCC diagnostic pop #endif +/* The linker will place this value at the bottom of the stack to seal the secure main stack. */ +const int stack_seal __attribute__((section (".seal"))) = 0xFEF5EDA5; + /*---------------------------------------------------------------------------- Reset Handler called on controller reset *----------------------------------------------------------------------------*/ diff --git a/ports/cortex_m23/ac6/src/tx_thread_secure_stack.c b/ports/cortex_m23/ac6/src/tx_thread_secure_stack.c index 0a48556e..311e67b6 100644 --- a/ports/cortex_m23/ac6/src/tx_thread_secure_stack.c +++ b/ports/cortex_m23/ac6/src/tx_thread_secure_stack.c @@ -41,6 +41,10 @@ #define TX_THREAD_SECURE_STACK_MAXIMUM 1024 #endif +/* 8 bytes added to stack size to "seal" stack. */ +#define TX_THREAD_STACK_SEAL_SIZE 8 +#define TX_THREAD_STACK_SEAL_VALUE 0xFEF5EDA5 + /* Secure stack info struct to hold stack start, stack limit, current stack pointer, and pointer to owning thread. This will be allocated for each thread with a secure stack. */ @@ -59,7 +63,7 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_initialize Cortex-M23/AC6 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -91,7 +95,9 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -116,7 +122,7 @@ void _tx_thread_secure_stack_initialize(void) /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_allocate Cortex-M23/AC6 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -155,7 +161,10 @@ void _tx_thread_secure_stack_initialize(void) /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* added stack sealing, */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -165,7 +174,7 @@ UINT status; TX_THREAD_SECURE_STACK_INFO *info_ptr; UCHAR *stack_mem; ULONG sp; - + status = TX_SUCCESS; /* Make sure function is called from interrupt (threads should not call). */ @@ -191,8 +200,8 @@ ULONG sp; if(info_ptr != TX_NULL) { - /* If stack info allocated, allocate a stack. */ - stack_mem = malloc(stack_size); + /* If stack info allocated, allocate a stack & seal. */ + stack_mem = malloc(stack_size + TX_THREAD_STACK_SEAL_SIZE); if(stack_mem != TX_NULL) { @@ -202,6 +211,9 @@ ULONG sp; info_ptr -> tx_thread_secure_stack_ptr = info_ptr -> tx_thread_secure_stack_start; info_ptr -> tx_thread_ptr = thread_ptr; + /* Seal bottom of stack. */ + *(ULONG*)info_ptr -> tx_thread_secure_stack_start = TX_THREAD_STACK_SEAL_VALUE; + /* Save info pointer in thread. */ thread_ptr -> tx_thread_secure_stack_context = info_ptr; @@ -240,7 +252,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_free Cortex-M23/AC6 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -272,7 +284,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -321,7 +335,7 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_save Cortex-M23/AC6 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -353,7 +367,9 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -403,7 +419,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_restore Cortex-M23/AC6 */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -434,7 +450,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) diff --git a/ports/cortex_m23/gnu/src/tx_thread_secure_stack.c b/ports/cortex_m23/gnu/src/tx_thread_secure_stack.c index 0c9317c8..9ca7ccff 100644 --- a/ports/cortex_m23/gnu/src/tx_thread_secure_stack.c +++ b/ports/cortex_m23/gnu/src/tx_thread_secure_stack.c @@ -41,6 +41,10 @@ #define TX_THREAD_SECURE_STACK_MAXIMUM 1024 #endif +/* 8 bytes added to stack size to "seal" stack. */ +#define TX_THREAD_STACK_SEAL_SIZE 8 +#define TX_THREAD_STACK_SEAL_VALUE 0xFEF5EDA5 + /* Secure stack info struct to hold stack start, stack limit, current stack pointer, and pointer to owning thread. This will be allocated for each thread with a secure stack. */ @@ -59,7 +63,7 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_initialize Cortex-M23/GNU */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -91,7 +95,9 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -116,7 +122,7 @@ void _tx_thread_secure_stack_initialize(void) /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_allocate Cortex-M23/GNU */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -155,7 +161,10 @@ void _tx_thread_secure_stack_initialize(void) /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* added stack sealing, */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -191,8 +200,8 @@ ULONG sp; if(info_ptr != TX_NULL) { - /* If stack info allocated, allocate a stack. */ - stack_mem = malloc(stack_size); + /* If stack info allocated, allocate a stack & seal. */ + stack_mem = malloc(stack_size + TX_THREAD_STACK_SEAL_SIZE); if(stack_mem != TX_NULL) { @@ -202,6 +211,9 @@ ULONG sp; info_ptr -> tx_thread_secure_stack_ptr = info_ptr -> tx_thread_secure_stack_start; info_ptr -> tx_thread_ptr = thread_ptr; + /* Seal bottom of stack. */ + *(ULONG*)info_ptr -> tx_thread_secure_stack_start = TX_THREAD_STACK_SEAL_VALUE; + /* Save info pointer in thread. */ thread_ptr -> tx_thread_secure_stack_context = info_ptr; @@ -240,7 +252,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_free Cortex-M23/GNU */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -272,7 +284,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -321,7 +335,7 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_save Cortex-M23/GNU */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -353,7 +367,9 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -403,7 +419,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_restore Cortex-M23/GNU */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -434,7 +450,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) diff --git a/ports/cortex_m23/iar/src/tx_thread_secure_stack.c b/ports/cortex_m23/iar/src/tx_thread_secure_stack.c index 8cc66628..b9ba72ff 100644 --- a/ports/cortex_m23/iar/src/tx_thread_secure_stack.c +++ b/ports/cortex_m23/iar/src/tx_thread_secure_stack.c @@ -41,6 +41,10 @@ #define TX_THREAD_SECURE_STACK_MAXIMUM 1024 #endif +/* 8 bytes added to stack size to "seal" stack. */ +#define TX_THREAD_STACK_SEAL_SIZE 8 +#define TX_THREAD_STACK_SEAL_VALUE 0xFEF5EDA5 + /* Secure stack info struct to hold stack start, stack limit, current stack pointer, and pointer to owning thread. This will be allocated for each thread with a secure stack. */ @@ -59,7 +63,7 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_initialize Cortex-M23/IAR */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -91,7 +95,9 @@ typedef struct TX_THREAD_SECURE_STACK_INFO_STRUCT /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -116,7 +122,7 @@ void _tx_thread_secure_stack_initialize(void) /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_allocate Cortex-M23/IAR */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -155,7 +161,10 @@ void _tx_thread_secure_stack_initialize(void) /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* added stack sealing, */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -191,8 +200,8 @@ ULONG sp; if(info_ptr != TX_NULL) { - /* If stack info allocated, allocate a stack. */ - stack_mem = malloc(stack_size); + /* If stack info allocated, allocate a stack & seal. */ + stack_mem = malloc(stack_size + TX_THREAD_STACK_SEAL_SIZE); if(stack_mem != TX_NULL) { @@ -202,6 +211,9 @@ ULONG sp; info_ptr -> tx_thread_secure_stack_ptr = info_ptr -> tx_thread_secure_stack_start; info_ptr -> tx_thread_ptr = thread_ptr; + /* Seal bottom of stack. */ + *(ULONG*)info_ptr -> tx_thread_secure_stack_start = TX_THREAD_STACK_SEAL_VALUE; + /* Save info pointer in thread. */ thread_ptr -> tx_thread_secure_stack_context = info_ptr; @@ -240,7 +252,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_mode_stack_free Cortex-M23/IAR */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -272,7 +284,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -321,7 +335,7 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_save Cortex-M23/IAR */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -353,7 +367,9 @@ TX_THREAD_SECURE_STACK_INFO *info_ptr; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) @@ -403,7 +419,7 @@ ULONG sp; /* FUNCTION RELEASE */ /* */ /* _tx_thread_secure_stack_context_restore Cortex-M23/IAR */ -/* 6.1 */ +/* 6.1.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ @@ -434,7 +450,9 @@ ULONG sp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* 10-16-2020 Scott Larson Modified comment(s), */ +/* resulting in version 6.1.1 */ /* */ /**************************************************************************/ __attribute__((cmse_nonsecure_entry)) |
