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

Kernel: Panic if the init process dies

If init crashes, all other userspace processes exit too, thus rendering
the system unusable. Previously, the kernel would still keep running
even without a userland, showing just a black screen without any
indication of the issue.

We now panic the kernel, which shows a message on the console. In the
case of the CI runners, it shuts down the virtual machine, so we don't
have to wait for the 1 hour timeout if an issue arises with
SystemServer.
This commit is contained in:
Daniel Bertalan 2022-03-05 21:01:06 +01:00 committed by Linus Groh
parent a25cc9619d
commit 70ccdb300b
2 changed files with 10 additions and 0 deletions

View file

@ -97,6 +97,8 @@ extern "C" [[noreturn]] void init(BootInfo const&);
READONLY_AFTER_INIT VirtualConsole* tty0;
ProcessID g_init_pid { 0 };
static Processor s_bsp_processor; // global but let's keep it "private"
// SerenityOS Kernel C++ entry point :^)
@ -374,6 +376,8 @@ void init_stage2(void*)
if (init_or_error.is_error())
PANIC("init_stage2: Error spawning init process: {}", init_or_error.error());
g_init_pid = init_or_error.value()->pid();
thread->set_priority(THREAD_PRIORITY_HIGH);
if (boot_profiling) {