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

samples/mpu/mpu_stack_guard_test: Found "Test not passed" #14870

Closed cinlyooi-intel closed 5 years ago

cinlyooi-intel commented 5 years ago

Description For "test" Test case in sample.yaml, i.e. no prj_stack_guard.conf, we see Test not passed.

To Reproduce Steps to reproduce the behavior:

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

Screenshots or console output

***** delaying boot 1000ms (per build configuration) *****
***** Booting Zephyr OS v1.14.0-rc1-1386-g5d35b6632765 (delayed boot 1000ms) *****
STACK_ALIGN 0x8
MPU STACK GUARD Test
Canary Initial Value = 0xf0cacc1a threads 0x20000ea0
Canary = 0x0000000f Test not passed.
***** BUS FAULT *****
  Instruction bus error
  NXP MPU error, port 3
    Mode: Supervisor, Instruction Address: 0x20000ed0
    Type: Read, Master: 0, Regions: 0x8800
***** Hardware exception *****
Current thread ID = 0x20000ea0
Faulting instruction address = 0x20000ed0
Fatal fault in thread 0x20000ea0! Aborting.
***** HARD FAULT *****
  Fault escalation (see below)
***** USAGE FAULT *****
  Illegal use of the EPSR
***** Hardware exception *****
Current thread ID = 0x20000ea0
Faulting instruction address = 0x0
Fatal fault in ISR! Spinning...

Environment (please complete the following information):

ioannisg commented 5 years ago

I think this is expected. Try to execute with CONFIG_HW_STACK_PROTECTION=y (I think it is set in the alternative prj.conf). You should expect not to see: "Test not passed".

agansari commented 5 years ago

@cinlyooi-intel building with:

cmake -DBOARD=frdm_k64f -DCONF_FILE=prj_stack_guard.conf ..

Will make the test pass as mentioned above. I can't reproduce HARD FAULT part.

cinlyooi-intel commented 5 years ago

@ioannisg : You are right. Examining sample.yaml says we are expecting the console output I am seeing. @agansari : With CONF_FILE=prj_stack_guard.conf (sample.yaml's test_stack_guard testcase ) I don't see the Hard Fault either. Hard Fault only with "sample.yaml's test testcase"

I am closing this test case.

cinlyooi-intel commented 5 years ago

I am reopenning this because I noticed the "Test not passed" mentioned by @ianisg on the same line as "Canary = 0x0000000f". Missed that initially. I also only see that line with the "test" testcase, and not seeing it with the "test_stack_guard" testcase

I consider -DCONF_FILE=prj_stack_guard.conf case, i.e. sample.yaml's test_stack_guard testcase as a Pass because I am not seeing "Test not passed".

Also updated the title and bug description