From b1ad606303924b0e010722c4384c153767184ec3 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 12 Aug 2018 23:24:42 +0200 Subject: [PATCH] Fix system calls panicing when creating threads in the kernel process. This fixes a regression in 62bd9bf9014d770b90b6c887698624059960d9e9. --- kernel/thread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/thread.cpp b/kernel/thread.cpp index 3f3fc4bd..b358b68a 100644 --- a/kernel/thread.cpp +++ b/kernel/thread.cpp @@ -131,8 +131,11 @@ Thread* CreateKernelThread(Process* process, struct thread_registers* regs) // thread. This requirement is because kthread_exit() needs to know when // it's the last thread in the process (using threads_not_exiting_count), // and that no more threads will appear, so it can run some final process - // termination steps without any interference. - assert(!process->firstthread || process == CurrentProcess()); + // termination steps without any interference. It's always allowed to create + // threads in the kernel process as it never exits. + assert(!process->firstthread || + process == CurrentProcess() || + process == Scheduler::GetKernelProcess()); Thread* thread = AllocateThread(); if ( !thread )