From 1b866bbf42a46afff276f503c1f09844ef5d924a Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 6 Feb 2020 16:02:49 +0300 Subject: [PATCH] Kernel: Fix sys$waitid(P_ALL, WNOHANG) return value According to POSIX, waitid() should fill si_signo and si_pid members with zeroes if there are no children that have already changed their state by the time of the call. Let's just fill the whole structure with zeroes to avoid leaking kernel memory. --- Kernel/Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index c1a3092f821..86d5749dd6f 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2314,7 +2314,7 @@ KResultOr Process::do_waitid(idtype_t idtype, int id, int options) // FIXME: Figure out what WNOHANG should do with stopped children. if (idtype == P_ALL) { InterruptDisabler disabler; - siginfo_t siginfo; + siginfo_t siginfo = { 0 }; for_each_child([&siginfo](Process& process) { if (process.is_dead()) siginfo = reap(process);