richardphibel / rpms / systemd

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