From 974b9b992d976ffba0c7158364daab5d3ca23ea8 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 18 Jul 2024 21:40:44 +0300 Subject: [PATCH] Kernel: Fix process exiting infinite loop If process was exiting and had a process waiting for it and that waiting process got interrupted, the exiting process could never exit. --- kernel/kernel/Process.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index 447a327d98..922776a063 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -566,7 +566,13 @@ namespace Kernel return BAN::Error::from_errno(ECHILD); while (!target->m_exit_status.exited) - TRY(Thread::current().block_or_eintr_indefinite(target->m_exit_status.semaphore)); + { + if (auto ret = Thread::current().block_or_eintr_indefinite(target->m_exit_status.thread_blocker); ret.is_error()) + { + target->m_exit_status.waiting--; + return ret.release_error(); + } + } int exit_status = target->m_exit_status.exit_code; target->m_exit_status.waiting--;