c385bc66e2
- Added: 0001-pid1-more-informative-error-message-for-ignored-noti.patch 0001-pid1-process-zero-length-notification-messages-again.patch - Updated (no code changes, only patch metadata) 0001-If-the-notification-message-length-is-0-ignore-the-m.patch 0001-pid1-don-t-return-any-error-in-manager_dispatch_noti.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=958
83 lines
3.1 KiB
Diff
83 lines
3.1 KiB
Diff
From 98c4bab7add94bdfb6cc238376c47a9c73a4fe39 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Thu, 29 Sep 2016 16:06:02 +0200
|
|
Subject: [PATCH 1/1] pid1: process zero-length notification messages again
|
|
|
|
This undoes 531ac2b234. I acked that patch without looking at the code
|
|
carefully enough. There are two problems:
|
|
- we want to process the fds anyway
|
|
- in principle empty notification messages are valid, and we should
|
|
process them as usual, including logging using log_unit_debug().
|
|
|
|
(cherry picked from commit 8523bf7dd514a3a2c6114b7b8fb8f308b4f09fc4)
|
|
|
|
[fbui: adjust context]
|
|
---
|
|
src/core/manager.c | 15 ++++++---------
|
|
1 file changed, 6 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/core/manager.c b/src/core/manager.c
|
|
index 06d78e4..58d346e 100644
|
|
--- a/src/core/manager.c
|
|
+++ b/src/core/manager.c
|
|
@@ -1501,13 +1501,12 @@ static unsigned manager_dispatch_dbus_queue(Manager *m) {
|
|
return n;
|
|
}
|
|
|
|
-static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const char *buf, size_t n, FDSet *fds) {
|
|
+static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const char *buf, FDSet *fds) {
|
|
_cleanup_strv_free_ char **tags = NULL;
|
|
|
|
assert(m);
|
|
assert(u);
|
|
assert(buf);
|
|
- assert(n > 0);
|
|
|
|
tags = strv_split(buf, "\n\r");
|
|
if (!tags) {
|
|
@@ -1569,10 +1568,6 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
|
|
* example... */
|
|
return 0;
|
|
}
|
|
- if (n == 0) {
|
|
- log_debug("Got zero-length notification message. Ignoring.");
|
|
- return 0;
|
|
- }
|
|
|
|
CMSG_FOREACH(cmsg, &msghdr) {
|
|
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
|
|
@@ -1609,25 +1604,27 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
|
|
return 0;
|
|
}
|
|
|
|
+ /* The message should be a string. Here we make sure it's NUL-terminated,
|
|
+ * but only the part until first NUL will be used anyway. */
|
|
buf[n] = 0;
|
|
|
|
/* Notify every unit that might be interested, but try
|
|
* to avoid notifying the same one multiple times. */
|
|
u1 = manager_get_unit_by_pid_cgroup(m, ucred->pid);
|
|
if (u1) {
|
|
- manager_invoke_notify_message(m, u1, ucred->pid, buf, n, fds);
|
|
+ manager_invoke_notify_message(m, u1, ucred->pid, buf, fds);
|
|
found = true;
|
|
}
|
|
|
|
u2 = hashmap_get(m->watch_pids1, PID_TO_PTR(ucred->pid));
|
|
if (u2 && u2 != u1) {
|
|
- manager_invoke_notify_message(m, u2, ucred->pid, buf, n, fds);
|
|
+ manager_invoke_notify_message(m, u2, ucred->pid, buf, fds);
|
|
found = true;
|
|
}
|
|
|
|
u3 = hashmap_get(m->watch_pids2, PID_TO_PTR(ucred->pid));
|
|
if (u3 && u3 != u2 && u3 != u1) {
|
|
- manager_invoke_notify_message(m, u3, ucred->pid, buf, n, fds);
|
|
+ manager_invoke_notify_message(m, u3, ucred->pid, buf, fds);
|
|
found = true;
|
|
}
|
|
|
|
--
|
|
2.10.0
|
|
|