From 095a679a9e9096e71e58db058f97a25e4fe86e58 Mon Sep 17 00:00:00 2001 From: yangmingtaip Date: Tue, 15 Feb 2022 20:40:25 +0800 Subject: [PATCH] nop_job of a unit must also be coldpluged after deserization --- ...lso-be-coldpluged-after-deserization.patch | 53 +++++++++++++++++++ systemd.spec | 6 ++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 0018-nop_job-of-a-unit-must-also-be-coldpluged-after-deserization.patch diff --git a/0018-nop_job-of-a-unit-must-also-be-coldpluged-after-deserization.patch b/0018-nop_job-of-a-unit-must-also-be-coldpluged-after-deserization.patch new file mode 100644 index 0000000..afca3e7 --- /dev/null +++ b/0018-nop_job-of-a-unit-must-also-be-coldpluged-after-deserization.patch @@ -0,0 +1,53 @@ +From 07e13151c566588b5f679e2576d3dfc2125c6e7c Mon Sep 17 00:00:00 2001 +From: huangkaibin +Date: Sun, 22 Apr 2018 18:49:19 +0800 +Subject: [PATCH] systemd-core: nop_job of a unit must also be coldpluged +after deserization. + +When a unit is not in-active, and systemctl try-restart is executed for +this unit, +systemd will do nothing for it and just accept it as a nop_job for the +unit. +When then nop-job is still in the running queue, then daemon-reload is +performed, this nop job +will be dropped from the unit since it is not coldpluged in the +unit_coldplug function. +After then, the systemctl try-restart command will hang forever since no +JOB_DONE dbus signal will be sent +to it from systemd. +This patch fix this problem by do coldplug for the nop_job in +unit_coldplug function. +--- + src/core/unit.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/core/unit.c b/src/core/unit.c +index 0a2f3c8..b9bd102 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -3601,11 +3601,17 @@ int unit_coldplug(Unit *u) { + r = q; + } + +- uj = u->job ?: u->nop_job; +- if (uj) { +- q = job_coldplug(uj); +- if (q < 0 && r >= 0) +- r = q; ++ if (u->job || u->nop_job) { ++ if (u->job) { ++ q = job_coldplug(u->job); ++ if (q < 0 && r >= 0) ++ r = q; ++ } ++ if (u->nop_job) { ++ q = job_coldplug(u->nop_job); ++ if (q < 0 && r >= 0) ++ r = q; ++ } + } + + return r; +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index eb3617d..7135b9a 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 5 +Release: 6 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -63,6 +63,7 @@ Patch0014: 0014-journal-don-t-enable-systemd-journald-audit.socket-b.patch Patch0015: 0015-systemd-change-time-log-level.patch Patch0016: 0016-fix-capsh-drop-but-ping-success.patch Patch0017: 0017-resolved-create-etc-resolv.conf-symlink-at-runtime.patch +patch0018: 0018-nop_job-of-a-unit-must-also-be-coldpluged-after-deserization.patch #backport Patch6000: backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch @@ -1710,6 +1711,9 @@ fi %{_unitdir}/systemd-userdbd.socket %changelog +* Tue Feb 15 2021 yangmingtai - 249-6 +- nop_job of a unit must also be coldpluged after deserization + * Tue Feb 15 2021 yangmingtai - 249-5 - fix CVE-2021-3997 and CVE-2021-33910