Commit f938723
fw/kernel: classify MemManage stacking faults as stack overflows
mem_manage_handler_c() only detects a stack overflow by checking
whether MMFAR points into a stack guard region, gated on MMARVALID.
A stacking fault (MSTKERR) -- exception entry pushing the frame after
SP already overflowed into the guard -- never writes MMFAR, so it took
the generic path and fault_handler_dump() dereferenced stacked_args
inside the NoAccess guard region. That second fault escalated to a
HardFault and rebooted the whole watch, so an app overflowing its
stack on every launch looped the watch into the bootloader's PRF
fallback instead of just being killed.
Treat MSTKERR as a stack overflow directly. The stack overflow path
already avoids reading the stacked frame when MSTKERR is set.
Fixes FIRM-3949
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Joshua Jun <lets@throw.rocks>1 parent b452498 commit f938723
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
354 | 362 | | |
355 | 363 | | |
356 | 364 | | |
| |||
0 commit comments