Skip to content

Commit 0d79481

Browse files
dcpleungcarlescufi
authored andcommitted
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>
1 parent 0e7def1 commit 0d79481

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/xtensa/core/xtensa_mmu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,9 @@ static inline int reset_region(uint32_t *ptables, uintptr_t start, size_t size,
10571057

10581058
void xtensa_user_stack_perms(struct k_thread *thread)
10591059
{
1060-
(void)memset((void *)thread->stack_info.start, 0xAA,
1061-
thread->stack_info.size - thread->stack_info.delta);
1060+
(void)memset((void *)thread->stack_info.start,
1061+
(IS_ENABLED(CONFIG_INIT_STACKS)) ? 0xAA : 0x00,
1062+
thread->stack_info.size - thread->stack_info.delta);
10621063

10631064
update_region(thread_page_tables_get(thread),
10641065
thread->stack_info.start, thread->stack_info.size,

0 commit comments

Comments
 (0)