Blob Blame History Raw
From 8b998d862e401c252c4323974698691e67846412 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 15 Aug 2017 13:29:51 +0200
Subject: [PATCH] udev: ignore SIGCHLD from unexpected processes (#1306539)

RHEL-only

Author: grzegorz.halat@motorolasolutions.com
Resolves: #1306539
---
 src/udev/udev-event.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index bc115f1..0ba0792 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -610,7 +610,11 @@ static int spawn_wait(struct udev_event *event,
                                 event->sigterm = true;
                                 break;
                         case SIGCHLD:
-                                if (waitpid(pid, &status, WNOHANG) < 0)
+                                if (pid != (pid_t) fdsi.ssi_pid) {
+                                        log_debug("expected SIGCHLD from '%s' ["PID_FMT"] received from unknown process ["PID_FMT"]. Ignoring", cmd, pid, fdsi.ssi_pid);
+                                        continue;
+                                }
+                                if (waitpid(pid, &status, WNOHANG) <= 0)
                                         break;
                                 if (WIFEXITED(status)) {
                                         log_debug("'%s' ["PID_FMT"] exit with return code %i", cmd, pid, WEXITSTATUS(status));