xtensa: userspace: only write 0xAA to stack if INIT_STACKS

Only clear the user stack to 0xAA if CONFIG_INIT_STACKS is
enabled. Otherwise, write 0x00 as if the stack is in BSS.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-08-30 15:36:21 -07:00 committed by Carles Cufí
commit 0d79481540

View file

@ -1057,7 +1057,8 @@ static inline int reset_region(uint32_t *ptables, uintptr_t start, size_t size,
void xtensa_user_stack_perms(struct k_thread *thread) void xtensa_user_stack_perms(struct k_thread *thread)
{ {
(void)memset((void *)thread->stack_info.start, 0xAA, (void)memset((void *)thread->stack_info.start,
(IS_ENABLED(CONFIG_INIT_STACKS)) ? 0xAA : 0x00,
thread->stack_info.size - thread->stack_info.delta); thread->stack_info.size - thread->stack_info.delta);
update_region(thread_page_tables_get(thread), update_region(thread_page_tables_get(thread),