Commit 084e2c59 authored by Michael Biebl's avatar Michael Biebl

Don't return any error in manager_dispatch_notify_fd()

If manager_dispatch_notify_fd() fails and returns an error then the
handling of service notifications will be disabled entirely leading to a
compromised system.

For example pid1 won't be able to receive the WATCHDOG messages anymore
and will kill all services supposed to send such messages.

Fixes: CVE-2016-7796
Closes: #839607
parent c2c3200f
From: Franck Bui <fbui@suse.com>
Date: Thu, 29 Sep 2016 19:44:34 +0200
Subject: pid1: don't return any error in manager_dispatch_notify_fd() (#4240)
If manager_dispatch_notify_fd() fails and returns an error then the handling of
service notifications will be disabled entirely leading to a compromised system.
For example pid1 won't be able to receive the WATCHDOG messages anymore and
will kill all services supposed to send such messages.
Fixes: CVE-2016-7796
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839607
(cherry picked from commit 9987750e7a4c62e0eb8473603150596ba7c3a015)
---
src/core/manager.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index e6a0736..a8c40d4 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1493,14 +1493,14 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
Unit *u;
n = recvmsg(m->notify_fd, &msghdr, MSG_DONTWAIT);
- if (n <= 0) {
- if (n == 0)
- return -EIO;
-
- if (errno == EAGAIN || errno == EINTR)
- break;
-
- return -errno;
+ if (n < 0) {
+ if (!IN_SET(errno, EAGAIN, EINTR))
+ log_error("Failed to receive notification message: %m");
+ break;
+ }
+ if (n == 0) {
+ log_debug("Got zero-length notification message. Ignoring.");
+ break;
}
if (msghdr.msg_controllen < CMSG_LEN(sizeof(struct ucred)) ||
......@@ -165,6 +165,7 @@ man-update-links-to-kernel.org-cgroup-documentation.patch
console-getty.service-don-t-start-when-dev-console-is-mis.patch
units-explicitly-order-systemd-user-sessions.service-afte.patch
units-order-systemd-user-sessions.service-after-network.t.patch
pid1-don-t-return-any-error-in-manager_dispatch_noti.patch
## Debian specific patches:
Add-back-support-for-Debian-specific-config-files.patch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment