1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

Kernel: Track when a thread is in the middle of crashing

There are certain checks that we should skip if the system is crashing.
The system can avoid stack overflow during crash, or even triple
faulting while while handling issues that can causes recursive panics
or aborts.
This commit is contained in:
Brian Gianforcaro 2021-09-07 00:17:45 -07:00 committed by Andreas Kling
parent f56bdd2bb7
commit 0718afa773
3 changed files with 15 additions and 0 deletions

View file

@ -20,6 +20,11 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const
[[noreturn]] void abort()
{
// Avoid lock ranking checks on crashing paths, just try to get some debugging messages out.
auto thread = Thread::current();
if (thread)
thread->set_crashing();
// Switch back to the current process's page tables if there are any.
// Otherwise stack walking will be a disaster.
if (Process::has_current())