Skip to content
Permalink
Browse files

arch: arm: fix start of MPU guard in stack-fail check (no user mode)

When building without support for user mode (CONFIG_USERSPACE=n)
we need to correct the starting address of the MPU Guard, before
passing it to the function that evaluates whether a stack
corruption has occurred. The bug was introduced by commit
(60bae5d) in
PR-13619, where the start address of the MPU guard was properly
corrected, but the guard start at the corresponding stack-fail
check was not adjusted accordingly.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and andrewboie committed Jun 11, 2019
1 parent 6311766 commit d2c724f4c9c83bef061cd0184e2161d0ded6486e
Showing with 3 additions and 3 deletions.
  1. +3 −3 arch/arm/core/thread.c
@@ -287,11 +287,11 @@ u32_t z_check_thread_stack_fail(const u32_t fault_addr, const u32_t psp)
}
}
#else /* CONFIG_USERSPACE */
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start,
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start -
MPU_GUARD_ALIGN_AND_SIZE,
fault_addr, psp)) {
/* Thread stack corruption */
return thread->stack_info.start +
MPU_GUARD_ALIGN_AND_SIZE;
return thread->stack_info.start;
}
#endif /* CONFIG_USERSPACE */

0 comments on commit d2c724f

Please sign in to comment.
You can’t perform that action at this time.