From 21d24db6a1e0fff02ed6495738e1a68d2b51944b Mon Sep 17 00:00:00 2001 From: yangmingtaip Date: Tue, 8 Feb 2022 20:47:21 +0800 Subject: [PATCH 1/2] do not make systemd-cpredump sub packages --- systemd.spec | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/systemd.spec b/systemd.spec index 6e1fa65..12ee0ec 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 2 +Release: 3 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -286,18 +286,6 @@ Requires: %{name} = %{version}-%{release} %description pam Systemd PAM module registers the session with systemd-logind. -%package coredump -Summary: Systemd tools for coredump management -License: LGPLv2+ -Requires: %{name} = %{version}-%{release} -%systemd_requires -Provides: systemd:%{_bindir}/coredumpctl - -%description coredump -Systemd tools to store and manage coredumps. - -This package contains systemd-coredump, coredumpctl. - %package portable Summary: Systemd tools for portable services License: LGPLv2+ @@ -650,7 +638,6 @@ getent group kvm &>/dev/null || groupadd -r -g 36 kvm &>/dev/null || : getent group render &>/dev/null || groupadd -r render &>/dev/null || : getent group systemd-journal &>/dev/null || groupadd -r -g 190 systemd-journal 2>&1 || : -%pre coredump getent group systemd-coredump &>/dev/null || groupadd -r systemd-coredump 2>&1 || : getent passwd systemd-coredump &>/dev/null || useradd -r -l -g systemd-coredump -d / -s /sbin/nologin -c "systemd Core Dumper" systemd-coredump &>/dev/null || : @@ -885,6 +872,7 @@ fi %ghost %attr(0700,root,root) %dir /var/lib/private %dir /var/lib/systemd %dir /var/lib/systemd/catalog +%ghost %dir /var/lib/systemd/coredump %ghost %dir /var/lib/systemd/linger %ghost /var/lib/systemd/catalog/database %ghost %dir /var/lib/private/systemd @@ -989,6 +977,7 @@ fi /usr/bin/systemd-sysusers /usr/bin/systemd-tty-ask-password-agent /usr/bin/busctl +/usr/bin/coredumpctl %dir /usr/lib/environment.d %dir /usr/lib/binfmt.d %dir /usr/lib/tmpfiles.d @@ -1036,6 +1025,7 @@ fi %dir %{_systemddir}/user-generators %{_systemddir}/systemd %dir %{_systemddir}/user-preset +%{_systemddir}/systemd-coredump %{_systemddir}/systemd-veritysetup %{_systemddir}/systemd-network-generator %{_systemddir}/systemd-binfmt @@ -1044,6 +1034,8 @@ fi %{_unitdir}/systemd-binfmt.service %{_unitdir}/systemd-machine-id-commit.service %dir %{_unitdir}/basic.target.wants +%{_unitdir}/systemd-coredump.socket +%{_unitdir}/systemd-coredump@.service %{_unitdir}/ctrl-alt-del.target %{_unitdir}/systemd-tmpfiles-setup.service %{_unitdir}/rpcbind.target @@ -1276,6 +1268,7 @@ fi %{_systemddir}/user/xdg-desktop-autostart.target /usr/lib/sysctl.d/50-default.conf /usr/lib/sysctl.d/50-pid-max.conf +/usr/lib/sysctl.d/50-coredump.conf /usr/lib/tmpfiles.d/systemd-tmp.conf /usr/lib/tmpfiles.d/systemd-nologin.conf /usr/lib/tmpfiles.d/systemd.conf @@ -1305,6 +1298,7 @@ fi %dir /etc/systemd/user %config(noreplace) /etc/systemd/logind.conf %config(noreplace) /etc/systemd/journald.conf +%config(noreplace) /etc/systemd/coredump.conf %dir /etc/systemd/system %config(noreplace) /etc/systemd/system.conf %ghost %config(noreplace) /etc/X11/xorg.conf.d/00-keyboard.conf @@ -1455,6 +1449,7 @@ fi %{_unitdir}/systemd-udev-trigger.service.d/systemd-udev-trigger-no-reload.conf %{_unitdir}/sockets.target.wants/systemd-udevd-control.socket %{_unitdir}/sockets.target.wants/systemd-udevd-kernel.socket +%{_unitdir}/sockets.target.wants/systemd-coredump.socket %{_systemddir}/system-generators/systemd-cryptsetup-generator %{_systemddir}/system-generators/systemd-hibernate-resume-generator %{_systemddir}/system-generators/systemd-gpt-auto-generator @@ -1677,16 +1672,6 @@ fi %files pam %{_libdir}/security/pam_systemd.so -%files coredump -%defattr(-,root,root) -%{_bindir}/coredumpctl -%{_prefix}/lib/systemd/systemd-coredump -%{_unitdir}/systemd-coredump* -%{_unitdir}/sockets.target.wants/systemd-coredump.socket -%{_sysctldir}/50-coredump.conf -%config(noreplace) %{_sysconfdir}/systemd/coredump.conf -%dir %{_localstatedir}/lib/systemd/coredump - %files portable %defattr(-,root,root) %{_bindir}/portablectl @@ -1712,8 +1697,11 @@ fi %{_unitdir}/systemd-userdbd.socket %changelog -+* Tue Dec 27 2021 yangmingtai - 249-2 -+- delete useless Provides and Obsoletes +* Tue Feb 8 2021 yangmingtai - 249-3 +- do not make systemd-cpredump sub packages + +* Tue Dec 27 2021 yangmingtai - 249-2 +- delete useless Provides and Obsoletes * Wed Dec 8 2021 yangmingtai - 249-1 - systemd update to v249 @@ -1736,10 +1724,10 @@ fi * Mon Aug 16 2021 yangmingtai - 248-8 - udev: exec daemon-reload after installation -* Thu Jun 03 2021 yangmingtai - 248-7 +* Fri Jul 22 2021 yangmingtai - 248-7 - fix CVE-2021-33910 -* Thu Jul 22 2021 shenyangyang - 248-6 +* Thu Jun 03 2021 shenyangyang - 248-6 - change requires to openssl-libs as post scripts systemctl requires libssl.so.1.1 * Mon May 31 2021 hexiaowen - 248-5 -- Gitee From 9140727f29bcbd425b014a406d157f751dda430d Mon Sep 17 00:00:00 2001 From: yangmingtaip Date: Tue, 8 Feb 2022 20:56:28 +0800 Subject: [PATCH 2/2] backport patchs to fix issues --- ...defined-pointer-when-strdup-failed-i.patch | 8 ++--- ...ectoryNotEmpty-when-it-comes-to-a-No.patch | 26 +++++++++++++++ ...hIsReadWrite-when-path-does-not-exis.patch | 33 +++++++++++++++++++ ...Empty-when-it-comes-to-a-Non-directo.patch | 25 ++++++++++++++ systemd.spec | 15 +++++++-- 5 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch create mode 100644 backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch create mode 100644 backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch diff --git a/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch b/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch index 17e0d0b..8c68ab4 100644 --- a/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch +++ b/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch @@ -16,8 +16,8 @@ index 92815b1dbaea..1c8159a23550 100644 if (!separate_argv0) { char *w = NULL; -- if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) -+ if (!GREEDY_REALLOC0(n, nbufsize, nlen + 2)) +- if (!GREEDY_REALLOC(n, nlen + 2)) ++ if (!GREEDY_REALLOC0(n, nlen + 2)) return log_oom(); w = strdup(path); @@ -25,8 +25,8 @@ index 92815b1dbaea..1c8159a23550 100644 p += 2; p += strspn(p, WHITESPACE); -- if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) -+ if (!GREEDY_REALLOC0(n, nbufsize, nlen + 2)) +- if (!GREEDY_REALLOC(n, nlen + 2)) ++ if (!GREEDY_REALLOC0(n, nlen + 2)) return log_oom(); w = strdup(";"); diff --git a/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch b/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch new file mode 100644 index 0000000..6e026b3 --- /dev/null +++ b/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch @@ -0,0 +1,26 @@ +From 193105f2d0408e2d96265935174b3cf0f100ef2e Mon Sep 17 00:00:00 2001 +From: jiangchuangang +Date: Mon, 29 Nov 2021 22:30:37 +0800 +Subject: [PATCH] fix ConditionDirectoryNotEmpty when it comes to a + Non-directory file + +--- + src/shared/condition.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shared/condition.c b/src/shared/condition.c +index 6e769e9d59..a86f2b9ffb 100644 +--- a/src/shared/condition.c ++++ b/src/shared/condition.c +@@ -931,7 +931,7 @@ static int condition_test_directory_not_empty(Condition *c, char **env) { + assert(c->type == CONDITION_DIRECTORY_NOT_EMPTY); + + r = dir_is_empty(c->parameter); +- return r <= 0 && r != -ENOENT; ++ return r <= 0 && !IN_SET(r, -ENOENT, -ENOTDIR); + } + + static int condition_test_file_not_empty(Condition *c, char **env) { +-- +2.27.0 + diff --git a/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch b/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch new file mode 100644 index 0000000..6c8b7f2 --- /dev/null +++ b/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch @@ -0,0 +1,33 @@ +From 7c4c9948d02ceda903ed4e4deea0d0084612625a Mon Sep 17 00:00:00 2001 +From: jiangchuangang +Date: Tue, 30 Nov 2021 15:25:27 +0800 +Subject: [PATCH] fix ConditionPathIsReadWrite when path does not exist. + +--- + src/shared/condition.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/shared/condition.c b/src/shared/condition.c +index a86f2b9ffb..dae75a5bf5 100644 +--- a/src/shared/condition.c ++++ b/src/shared/condition.c +@@ -894,11 +894,15 @@ static int condition_test_path_is_mount_point(Condition *c, char **env) { + } + + static int condition_test_path_is_read_write(Condition *c, char **env) { ++ int r; ++ + assert(c); + assert(c->parameter); + assert(c->type == CONDITION_PATH_IS_READ_WRITE); + +- return path_is_read_only_fs(c->parameter) <= 0; ++ r = path_is_read_only_fs(c->parameter); ++ ++ return r <= 0 && r != -ENOENT; + } + + static int condition_test_cpufeature(Condition *c, char **env) { +-- +2.27.0 + diff --git a/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch b/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch new file mode 100644 index 0000000..3234d28 --- /dev/null +++ b/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch @@ -0,0 +1,25 @@ +From 5896a9ebdbe4d38c01390d0a5e82f9fcb4971059 Mon Sep 17 00:00:00 2001 +From: yangmingtai <961612727@qq.com> +Date: Mon, 6 Dec 2021 17:06:13 +0800 +Subject: [PATCH] fix DirectoryNotEmpty when it comes to a Non-directory file + +--- + src/core/path.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/path.c b/src/core/path.c +index 29ec66fd4d..bcd922901b 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -215,7 +215,7 @@ static bool path_spec_check_good(PathSpec *s, bool initial, bool from_trigger_no + int k; + + k = dir_is_empty(s->path); +- good = !(k == -ENOENT || k > 0); ++ good = !(IN_SET(k, -ENOENT, -ENOTDIR) || k > 0); + break; + } + +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index 12ee0ec..2aebd7e 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 3 +Release: 4 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -64,6 +64,14 @@ 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 +#backport +Patch6000: backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch +Patch6001: backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch +Patch6002: backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch +Patch6003: backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch + +#openEuler + BuildRequires: gcc, gcc-c++ BuildRequires: libcap-devel, libmount-devel, pam-devel, libselinux-devel BuildRequires: audit-libs-devel, cryptsetup-devel, dbus-devel, libacl-devel @@ -1208,6 +1216,7 @@ fi %{_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path %{_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service %{_unitdir}/systemd-hostnamed.service.d/disable-privatedevices.conf +%{_unitdir}/sockets.target.wants/systemd-coredump.socket %{_unitdir}/sockets.target.wants/systemd-journald-dev-log.socket %{_unitdir}/sockets.target.wants/systemd-journald.socket %{_unitdir}/sockets.target.wants/systemd-initctl.socket @@ -1449,7 +1458,6 @@ fi %{_unitdir}/systemd-udev-trigger.service.d/systemd-udev-trigger-no-reload.conf %{_unitdir}/sockets.target.wants/systemd-udevd-control.socket %{_unitdir}/sockets.target.wants/systemd-udevd-kernel.socket -%{_unitdir}/sockets.target.wants/systemd-coredump.socket %{_systemddir}/system-generators/systemd-cryptsetup-generator %{_systemddir}/system-generators/systemd-hibernate-resume-generator %{_systemddir}/system-generators/systemd-gpt-auto-generator @@ -1697,6 +1705,9 @@ fi %{_unitdir}/systemd-userdbd.socket %changelog +* Tue Feb 8 2021 yangmingtai - 249-4 +- fix ConditionDirectoryNotEmpty,ConditionPathIsReadWrite and DirectoryNotEmpty + * Tue Feb 8 2021 yangmingtai - 249-3 - do not make systemd-cpredump sub packages -- Gitee