zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.45k forks source link

tests/kernel/mem_protect/protection/: Reached unreachable code #15546

Closed cinlyooi-intel closed 5 years ago

cinlyooi-intel commented 5 years ago

Description Executed asserted false because unreachable code blocks were accessed. It happens at various places

To Reproduce Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. cmake -DBOARD=arduino_due
  3. make
  4. make run

Screenshots or console output If applicable, add a screenshot (drag-and-drop an image), or console logs (cut-and-paste text and put a code fence (```) before and after, to help explain the issue.

***** delaying boot 1000ms (per build configuration) *****
***** Booting Zephyr OS zephyr-v1.14.0-70-g8905b0fe2193 (delayed boot 1000ms) *****
Running test suite protection
===================================================================
starting test - exec_data
trying to call code written to 0x20070009
returned from code at 0x20070009
Execute from target buffer succeeded!

    Assertion failed at ./tests/kernel/mem_protect/protection/src/main.c:151: exec_data: (Reached unreachable code)
Execute from data did not fault
FAIL - exec_data
===================================================================
starting test - exec_stack
trying to call code written to 0x200706b9
returned from code at 0x200706b9
Execute from target buffer succeeded!

    Assertion failed at ./tests/kernel/mem_protect/protection/src/main.c:164: exec_stack: (Reached unreachable code)
Execute from stack did not fault
FAIL - exec_stack
===================================================================
starting test - exec_heap
trying to call code written to 0x20070185
returned from code at 0x20070185
Execute from target buffer succeeded!

    Assertion failed at ./tests/kernel/mem_protect/protection/src/main.c:179: exec_heap: (Reached unreachable code)
Execute from heap did not fault
FAIL - exec_heap
===================================================================
starting test - write_ro
trying to write to rodata at 0x00083ca8
rodata modified!

    Assertion failed at ./tests/kernel/mem_protect/protection/src/main.c:109: write_ro: (Reached unreachable code)
Write to rodata did not fault
FAIL - write_ro
===================================================================
starting test - write_text
trying to write to text at 0x0008060c
text not modified
Did not get expected return value!

    Assertion failed at ./tests/kernel/mem_protect/protection/src/main.c:140: write_text: (Reached unreachable code)
Write to text did not fault
FAIL - write_text
===================================================================
Test suite protection failed.
===================================================================
RunID: :o9jw
PROJECT EXECUTION FAILED

Environment (please complete the following information):

ioannisg commented 5 years ago

Fails because I enabled MPU on the Soc level but not at the board definition too (I already have a separate PR for that, a superset of what was merged )

Somehow the filter of the test is wrong: selects cpu-has-arm-mpu but instead it should use the user option to enable mpu