Skip to content

Commit d2c724f

Browse files
ioannisgandrewboie
authored andcommitted
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 <[email protected]>
1 parent 6311766 commit d2c724f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm/core/thread.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ u32_t z_check_thread_stack_fail(const u32_t fault_addr, const u32_t psp)
287287
}
288288
}
289289
#else /* CONFIG_USERSPACE */
290-
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start,
290+
if (IS_MPU_GUARD_VIOLATION(thread->stack_info.start -
291+
MPU_GUARD_ALIGN_AND_SIZE,
291292
fault_addr, psp)) {
292293
/* Thread stack corruption */
293-
return thread->stack_info.start +
294-
MPU_GUARD_ALIGN_AND_SIZE;
294+
return thread->stack_info.start;
295295
}
296296
#endif /* CONFIG_USERSPACE */
297297

0 commit comments

Comments
 (0)