Open KamilxPaszkiet opened 1 month ago
It looks like a stack overflow, so perhaps a configuration issue?
Observed also on nsim/nsim_hs/mpuv6.
nsim/nsim_hs/mpuv6 tests/posix/common/portability.posix.common.newlib FAILED Timeout (nsim 2.060s)
_twister-out/nsim_nsim_hsmpuv6/tests/posix/common/portability.posix.common.newlib/handler.log
...
===================================================================
START - test_sigismember_oor
PASS - test_sigismember_oor in 0.001 seconds
===================================================================
START - test_signal_strsignal
E: ***** Exception vector: 0x6, cause code: 0x1, parameter 0x2
E: Address 0x80003da0
E: EV_ProtV
E: Memory read protection violation (stack checking scheme)
E: r0: 0x80003da4 r1: 0x80003ce0 r2: 0x800016cc r3: 0x80003da7
E: r4: 0xb r5: 0x1 r6: 0x2e r7: 0x0
E: r8: 0x0 r9: 0x0 r10: 0x0 r11: 0x2a1bd
E: r12: 0xa r13: 0x2758c pc: 0x16fb4
E: blink: 0x76ba status32: 0x80086a02
E: lp_end: 0x1a9ac lp_start: 0x1a9a4 lp_count: 0x0
E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
E: Current thread: 0x800012b4 (test_s)
E: Halting system
Looks like a problem with the 'optimized' newlib strlen implementation that compares words instead of bytes. These instructions trigger the problem:
strlen or %r3,%r0,7
strlen+0x04 ld %r2,[%r3,-7]
ARC hardware stack bounds checking not only ensures the stack stays within bounds but also raises an exception on non-sp based memory references to the unallocated stack (between stack_top and sp).
The word alignment (or 7
) and correction (-7 offset) points to a valid address (4 bytebuf
), but r3
points to the unallocated stack.
Not sure yet who's to blame and where to fix: compiler, newlib (or even hardware to not check the base but base+offset...)?
Describe the bug Tests: tests/posix/env/portability.posix.env.newlib and tests/posix/common/portability.posix.common.newlib end with error. I think these are similar problems.
To Reproduce
twister -p nsim_em -s tests/posix/env/portability.posix.env.newlib
twister -p nsim_em -s tests/posix/common/portability.posix.common.newlib
Logs and console output tests/posix/env/portability.posix.env.newlib:
tests/posix/common/portability.posix.common.newlib:
Expected behavior Tests passed
Environment: