File sudo-observe-SIGCHLD.patch of Package sudo.27425
From 727056e0c9519d8eecde801e950b35f2f69c72e2 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
Date: Fri, 23 Apr 2021 07:41:27 -0600
Subject: [PATCH] Make sure SIGCHLD is not ignored when sudo is executed. If
SIGCHLD is ignored there is a race condition between when the process is
executed and when the SIGCHLD handler is installed. This fixes the bug
described by GitHub PR #98
Edited by jsikes@suse.com for sudo-1.8.10p3
---
src/signal.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/signal.c b/src/signal.c
index 7f90d707b..866b64790 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -132,13 +132,17 @@ init_signals(void)
for (ss = saved_signals; ss->signo > 0; ss++) {
switch (ss->signo) {
- case SIGCHLD:
case SIGCONT:
case SIGPIPE:
case SIGTTIN:
case SIGTTOU:
/* Don't install these until exec time. */
break;
+ case SIGCHLD:
+ /* Sudo needs to be able to catch SIGCHLD. */
+ if (ss->sa.sa_handler != SIG_IGN)
+ sigaction(SIGCHLD, &sa, NULL);
+ break;
default:
if (ss->sa.sa_handler != SIG_IGN)
sigaction(ss->signo, &sa, NULL);