daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
48aa7f
From 8b998d862e401c252c4323974698691e67846412 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
48aa7f
index bc115f1..0ba0792 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));