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

kernel/sched: Panic on aborting essential threads #45813

Merged
merged 2 commits into from
May 20, 2022

Conversation

andyross
Copy link
Contributor

Documentation specifies that aborting/terminating/exiting essential
threads is a system panic condition, but we didn't actually implement
that and allowed it as for other threads. At least one app wants to
exploit this documented behavior as a "watchdog" kind of condition,
and that seems reasonable. Do what we say we're supposed to do.

This also includes a small fix to a test, which seemed like it was
written to exercise exactly this condition. Except that it failed to
detect whether or not a system fatal error was actually signaled and
was (incorrectly) indicating "success". Check that we actually enter
the handler.

Fixes #45545

Signed-off-by: Andy Ross [email protected]

Documentation specifies that aborting/terminating/exiting essential
threads is a system panic condition, but we didn't actually implement
that and allowed it as for other threads. At least one app wants to
exploit this documented behavior as a "watchdog" kind of condition,
and that seems reasonable.  Do what we say we're supposed to do.

This also includes a small fix to a test, which seemed like it was
written to exercise exactly this condition.  Except that it failed to
detect whether or not a system fatal error was actually signaled and
was (incorrectly) indicating "success".  Check that we actually enter
the handler.

Fixes zephyrproject-rtos#45545

Signed-off-by: Andy Ross <[email protected]>
@andyross andyross requested review from dcpleung and nashif as code owners May 19, 2022 19:58
@andyross andyross requested review from teburd and mengxianglinx May 19, 2022 19:58
@github-actions github-actions bot added area: Kernel area: Tests Issues related to a particular existing or missing test labels May 19, 2022
dcpleung
dcpleung previously approved these changes May 19, 2022
teburd
teburd previously approved these changes May 19, 2022
This test was written to do a k_oops() in the main thread.  That's an
essential thread, and aborting it is actually a system panic now.  The
test was written contra the docs on this, but it worked fine for
years.

Just reflag the thread as a simple workaround rather than trying
anything fancy. This is a very simple test.

Signed-off-by: Andy Ross <[email protected]>
@andyross andyross dismissed stale reviews from teburd and dcpleung via 76d9e06 May 19, 2022 22:04
@andyross
Copy link
Contributor Author

Had to sneak in one extra patch because it turns out we had a test case that was doing exactly what is now illegal (though even there it actually failed only on native_posix because of an oddball issue with the regex -- as I read it, it should have been "happy" with the panic instead of the oops even though that wasn't what it was looking for).

@carlescufi carlescufi merged commit c64ac96 into zephyrproject-rtos:main May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel area: Tests Issues related to a particular existing or missing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

K_ESSENTIAL option doesn't have any effect on k_create_thread
4 participants