Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/posix/fs/ segfaults randomly in POSIX arch #13011

Closed
aescolar opened this issue Feb 3, 2019 · 3 comments
Closed

tests/posix/fs/ segfaults randomly in POSIX arch #13011

aescolar opened this issue Feb 3, 2019 · 3 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@aescolar
Copy link
Member

aescolar commented Feb 3, 2019

Describe the bug
At random the test case will segfault just after passing in the POSIX architecture
(could only reproduce (easily) when compiling with COVERAGE enabled)

The issue is caused by the Zephyr POSIX sleep.c not being compiled with the posix_cheats.h defines.
When the POSIX arch attempted to call the host sleep(), instead the Zephyr POSIX API replacement sleep() was called, which messed up the threads state.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. cmake ../tests/posix/fs/ -DBOARD=native_posix -GNinja -DCONFIG_COVERAGE=y
  3. ninja
  4. (valgrind) zephyr/zephyr.exe
  5. Admire a segfault in the posix arch most private code (should really not happen)

Expected behavior
No segfault

Impact
Intermitent segfault after the case pases => confused users (the likelyhood is not too high, so the 3 retries in CI were hiding it)

Environment (please complete the following information):

  • OS: Linux
  • Toolchain Zephyr
  • Commit SHA: Todays master (6904501) (probably started some time after 8dc69e0 )

Additional context
Bugfix incoming

@aescolar aescolar added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug labels Feb 3, 2019
@aescolar aescolar self-assigned this Feb 3, 2019
aescolar added a commit to aescolar/zephyr that referenced this issue Feb 3, 2019
In 8dc69e0 (zephyrproject-rtos#10280)
the POSIX API main kconfig option was replaced from
PTHREAD_IPC to POSIX_API.
But the posix_cheats.h header was left using the old option.
This means that some applications/tests which were not
selecting the PTHREAD_IPC API, but using some other Zephyr
POSIX compatible APIs could have trouble when compiled for the
POSIX architecture.

Fixes zephyrproject-rtos#13011

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
nashif pushed a commit that referenced this issue Feb 3, 2019
In 8dc69e0 (#10280)
the POSIX API main kconfig option was replaced from
PTHREAD_IPC to POSIX_API.
But the posix_cheats.h header was left using the old option.
This means that some applications/tests which were not
selecting the PTHREAD_IPC API, but using some other Zephyr
POSIX compatible APIs could have trouble when compiled for the
POSIX architecture.

Fixes #13011

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
@pfalcon
Copy link
Contributor

pfalcon commented Feb 5, 2019

@aescolar: I'd appreciate if I can be copied on all things POSIX subsys in Zephyr.

@aescolar
Copy link
Member Author

aescolar commented Feb 5, 2019

@pfalcon Certainly :)

@pfalcon
Copy link
Contributor

pfalcon commented Feb 5, 2019

@aescolar : Let's continue in #13054

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants