Skip to content

Commit 6b5bed6

Browse files
Wayne Rennashif
authored andcommitted
arch: arc: fix the handling of stack check exception
stack check exception may come out with other protection vilation, e.g. MPU read/write. So the possible paramter will be 0x02 | [0x4 | 0x8]. Signed-off-by: Wayne Ren <[email protected]>
1 parent b2b4f09 commit 6b5bed6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/arc/core/fault.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ void _Fault(NANO_ESF *esf)
7474
#ifdef CONFIG_ARC_STACK_CHECKING
7575
/* Vector 6 = EV_ProV. Regardless of code, parameter 2 means stack
7676
* check violation
77+
* stack check and mpu violation can come out together, then
78+
* parameter = 0x2 | [0x4 | 0x8 | 0x1]
7779
*/
78-
if (vector == 6 && parameter == 2) {
80+
if (vector == 6 && parameter & 0x2) {
7981
z_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, esf);
8082
return;
8183
}

tests/kernel/fatal/src/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,11 @@ void test_fatal(void)
279279

280280
#ifdef CONFIG_USERSPACE
281281

282-
#if !defined(CONFIG_ARC) /* FIXME #13341 */
283282
TC_PRINT("test stack HW-based overflow - user 1\n");
284283
check_stack_overflow(stack_hw_overflow, K_USER);
285284

286285
TC_PRINT("test stack HW-based overflow - user 2\n");
287286
check_stack_overflow(stack_hw_overflow, K_USER);
288-
#endif
289287
#endif /* CONFIG_USERSPACE */
290288

291289
#endif /* !CONFIG_ARCH_POSIX */

0 commit comments

Comments
 (0)