From 149adf8b97ef8538ad28c3db76ef481dc73f7961 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 10 2020 09:54:18 +0000 Subject: import systemd-219-78.el7_9.2 --- 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 0000000..9b4fc18 --- /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 0000000..8ab0ff1 --- /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 0000000..58a2bdd --- /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 0000000..a6be965 --- /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 0000000..f9af705 --- /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/9999-Update-kernel-install-script-by-backporting-fedora-p.patch b/SOURCES/9999-Update-kernel-install-script-by-backporting-fedora-p.patch deleted file mode 100644 index c42f0b6..0000000 --- a/SOURCES/9999-Update-kernel-install-script-by-backporting-fedora-p.patch +++ /dev/null @@ -1,57 +0,0 @@ -From c49c37d5e26bf71a97d5194d390f80d3e71758e1 Mon Sep 17 00:00:00 2001 -From: systemd team -Date: Tue, 23 Apr 2019 10:46:19 -0300 -Subject: [PATCH] Update kernel-install script by backporting fedora patches - ---- - src/kernel-install/kernel-install | 30 +++++++++++++++++------------- - 1 file changed, 17 insertions(+), 13 deletions(-) - -diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install -index f1c74de..d860701 100755 ---- a/src/kernel-install/kernel-install -+++ b/src/kernel-install/kernel-install -@@ -73,23 +73,27 @@ KERNEL_IMAGE="$2" - - if [[ -x /sbin/new-kernel-pkg ]]; then - KERNEL_DIR="${KERNEL_IMAGE%/*}" -- if [[ "${KERNEL_DIR}" != "/boot" ]]; then -- for i in \ -- "$KERNEL_IMAGE" \ -- "$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" \ -- "$KERNEL_DIR"/System.map \ -- "$KERNEL_DIR"/config \ -- "$KERNEL_DIR"/zImage.stub \ -- "$KERNEL_DIR"/dtb \ -- ; do -- [[ -e "$i" ]] || continue -- cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}" -- done -- fi - - [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}" - case "$COMMAND" in - add) -+ if [[ "${KERNEL_DIR}" != "/boot" ]]; then -+ for i in \ -+ "$KERNEL_IMAGE" \ -+ "$KERNEL_DIR"/System.map \ -+ "$KERNEL_DIR"/config \ -+ "$KERNEL_DIR"/zImage.stub \ -+ "$KERNEL_DIR"/dtb \ -+ ; do -+ [[ -e "$i" ]] || continue -+ cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" -+ done -+ # hmac is .vmlinuz-.hmac so needs a special treatment -+ i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" -+ if [[ -e "$i" ]]; then -+ cp -aT "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" -+ fi -+ fi - /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $? - /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $? - /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $? --- -1.8.3.1 - diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 15120ab..2b9d9c7 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: 78%{?dist} +Release: 78%{?dist}.2 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -878,7 +878,11 @@ 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 -Patch9999: 9999-Update-kernel-install-script-by-backporting-fedora-p.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 %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} @@ -1856,6 +1860,15 @@ fi %{_mandir}/man8/systemd-resolved.* %changelog +* 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)