From 9d460a65ec535184eb2c907db6127acd44849a05 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 29 2019 12:53:40 +0000 Subject: import systemd-219-62.el7_6.9 --- diff --git a/SOURCES/0675-sd-bus-deal-with-cookie-overruns.patch b/SOURCES/0675-sd-bus-deal-with-cookie-overruns.patch new file mode 100644 index 0000000..7c1c194 --- /dev/null +++ b/SOURCES/0675-sd-bus-deal-with-cookie-overruns.patch @@ -0,0 +1,109 @@ +From 28f73a10df367721b30a95df5d729f6c56d318e5 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Tue, 2 Apr 2019 10:23:30 +0200 +Subject: [PATCH] sd-bus: deal with cookie overruns + +Apparently this happens IRL. Let's carefully deal with issues like this: +when we overrun, let's not go back to zero but instead leave the highest +cookie bit set. We use that as indication that we are in "overrun +territory", and then are particularly careful with checking cookies, +i.e. that they haven't been used for still outstanding replies yet. This +should retain the quick cookie generation behaviour we used to have, but +permits dealing with overruns. + +Replaces: #11804 +Fixes: #11809 + +(cherry picked from commit 1f82f5bb4237ed5f015daf93f818e9db95e764b8) +(cherry picked from commit ac46d01c5f6a211bbbbb43e20f63ecae2549da20) + +Resolves: #1720699 +--- + src/libsystemd/sd-bus/sd-bus.c | 49 +++++++++++++++++++++++++++++++++- + src/shared/macro.h | 2 ++ + 2 files changed, 50 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c +index b0a3237..44ed2c7 100644 +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -1495,7 +1495,50 @@ _public_ int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id) { + return 0; + } + ++#define COOKIE_CYCLED (UINT32_C(1) << 31) ++ ++static uint64_t cookie_inc(uint64_t cookie) { ++ ++ /* Stay within the 32bit range, since classic D-Bus can't deal with more */ ++ if (cookie >= UINT32_MAX) ++ return COOKIE_CYCLED; /* Don't go back to zero, but use the highest bit for checking ++ * whether we are looping. */ ++ ++ return cookie + 1; ++} ++ ++static int next_cookie(sd_bus *b) { ++ uint64_t new_cookie; ++ ++ assert(b); ++ ++ new_cookie = cookie_inc(b->cookie); ++ ++ /* Small optimization: don't bother with checking for cookie reuse until we overran cookiespace at ++ * least once, but then do it thorougly. */ ++ if (FLAGS_SET(new_cookie, COOKIE_CYCLED)) { ++ uint32_t i; ++ ++ /* Check if the cookie is currently in use. If so, pick the next one */ ++ for (i = 0; i < COOKIE_CYCLED; i++) { ++ if (!ordered_hashmap_contains(b->reply_callbacks, &new_cookie)) ++ goto good; ++ ++ new_cookie = cookie_inc(new_cookie); ++ } ++ ++ /* Can't fulfill request */ ++ return -EBUSY; ++ } ++ ++good: ++ b->cookie = new_cookie; ++ return 0; ++} ++ + static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) { ++ int r; ++ + assert(b); + assert(m); + +@@ -1510,7 +1553,11 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) { + if (timeout == 0) + timeout = BUS_DEFAULT_TIMEOUT; + +- return bus_message_seal(m, ++b->cookie, timeout); ++ r = next_cookie(b); ++ if (r < 0) ++ return r; ++ ++ return bus_message_seal(m, b->cookie, timeout); + } + + static int bus_remarshal_message(sd_bus *b, sd_bus_message **m) { +diff --git a/src/shared/macro.h b/src/shared/macro.h +index 7a57f4e..08567d2 100644 +--- a/src/shared/macro.h ++++ b/src/shared/macro.h +@@ -394,6 +394,8 @@ do { \ + + #define SET_FLAG(v, flag, b) \ + (v) = (b) ? ((v) | (flag)) : ((v) & ~(flag)) ++#define FLAGS_SET(v, flags) \ ++ ((~(v) & (flags)) == 0) + + #define IN_SET(x, y, ...) \ + ({ \ +-- +2.21.0 + diff --git a/SOURCES/0676-core-Fix-edge-case-when-processing-proc-self-mountin.patch b/SOURCES/0676-core-Fix-edge-case-when-processing-proc-self-mountin.patch new file mode 100644 index 0000000..f2de7c6 --- /dev/null +++ b/SOURCES/0676-core-Fix-edge-case-when-processing-proc-self-mountin.patch @@ -0,0 +1,38 @@ +From 403580d6e23991f414526a5fd90fb253210c07ba Mon Sep 17 00:00:00 2001 +From: Kyle Walker +Date: Thu, 21 Mar 2019 15:09:06 -0400 +Subject: [PATCH] core: Fix edge case when processing /proc/self/mountinfo + +Currently, if there are two /proc/self/mountinfo entries with the same +mount point path, the mount setup flags computed for the second of +these two entries will overwrite the mount setup flags computed for +the first of these two entries. This is the root cause of issue #7798. +This patch changes mount_setup_existing_unit to prevent the +just_mounted mount setup flag from being overwritten if it is set to +true. This will allow all mount units created from /proc/self/mountinfo +entries to be initialized properly. + +(cherry picked from commit 65d36b49508a53e56bae9609ff00fdc3de340608) +(cherry picked from commit 1c9add7cc78fc65b043f9e87ab63bb2158d2ddf0) + +Resolves: #1722576 +--- + src/core/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 5fd7a86..c7aed23 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1527,7 +1527,7 @@ static int mount_setup_unit( + + if (set_flags) { + MOUNT(u)->is_mounted = true; +- MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo; ++ MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo || MOUNT(u)->just_mounted; + MOUNT(u)->just_changed = changed; + } + +-- +2.21.0 + diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 844dc49..c4ac257 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -7,7 +7,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 219 -Release: 62%{?dist}.7 +Release: 62%{?dist}.9 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -713,6 +713,8 @@ Patch0671: 0671-Allocate-temporary-strings-to-hold-dbus-paths-on-the.patch Patch0672: 0672-sd-bus-if-we-receive-an-invalid-dbus-message-ignore-.patch Patch0673: 0673-Revert-bus-when-dumping-string-property-values-escap.patch Patch0674: 0674-rules-fix-memory-hotplug-rule-so-systemd-detect-virt.patch +Patch0675: 0675-sd-bus-deal-with-cookie-overruns.patch +Patch0676: 0676-core-Fix-edge-case-when-processing-proc-self-mountin.patch %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} @@ -1689,6 +1691,12 @@ fi %{_mandir}/man8/systemd-resolved.* %changelog +* Mon Jun 24 2019 Michal Sekletár - 219-62.9 +- core: Fix edge case when processing /proc/self/mountinfo (#1722576) + +* Wed Jun 19 2019 Michal Sekletár - 219-62.8 +- sd-bus: deal with cookie overruns (#1720699) + * Wed Apr 24 2019 Lukas Nykryn - 219-62.7 - rules: fix memory hotplug rule so systemd-detect-virt does not run too often (#1701230)