From 6eb234017abd8b682785d0a756a8f905a47db44b Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Tue, 24 Aug 2021 17:20:02 -0700 Subject: [PATCH] first_stage_init: Add SIGCHLD handler in first_stage_console Add a simple SIGCHLD handler to reap zombie processes given to init. Bug: 197662257 Change-Id: I6e7930cfd7c311c454b361b9a541369ece2eb744 Signed-off-by: Elliot Berman --- init/first_stage_console.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/first_stage_console.cpp b/init/first_stage_console.cpp index e2ea0ab40..67cac1914 100644 --- a/init/first_stage_console.cpp +++ b/init/first_stage_console.cpp @@ -85,7 +85,10 @@ namespace init { void StartConsole(const std::string& cmdline) { bool console = KernelConsolePresent(cmdline); + // Use a simple sigchld handler -- first_stage_console doesn't need to track or log zombies + const struct sigaction chld_act { .sa_handler = SIG_DFL, .sa_flags = SA_NOCLDWAIT }; + sigaction(SIGCHLD, &chld_act, nullptr); pid_t pid = fork(); if (pid != 0) { int status;