1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +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

@ -10,6 +10,7 @@
#include <Kernel/IO.h>
#include <Kernel/KSyms.h>
#include <Kernel/Panic.h>
#include <Kernel/Thread.h>
namespace Kernel {
@ -25,6 +26,11 @@ namespace Kernel {
void __panic(const char* file, unsigned int line, const char* function)
{
// Avoid lock ranking checks on crashing paths, just try to get some debugging messages out.
auto thread = Thread::current();
if (thread)
thread->set_crashing();
critical_dmesgln("at {}:{} in {}", file, line, function);
dump_backtrace(PrintToScreen::Yes);
if (kernel_command_line().boot_mode() == BootMode::SelfTest)