nop_job of a unit must also be coldpluged after deserization

This commit is contained in:
yangmingtaip 2022-02-15 20:40:25 +08:00
parent b4c5569ed4
commit 095a679a9e
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 07e13151c566588b5f679e2576d3dfc2125c6e7c Mon Sep 17 00:00:00 2001
From: huangkaibin <huangkaibin@huawei.com>
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

View File

@ -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 <yangmingtai@huawei.com> - 249-6
- nop_job of a unit must also be coldpluged after deserization
* Tue Feb 15 2021 yangmingtai <yangmingtai@huawei.com> - 249-5
- fix CVE-2021-3997 and CVE-2021-33910