daandemeyer / rpms / systemd

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