From 94bd475875e344b7cf78ef889601dbb3cf4d591b Mon Sep 17 00:00:00 2001 From: basebuilder_pel7ppc64lebuilder0 Date: Mon, 8 Feb 2021 19:10:50 +0100 Subject: [PATCH] systemd package update Signed-off-by: basebuilder_pel7ppc64lebuilder0 --- ...-we-emit-PropertiesChanged-signal-on.patch | 25 ++++ ...n-t-emit-PropetiesChanged-needlessly.patch | 45 ++++++ ...e-unit-description-if-it-is-already-.patch | 30 ++++ ...PropertiesChanged-signal-if-adding-a.patch | 66 +++++++++ ...sary-fallback-to-the-rescue-mode-cau.patch | 65 ++++++++ ...ial-timer-state-from-serialized-data.patch | 140 ++++++++++++++++++ SPECS/systemd.spec | 45 +++--- 7 files changed, 398 insertions(+), 18 deletions(-) create mode 100644 SOURCES/0840-device-make-sure-we-emit-PropertiesChanged-signal-on.patch create mode 100644 SOURCES/0841-device-don-t-emit-PropetiesChanged-needlessly.patch create mode 100644 SOURCES/0842-core-don-t-update-unit-description-if-it-is-already-.patch create mode 100644 SOURCES/0843-unit-don-t-emit-PropertiesChanged-signal-if-adding-a.patch create mode 100644 SOURCES/0844-core-fix-unnecessary-fallback-to-the-rescue-mode-cau.patch create mode 100644 SOURCES/0845-core-Detect-initial-timer-state-from-serialized-data.patch diff --git a/SOURCES/0840-device-make-sure-we-emit-PropertiesChanged-signal-on.patch b/SOURCES/0840-device-make-sure-we-emit-PropertiesChanged-signal-on.patch new file mode 100644 index 00000000..9b4fc184 --- /dev/null +++ b/SOURCES/0840-device-make-sure-we-emit-PropertiesChanged-signal-on.patch @@ -0,0 +1,25 @@ +From c7324938cb6df93ac5da7d6dd281be8d1986d6f1 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Fri, 24 Jul 2020 17:40:47 +0200 +Subject: [PATCH] device: make sure we emit PropertiesChanged signal once we + set sysfs + +(cherry-picked from commit 7c4d139485139eae95b17a1d54cb51ae958abd70) + +Related: #1793527 +--- + src/core/device.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/core/device.c b/src/core/device.c +index 2afa19f2b4..23c8ee356f 100644 +--- a/src/core/device.c ++++ b/src/core/device.c +@@ -97,6 +97,7 @@ static int device_set_sysfs(Device *d, const char *sysfs) { + } + + d->sysfs = copy; ++ unit_add_to_dbus_queue(UNIT(d)); + + return 0; + } diff --git a/SOURCES/0841-device-don-t-emit-PropetiesChanged-needlessly.patch b/SOURCES/0841-device-don-t-emit-PropetiesChanged-needlessly.patch new file mode 100644 index 00000000..8ab0ff16 --- /dev/null +++ b/SOURCES/0841-device-don-t-emit-PropetiesChanged-needlessly.patch @@ -0,0 +1,45 @@ +From 47f260a680046d3f9244fffa1ea978041811bf6a Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Fri, 24 Jul 2020 17:45:48 +0200 +Subject: [PATCH] device: don't emit PropetiesChanged needlessly +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Functions called from device_setup_unit() already make sure that unit is +enqueued in case it is a new unit or properties exported on the bus have +changed. + +This should prevent unnecessary DBus wakeups and associated DBus traffic +when device_setup_unit() was called while reparsing /proc/self/mountinfo +due to the mountinfo notifications. Note that we parse +/proc/self/mountinfo quite often on the busy systems (e.g. k8s container +hosts) but majority of the time mounts didn't change, only some mount +got added. Thus we don't need to generate PropertiesChanged for devices +associated with the mounts that didn't change. + +Thanks to Renaud Métrich for debugging the +problem and providing draft version of the patch. + +(cherry-picked from commit 2e129d5d6bd6bd8be4b5359e81a880cbf72a44b8) + +Resolves: #1793527 +--- + src/core/device.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/core/device.c b/src/core/device.c +index 23c8ee356f..112b28e21f 100644 +--- a/src/core/device.c ++++ b/src/core/device.c +@@ -362,10 +362,6 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa + if (main) + (void) device_add_udev_wants(u, dev); + +- /* Note that this won't dispatch the load queue, the caller +- * has to do that if needed and appropriate */ +- +- unit_add_to_dbus_queue(u); + return 0; + + fail: diff --git a/SOURCES/0842-core-don-t-update-unit-description-if-it-is-already-.patch b/SOURCES/0842-core-don-t-update-unit-description-if-it-is-already-.patch new file mode 100644 index 00000000..58a2bdd5 --- /dev/null +++ b/SOURCES/0842-core-don-t-update-unit-description-if-it-is-already-.patch @@ -0,0 +1,30 @@ +From 74854679448851e04ee8f6f10cf7908e3273e989 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Thu, 15 Oct 2020 16:48:39 +0200 +Subject: [PATCH] core: don't update unit description if it is already set to + the same value + +This is a followup for 47f260a680046d3f9244fffa1ea978041811bf6a as that +actually relies on such behavior of unit_set_description(). + +RHEL-only + +Related: #1793527 +--- + src/core/unit.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/core/unit.c b/src/core/unit.c +index d953780a52..18b1b898fd 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -273,6 +273,9 @@ int unit_set_description(Unit *u, const char *description) { + if (isempty(description)) + s = NULL; + else { ++ if (streq_ptr(u->description, description)) ++ return 0; ++ + s = strdup(description); + if (!s) + return -ENOMEM; diff --git a/SOURCES/0843-unit-don-t-emit-PropertiesChanged-signal-if-adding-a.patch b/SOURCES/0843-unit-don-t-emit-PropertiesChanged-signal-if-adding-a.patch new file mode 100644 index 00000000..a6be9656 --- /dev/null +++ b/SOURCES/0843-unit-don-t-emit-PropertiesChanged-signal-if-adding-a.patch @@ -0,0 +1,66 @@ +From 71c1119e2fe9bc57e0efb07f784f616a98763028 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Fri, 2 Oct 2020 17:30:35 +0200 +Subject: [PATCH] unit: don't emit PropertiesChanged signal if adding a + dependency to a unit is a no-op + +(cherry-picked from commit 5177cb0a9add4ae568cff6e6f7c2b3c77760c343) + +Related: #1793527 +--- + src/core/unit.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/core/unit.c b/src/core/unit.c +index 18b1b898fd..e07c34bfc5 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -2260,6 +2260,9 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen + }; + int r, q = 0, v = 0, w = 0; + Unit *orig_u = u, *orig_other = other; ++ /* Helper to know whether sending a notification is necessary or not: ++ * if the dependency is already there, no need to notify! */ ++ bool noop = true; + + assert(u); + assert(d >= 0 && d < _UNIT_DEPENDENCY_MAX); +@@ -2298,13 +2301,16 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen + q = set_put(u->dependencies[d], other); + if (q < 0) + return q; ++ else if (q > 0) ++ noop = false; + + if (inverse_table[d] != _UNIT_DEPENDENCY_INVALID && inverse_table[d] != d) { + v = set_put(other->dependencies[inverse_table[d]], u); + if (v < 0) { + r = v; + goto fail; +- } ++ } else if (v > 0) ++ noop = false; + } + + if (add_reference) { +@@ -2312,14 +2318,18 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen + if (w < 0) { + r = w; + goto fail; +- } ++ } else if (w > 0) ++ noop = false; + + r = set_put(other->dependencies[UNIT_REFERENCED_BY], u); + if (r < 0) + goto fail; ++ else if (r > 0) ++ noop = false; + } + +- unit_add_to_dbus_queue(u); ++ if (!noop) ++ unit_add_to_dbus_queue(u); + return 0; + + fail: diff --git a/SOURCES/0844-core-fix-unnecessary-fallback-to-the-rescue-mode-cau.patch b/SOURCES/0844-core-fix-unnecessary-fallback-to-the-rescue-mode-cau.patch new file mode 100644 index 00000000..f9af705d --- /dev/null +++ b/SOURCES/0844-core-fix-unnecessary-fallback-to-the-rescue-mode-cau.patch @@ -0,0 +1,65 @@ +From aa4bc7e743c74afaeac4dd7d84afe734065bd366 Mon Sep 17 00:00:00 2001 +From: Wen Yang +Date: Thu, 18 Jun 2020 22:36:22 +0800 +Subject: [PATCH] core: fix unnecessary fallback to the rescue mode caused by + initrd-switch-root.service's exit status judgment error + +commit 1f0958f640b8 ("core: when determining whether a process exit +status is clean, consider whether it is a command or a daemon") +introduces a side effect that causes system falls into rescure mode +due initrd-switch-root.service entered failed state, detailed +information should refer to the redhat's doc, as follows: +https://access.redhat.com/solutions/4973191 +https://bugzilla.redhat.com/show_bug.cgi?id=1414904 + +As we know that in the cloud computing scenarios, some very critical +services may run on the server, and the server may run continuously for +several years without restarting.The initramfske may still maintain the +original state many years ago without any changes. In addition, this +server may have been installed a lot of user mode programs and kernel +mode drivers due to various operations and maintenance over the years. + +If the initramfs is regenerated because of upgrading systemd, the user-mode +programs or drivers previously installed may be inserted into the initramfs, +introducing unknown risks, and may even cause the system to fail to start. +So we hope that this patch may avoid the above issues. + +Resolves: #1825232 +(cherry picked from commit ec8955ee3842b81d790cf5fa949844bf63a93b7c) +--- + src/core/service.c | 9 +++++++++ + src/shared/special.h | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/src/core/service.c b/src/core/service.c +index 4c73b6ef96..d2d1dcb107 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -2644,6 +2644,15 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { + else + assert_not_reached("Unknown code"); + ++ /* Here's a special hack: avoid a timing issue caused by switching ++ * root when the initramfs contains an old systemd binary. ++ * ++ * https://bugzilla.redhat.com/show_bug.cgi?id=1855149 ++ * https://bugzilla.redhat.com/show_bug.cgi?id=1825232 */ ++ if (f != SERVICE_SUCCESS && status == SIGTERM && ++ unit_has_name(UNIT(s), SPECIAL_INITRD_SWITCH_ROOT_SERVICE)) ++ f = SERVICE_SUCCESS; ++ + if (s->main_pid == pid) { + /* Forking services may occasionally move to a new PID. + * As long as they update the PID file before exiting the old +diff --git a/src/shared/special.h b/src/shared/special.h +index b045047d36..cf393879bf 100644 +--- a/src/shared/special.h ++++ b/src/shared/special.h +@@ -96,6 +96,7 @@ + #define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service" + #define SPECIAL_QUOTAON_SERVICE "quotaon.service" + #define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service" ++#define SPECIAL_INITRD_SWITCH_ROOT_SERVICE "initrd-switch-root.service" + + /* Services systemd relies on */ + #define SPECIAL_DBUS_SERVICE "dbus.service" diff --git a/SOURCES/0845-core-Detect-initial-timer-state-from-serialized-data.patch b/SOURCES/0845-core-Detect-initial-timer-state-from-serialized-data.patch new file mode 100644 index 00000000..2cfce58c --- /dev/null +++ b/SOURCES/0845-core-Detect-initial-timer-state-from-serialized-data.patch @@ -0,0 +1,140 @@ +From b9914f359690e83303ee8a2ffa4d60cdf76f2a90 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Koutn=C3=BD?= +Date: Fri, 2 Nov 2018 20:56:08 +0100 +Subject: [PATCH] core: Detect initial timer state from serialized data + +We keep a mark whether a single-shot timer was triggered in the caller's +variable initial. When such a timer elapses while we are +serializing/deserializing the inner state, we consider the timer +incorrectly as elapsed and don't trigger it later. + +This patch exploits last_trigger timestamp that we already serialize, +hence we can eliminate the argument initial completely. + +A reproducer for OnBootSec= timers: + cat >repro.c < + #include + #include + #include + #include + #include + #include + #include + + int main(int argc, char *argv[]) { + char command[1024]; + int pause; + + struct timespec now; + + while (1) { + usleep(rand() % 200000); // prevent periodic repeats + clock_gettime(CLOCK_MONOTONIC, &now); + printf("%i\n", now.tv_sec); + + system("rm -f $PWD/mark"); + snprintf(command, 1024, "systemd-run --user --on-boot=%i --timer-property=AccuracySec=100ms " + "touch $PWD/mark", now.tv_sec + 1); + system(command); + system("systemctl --user list-timers"); + pause = (1000000000 - now.tv_nsec)/1000 - 70000; // fiddle to hit the middle of reloading + usleep(pause > 0 ? pause : 0); + system("systemctl --user daemon-reload"); + sync(); + sleep(2); + if (open("./mark", 0) < 0) + if (errno == ENOENT) { + printf("mark file does not exist\n"); + break; + } + } + + return 0; + } + EOD + +(cherry picked from commit aa1f95d2647197eca84c33a0f10adaeada08467d) + +Resolves: #1764908 +--- + src/core/timer.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/core/timer.c b/src/core/timer.c +index fb192d5..b36700c 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -267,10 +267,10 @@ static void timer_set_state(Timer *t, TimerState state) { + unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], true); + } + +-static void timer_enter_waiting(Timer *t, bool initial); ++static void timer_enter_waiting(Timer *t); + + static int timer_enter_waiting_coldplug(Unit *u) { +- timer_enter_waiting(TIMER(u), false); ++ timer_enter_waiting(TIMER(u)); + return 0; + } + +@@ -338,7 +338,7 @@ static void add_random(Timer *t, usec_t *v) { + log_unit_debug(UNIT(t)->id, "Adding %s random time.", format_timespan(s, sizeof(s), add, 0)); + } + +-static void timer_enter_waiting(Timer *t, bool initial) { ++static void timer_enter_waiting(Timer *t) { + bool found_monotonic = false, found_realtime = false; + usec_t ts_realtime, ts_monotonic; + usec_t base = 0; +@@ -442,7 +442,7 @@ static void timer_enter_waiting(Timer *t, bool initial) { + + v->next_elapse = base + v->value; + +- if (!initial && v->next_elapse < ts_monotonic && IN_SET(v->base, TIMER_ACTIVE, TIMER_BOOT, TIMER_STARTUP)) { ++ if (dual_timestamp_is_set(&t->last_trigger) && v->next_elapse < ts_monotonic && IN_SET(v->base, TIMER_ACTIVE, TIMER_BOOT, TIMER_STARTUP)) { + /* This is a one time trigger, disable it now */ + v->disabled = true; + continue; +@@ -619,7 +619,7 @@ static int timer_start(Unit *u) { + } + + t->result = TIMER_SUCCESS; +- timer_enter_waiting(t, true); ++ timer_enter_waiting(t); + return 1; + } + +@@ -742,14 +742,14 @@ static void timer_trigger_notify(Unit *u, Unit *other) { + case TIMER_ELAPSED: + + /* Recalculate sleep time */ +- timer_enter_waiting(t, false); ++ timer_enter_waiting(t); + break; + + case TIMER_RUNNING: + + if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) { + log_unit_debug(UNIT(t)->id, "%s got notified about unit deactivation.", UNIT(t)->id); +- timer_enter_waiting(t, false); ++ timer_enter_waiting(t); + } + break; + +@@ -782,7 +782,7 @@ static void timer_time_change(Unit *u) { + return; + + log_unit_debug(u->id, "%s: time change, recalculating next elapse.", u->id); +- timer_enter_waiting(t, false); ++ timer_enter_waiting(t); + } + + static const char* const timer_state_table[_TIMER_STATE_MAX] = { +-- +2.26.2 + diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 9801dffa..9d376fa2 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -8,7 +8,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 219 -Release: 73%{?dist} +Release: 78%{?dist} # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -879,6 +879,12 @@ Patch0836: 0836-core-rework-StopWhenUnneeded-logic.patch Patch0837: 0837-core-coldplug-possible-nop_job.patch Patch0838: 0838-core-make-sure-to-restore-the-control-command-id-too.patch Patch0839: 0839-avoid-double-free.patch +Patch0840: 0840-device-make-sure-we-emit-PropertiesChanged-signal-on.patch +Patch0841: 0841-device-don-t-emit-PropetiesChanged-needlessly.patch +Patch0842: 0842-core-don-t-update-unit-description-if-it-is-already-.patch +Patch0843: 0843-unit-don-t-emit-PropertiesChanged-signal-if-adding-a.patch +Patch0844: 0844-core-fix-unnecessary-fallback-to-the-rescue-mode-cau.patch +Patch0845: 0845-core-Detect-initial-timer-state-from-serialized-data.patch Patch9999: 9999-Update-kernel-install-script-by-backporting-fedora-p.patch %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} @@ -1857,6 +1863,18 @@ fi %{_mandir}/man8/systemd-resolved.* %changelog +* Fri Jan 15 2021 systemd maintenance team - 219-78.3 +- core: Detect initial timer state from serialized data (#1764908) + +* Mon Oct 19 2020 systemd maintenance team - 219-78.2 +- core: don't update unit description if it is already set to the same value (#1793527) +- unit: don't emit PropertiesChanged signal if adding a dependency to a unit is a no-op (#1793527) +- core: fix unnecessary fallback to the rescue mode caused by initrd-switch-root.service's exit status judgment error (#1825232) + +* Wed Aug 12 2020 systemd maintenance team - 219-78.1 +- device: make sure we emit PropertiesChanged signal once we set sysfs (#1793527) +- device: don't emit PropetiesChanged needlessly (#1793527) + * Tue May 12 2020 systemd maintenance team - 219-78 - avoid double free (#1832816) @@ -1896,24 +1914,15 @@ fi - core: add a new unit file setting CollectMode= for tweaking the GC logic (#1817576) - run: add "-G" as shortcut for "--property=CollectMode=inactive-or-failed" (#1817576) - core: clarify that the CollectMode bus property is constant (#1817576) -- core: make sure to restore the control command id, too (#1837973) - udev-rules: make tape-changers also apprear in /dev/tape/by-path/ (#1814028) - -* Mon Apr 06 2020 systemd maintenance team - 219-73.6 -- sd-bus: when attached to an sd-event loop, disconnect on processing errors (#1817504) -- sd-journal: close journal files that were deleted by journald before we've setup inotify watch (#1820073) -- sd-journal: remove the dead code and actually fix #14695 (#1820073) -- swap: adjust swap.c in a similar way to what we just did to mount.c (#1821261) -- swap: finish the secondary swap units' jobs if deactivation of the primary swap unit fails (#1821261) - -* Tue Mar 17 2020 systemd maintenance team - 219-73.5 -- core: enforce a ratelimiter when stopping units due to StopWhenUnneeded=1 (#1810576) -- core: rework StopWhenUnneeded= logic (#1810576) -- fix the fix for #1691511 (#1809159) - -* Thu Mar 12 2020 systemd maintenance team - 219-73.4 -- mount: don't propagate errors from mount_setup_unit() further up (#1809159) -- mount: when allocating a Mount object based on /proc/self/mountinfo mark it so (#1809159) +- logind: check PolicyKit before allowing VT switch (#1797672) +- timer: don't use persietent file timestamps from the future (#6823) (#1769923) +- core: transition to FINAL_SIGTERM state after ExecStopPost= (#1766477) +- bus_open leak sd_event_source when udevadm trigger。 (#1798503) +- journal-remote: split-mode=host, remove port from journal filename (#1244691) +- core: downgrade log message about inability to propagate cgroup release message (#1679934) +- units: move Before deps for quota services to remote-fs.target (#5627) (#1693374) +- set kptr_restrict=1 (#1689344) * Thu Mar 05 2020 systemd maintenance team - 219-73.3 - journal: do not trigger assertion when journal_file_close() get NULL (#1807798)