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

logging: never leaves panic mode on fatal thread exception #11745

Closed
andrewboie opened this issue Nov 29, 2018 · 7 comments
Closed

logging: never leaves panic mode on fatal thread exception #11745

andrewboie opened this issue Nov 29, 2018 · 7 comments
Assignees
Labels
area: Logging bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@andrewboie
Copy link
Contributor

Describe the bug
If a thread crashes, the kernel can decide to hang the system, or just kill the offending thread. The log subsystem enters panic mode to flush the logs and emit the exception data synchronously, but if the thread is simply killed the log subsystem never leaves panic mode.

Expected behavior
If the thread is simply killed, an API call is made to leave panic mode immediately before _SysFatalErrorHandler calls k_thread_abort().

Impact
If user mode is not used, low, since a fatal thread exception makes no guarantees on data corruption, the thread could have been executing kernel code leaving shared data structures in a bad state anyway, or blew its stack and messed up adjacent data structures. A supervisor mode thread crashing is always very bad news.

If the crashed thread was a user thread, then we can at least assert the core kernel is in a good state and this becomes more of an issue since the logging subsystem overhead increases greatly.

@andrewboie andrewboie added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug area: Logging labels Nov 29, 2018
@nordic-krch
Copy link
Contributor

@andrewboie can you help me with that? Is there a place in code code where we can be sure that system will not recover?

@galak
Copy link
Collaborator

galak commented Mar 27, 2019

@andrewboie, @nordic-krch any updates on this?

@nordic-krch
Copy link
Contributor

no update. maybe @andrewboie could help me with answering question above.

@andrewboie
Copy link
Contributor Author

@andrewboie can you help me with that? Is there a place in code code where we can be sure that system will not recover?

Just look at SysFatalErrorHandler, it makes a decision on whether the thread should simply be killed or the whole system taken down.

@nashif
Copy link
Member

nashif commented Mar 11, 2020

@nordic-krch ping

@nordic-krch
Copy link
Contributor

error handling has been reworked by @andrewboie and LOG_PANIC is now called in k_sys_fatal_error_handler. It seems to me that this function is called only on unrecoverable error?@andrewboie can you confirm? If yes then issue can be closed.

@andrewboie
Copy link
Contributor Author

error handling has been reworked by @andrewboie and LOG_PANIC is now called in k_sys_fatal_error_handler. It seems to me that this function is called only on unrecoverable error?@andrewboie can you confirm? If yes then issue can be closed.

With the invocation of LOG_PANIC() moved to k_sys_fatal_error_handler(), I agree.

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

No branches or pull requests

4 participants