-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
k_thread_resume can cause k_sem_take with K_FOREVER to return -EAGAIN and crash #29244
Labels
Comments
now that i read through this I think it is still a valid bug. @laurenmurphyx64 sorry, yesterday i was focused on the coverity issue and what k_sem_take returns and did not realize this is a completely unrelated bug. |
(Like Anas said, the same crash will occur regardless of whether the semaphore call is there or not.) This code will show a page fault when logging is turned on.
Output:
|
nashif
added a commit
to nashif/zephyr
that referenced
this issue
Oct 21, 2020
Do not add a thread to the run queue if it was already added. Fixes zephyrproject-rtos#29244 Signed-off-by: Anas Nashif <[email protected]>
nashif
added a commit
that referenced
this issue
Oct 22, 2020
Do not add a thread to the run queue if it was already added. Fixes #29244 Signed-off-by: Anas Nashif <[email protected]>
sjg20
pushed a commit
to sjg20/zephyr
that referenced
this issue
Oct 23, 2020
Do not add a thread to the run queue if it was already added. Fixes zephyrproject-rtos#29244 Signed-off-by: Anas Nashif <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
When one thread is blocked on
k_sem_take
withK_FOREVER
on a semaphore whose count is set to 0 and another thread callsk_thread_resume
on it, the thread will resume and thek_sem_take
call will returnEAGAIN
, an error code that is normallly reserved for the waiting period timing out. Zephyr then seems to crash.To Reproduce
Steps to reproduce the behavior:
cd samples/hello_world
samples/hello_world/src/main.c
with the following:west build -b qemu_x86 -t run .
Expected behavior
Either
k_sem_take
should continue blocking sincek_sem_give
wasn't called, or it should produce a different error code per the documentation. It should also not crash.Impact
Unexpected behavior / crash confusing to users.
Logs and console output
Output:
Environment:
The text was updated successfully, but these errors were encountered: