dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From 461c10112d74ab223226554f2bb73aabaef43c9a Mon Sep 17 00:00:00 2001
923a60
From: Jan Synacek <jsynacek@redhat.com>
923a60
Date: Tue, 15 Aug 2017 13:29:51 +0200
923a60
Subject: [PATCH] udev: ignore SIGCHLD from unexpected processes (#1306539)
923a60
923a60
RHEL-only
923a60
923a60
Author: grzegorz.halat@motorolasolutions.com
923a60
Resolves: #1306539
923a60
---
923a60
 src/udev/udev-event.c | 6 +++++-
923a60
 1 file changed, 5 insertions(+), 1 deletion(-)
923a60
923a60
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
923a60
index bc115f112d..0ba079201c 100644
923a60
--- a/src/udev/udev-event.c
923a60
+++ b/src/udev/udev-event.c
923a60
@@ -610,7 +610,11 @@ static int spawn_wait(struct udev_event *event,
923a60
                                 event->sigterm = true;
923a60
                                 break;
923a60
                         case SIGCHLD:
923a60
-                                if (waitpid(pid, &status, WNOHANG) < 0)
923a60
+                                if (pid != (pid_t) fdsi.ssi_pid) {
923a60
+                                        log_debug("expected SIGCHLD from '%s' ["PID_FMT"] received from unknown process ["PID_FMT"]. Ignoring", cmd, pid, fdsi.ssi_pid);
923a60
+                                        continue;
923a60
+                                }
923a60
+                                if (waitpid(pid, &status, WNOHANG) <= 0)
923a60
                                         break;
923a60
                                 if (WIFEXITED(status)) {
923a60
                                         log_debug("'%s' ["PID_FMT"] exit with return code %i", cmd, pid, WEXITSTATUS(status));