arch: arm: cortex_r: Do not use user stack in svc/isr modes

The user thread cannot be trusted so do not use the stack pointer it
passes in.  Use the thread's privilege stack when in privileged modes to
make sure a user thread does not trick the svc/isr handlers into writing
to memory it should not.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
This commit is contained in:
Bradley Bolen 2021-05-23 17:23:26 -04:00 committed by Christopher Friedt
commit 65dcab81d0
8 changed files with 183 additions and 68 deletions

View file

@ -121,6 +121,10 @@ struct _thread_arch {
#if defined(CONFIG_USERSPACE)
uint32_t priv_stack_start;
#if defined(CONFIG_CPU_CORTEX_R)
uint32_t priv_stack_end;
uint32_t sp_usr;
#endif
#endif
#endif
};