From 3795e94502819542728f0c18acf9ed0b2b74bf39 Mon Sep 17 00:00:00 2001 From: Yuanhong Peng Date: Thu, 24 Feb 2022 06:04:54 -0500 Subject: [PATCH 1/3] update to systemd-239-51.el8_5.3.src.rpm Signed-off-by: Yuanhong Peng --- ...f-on-event-loop-object-before-dispat.patch | 32 ++++ ...-uninitialized-pointer-in-unit_fail_.patch | 28 +++ 0661-Disable-iptables-for-CI.patch | 24 +++ ...comp-accept-ENOSYS-from-sysctl-2-too.patch | 27 +++ ...able-libpitc-to-fix-CentOS-Stream-CI.patch | 28 +++ ...-char-device-0-0-can-now-be-created-.patch | 52 ++++++ ...turn-true-from-cg_is_empty-on-ENOENT.patch | 43 +++++ ...l-if-the-same-alt.-name-is-set-again.patch | 27 +++ 0667-meson-avoid-bogus-meson-warning.patch | 38 ++++ ...l-if-rsync-is-not-installed-with-mes.patch | 54 ++++++ ...ull-reference-case-in-load_from_path.patch | 34 ---- ...-t-pass-null-directive-argument-to-s.patch | 30 --- ...r-systemd-runtest.env-to-set-SYSTEMD.patch | 171 ------------------ ...r-systemd-runtest.env-for-SYSTEMD_CA.patch | 139 -------------- 1006-strv-rework-FOREACH_STRING-macro.patch | 50 ----- ...roduce-EXIT_EXCEPTION-mapping-to-255.patch | 61 ------- ...e-PID-1-in-containers-exit-with-non-.patch | 59 ------ ...t-go-into-freeze-when-systemd-crashd.patch | 111 ------------ ...ge-the-system-mount-propagation-to-s.patch | 77 -------- ...agate-errors-from-mount_setup_unit-f.patch | 57 ------ ...-definition-of-CGROUP_CONTROLLER_TO_.patch | 32 ---- ...only-siblings-that-got-realized-once.patch | 67 ------- ...g-item-to-support-setting-the-value-.patch | 121 ------------- 1015-systemd-anolis-support-loongarch64.patch | 56 ------ systemd.spec | 60 +++--- 25 files changed, 379 insertions(+), 1099 deletions(-) create mode 100644 0659-sd-event-take-ref-on-event-loop-object-before-dispat.patch create mode 100644 0660-pid1-fix-free-of-uninitialized-pointer-in-unit_fail_.patch create mode 100644 0661-Disable-iptables-for-CI.patch create mode 100644 0662-test-seccomp-accept-ENOSYS-from-sysctl-2-too.patch create mode 100644 0663-Disable-libpitc-to-fix-CentOS-Stream-CI.patch create mode 100644 0664-test-accept-that-char-device-0-0-can-now-be-created-.patch create mode 100644 0665-core-return-true-from-cg_is_empty-on-ENOENT.patch create mode 100644 0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch create mode 100644 0667-meson-avoid-bogus-meson-warning.patch create mode 100644 0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch delete mode 100644 1002-core-fix-a-null-reference-case-in-load_from_path.patch delete mode 100644 1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch delete mode 100644 1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch delete mode 100644 1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch delete mode 100644 1006-strv-rework-FOREACH_STRING-macro.patch delete mode 100644 1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch delete mode 100644 1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch delete mode 100644 1009-Do-not-go-into-freeze-when-systemd-crashd.patch delete mode 100644 1010-mount-setup-change-the-system-mount-propagation-to-s.patch delete mode 100644 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch delete mode 100644 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch delete mode 100644 1013-cgroup-update-only-siblings-that-got-realized-once.patch delete mode 100644 1014-core-add-a-config-item-to-support-setting-the-value-.patch delete mode 100644 1015-systemd-anolis-support-loongarch64.patch diff --git a/0659-sd-event-take-ref-on-event-loop-object-before-dispat.patch b/0659-sd-event-take-ref-on-event-loop-object-before-dispat.patch new file mode 100644 index 0000000..d726221 --- /dev/null +++ b/0659-sd-event-take-ref-on-event-loop-object-before-dispat.patch @@ -0,0 +1,32 @@ +From 814da05c68d9e892c1f89585cc07c6a0330f3e37 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Wed, 8 Sep 2021 15:42:11 +0200 +Subject: [PATCH] sd-event: take ref on event loop object before dispatching + event sources + +Idea is that all public APIs should take reference on objects that get +exposed to user-provided callbacks. We take the reference as a +protection from callbacks dropping it. We used to do this also here in +sd_event_loop(). However, in cleanup portion of f814c871e6 this was +accidentally dropped. + +(cherry picked from commit 9f6ef467818f902fe5369c8e37a39a3901bdcf4f) + +Resolves: #2024903 +--- + src/libsystemd/sd-event/sd-event.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c +index f78da00c3a..47cf93b3f4 100644 +--- a/src/libsystemd/sd-event/sd-event.c ++++ b/src/libsystemd/sd-event/sd-event.c +@@ -3838,7 +3838,7 @@ _public_ int sd_event_loop(sd_event *e) { + assert_return(!event_pid_changed(e), -ECHILD); + assert_return(e->state == SD_EVENT_INITIAL, -EBUSY); + +- _unused_ _cleanup_(sd_event_unrefp) sd_event *ref = NULL; ++ _unused_ _cleanup_(sd_event_unrefp) sd_event *ref = sd_event_ref(e); + + while (e->state != SD_EVENT_FINISHED) { + r = sd_event_run(e, (uint64_t) -1); diff --git a/0660-pid1-fix-free-of-uninitialized-pointer-in-unit_fail_.patch b/0660-pid1-fix-free-of-uninitialized-pointer-in-unit_fail_.patch new file mode 100644 index 0000000..9566337 --- /dev/null +++ b/0660-pid1-fix-free-of-uninitialized-pointer-in-unit_fail_.patch @@ -0,0 +1,28 @@ +From b526b7636961ca3d303a6965879b3575e4cc293b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 14 Dec 2018 08:16:31 +0100 +Subject: [PATCH] pid1: fix free of uninitialized pointer in + unit_fail_if_noncanonical() + +https://bugzilla.redhat.com/show_bug.cgi?id=1653068 + +(cherry picked from commit 58d9d89b4b41189bdcea86c2ad5cf708b7d54aca) + +Related: #2024903 +--- + src/core/unit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/unit.c b/src/core/unit.c +index 93c13e58d9..152a860d08 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -4785,7 +4785,7 @@ void unit_warn_if_dir_nonempty(Unit *u, const char* where) { + } + + int unit_fail_if_noncanonical(Unit *u, const char* where) { +- _cleanup_free_ char *canonical_where; ++ _cleanup_free_ char *canonical_where = NULL; + int r; + + assert(u); diff --git a/0661-Disable-iptables-for-CI.patch b/0661-Disable-iptables-for-CI.patch new file mode 100644 index 0000000..be22077 --- /dev/null +++ b/0661-Disable-iptables-for-CI.patch @@ -0,0 +1,24 @@ +From 5e081bdfe3711a812c0f2448a14909b0c518d808 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Wed, 13 Oct 2021 10:01:59 +0200 +Subject: [PATCH] Disable iptables for CI + +(cherry picked from commit ffd20a699280a4732d0fe4cddafe12ee8010ddb6) + +Related: #2024903 +--- + .github/workflows/unit_tests.sh | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh +index ad4584ec1d..36363603db 100755 +--- a/.github/workflows/unit_tests.sh ++++ b/.github/workflows/unit_tests.sh +@@ -92,7 +92,6 @@ SYSTEMD_BUILD_DEPS=( + gnutls-devel + gobject-introspection-devel + gperf +- iptables-devel + kmod-devel + libacl-devel + libblkid-devel diff --git a/0662-test-seccomp-accept-ENOSYS-from-sysctl-2-too.patch b/0662-test-seccomp-accept-ENOSYS-from-sysctl-2-too.patch new file mode 100644 index 0000000..138bc42 --- /dev/null +++ b/0662-test-seccomp-accept-ENOSYS-from-sysctl-2-too.patch @@ -0,0 +1,27 @@ +From 307930f1c7e7588e6cfdc413147c5fc615ae73de Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 22 Sep 2020 19:05:17 +0200 +Subject: [PATCH] test-seccomp: accept ENOSYS from sysctl(2) too + +It seems that kernel 5.9 started returning that. + +(cherry picked from commit 0af05e485a3a88f454c714901eb6109307dc893e) + +Related: #2024903 +--- + src/test/test-seccomp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c +index 5eb1c78b8b..6ec04c4c55 100644 +--- a/src/test/test-seccomp.c ++++ b/src/test/test-seccomp.c +@@ -239,7 +239,7 @@ static void test_protect_sysctl(void) { + if (pid == 0) { + #if defined __NR__sysctl && __NR__sysctl >= 0 + assert_se(syscall(__NR__sysctl, NULL) < 0); +- assert_se(errno == EFAULT); ++ assert_se(IN_SET(errno, EFAULT, ENOSYS)); + #endif + + assert_se(seccomp_protect_sysctl() >= 0); diff --git a/0663-Disable-libpitc-to-fix-CentOS-Stream-CI.patch b/0663-Disable-libpitc-to-fix-CentOS-Stream-CI.patch new file mode 100644 index 0000000..fd6f0ec --- /dev/null +++ b/0663-Disable-libpitc-to-fix-CentOS-Stream-CI.patch @@ -0,0 +1,28 @@ +From 26a1c41e771eb3b36f6f9b95ae35ce4803766e3c Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 25 Oct 2021 15:27:27 +0200 +Subject: [PATCH] Disable libpitc to fix CentOS Stream CI + +We have disabled it in our spec starting with 8.5.0, so let's follow +suit here. + +(cherry picked from commit b029865ef6d8b23ecdbfda4e277a3f75cb59ee94) + +Related: #2024903 +--- + .github/workflows/unit_tests.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh +index 36363603db..814870e7a0 100755 +--- a/.github/workflows/unit_tests.sh ++++ b/.github/workflows/unit_tests.sh +@@ -50,7 +50,7 @@ CONFIGURE_OPTS=( + -Dgnutls=true + -Dmicrohttpd=true + -Dlibidn2=true +- -Dlibiptc=true ++ -Dlibiptc=false + -Dlibcurl=true + -Defi=true + -Dtpm=true diff --git a/0664-test-accept-that-char-device-0-0-can-now-be-created-.patch b/0664-test-accept-that-char-device-0-0-can-now-be-created-.patch new file mode 100644 index 0000000..3645a71 --- /dev/null +++ b/0664-test-accept-that-char-device-0-0-can-now-be-created-.patch @@ -0,0 +1,52 @@ +From 5763844219e88a993d1b93653585bc68e909353c Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 14 Aug 2020 21:50:55 +0200 +Subject: [PATCH] test: accept that char device 0/0 can now be created witout + privileges + +Fixes: #16721 + +(cherry picked from commit 5b5ce6298e5a1c09beacd5c963e2350979cbf94a) + +Related: #2024903 +--- + src/test/test-fs-util.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c +index e3338ea440..aa32629f62 100644 +--- a/src/test/test-fs-util.c ++++ b/src/test/test-fs-util.c +@@ -518,8 +518,8 @@ static void test_touch_file(void) { + assert_se(timespec_load(&st.st_mtim) == test_mtime); + + if (geteuid() == 0) { +- a = strjoina(p, "/cdev"); +- r = mknod(a, 0775 | S_IFCHR, makedev(0, 0)); ++ a = strjoina(p, "/bdev"); ++ r = mknod(a, 0775 | S_IFBLK, makedev(0, 0)); + if (r < 0 && errno == EPERM && detect_container() > 0) { + log_notice("Running in unprivileged container? Skipping remaining tests in %s", __func__); + return; +@@ -529,17 +529,17 @@ static void test_touch_file(void) { + assert_se(lstat(a, &st) >= 0); + assert_se(st.st_uid == test_uid); + assert_se(st.st_gid == test_gid); +- assert_se(S_ISCHR(st.st_mode)); ++ assert_se(S_ISBLK(st.st_mode)); + assert_se((st.st_mode & 0777) == 0640); + assert_se(timespec_load(&st.st_mtim) == test_mtime); + +- a = strjoina(p, "/bdev"); +- assert_se(mknod(a, 0775 | S_IFBLK, makedev(0, 0)) >= 0); ++ a = strjoina(p, "/cdev"); ++ assert_se(mknod(a, 0775 | S_IFCHR, makedev(0, 0)) >= 0); + assert_se(touch_file(a, false, test_mtime, test_uid, test_gid, 0640) >= 0); + assert_se(lstat(a, &st) >= 0); + assert_se(st.st_uid == test_uid); + assert_se(st.st_gid == test_gid); +- assert_se(S_ISBLK(st.st_mode)); ++ assert_se(S_ISCHR(st.st_mode)); + assert_se((st.st_mode & 0777) == 0640); + assert_se(timespec_load(&st.st_mtim) == test_mtime); + } diff --git a/0665-core-return-true-from-cg_is_empty-on-ENOENT.patch b/0665-core-return-true-from-cg_is_empty-on-ENOENT.patch new file mode 100644 index 0000000..5d22a15 --- /dev/null +++ b/0665-core-return-true-from-cg_is_empty-on-ENOENT.patch @@ -0,0 +1,43 @@ +From bfc6e3c33b49b4f2e611e2ff151d3088055df07d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 17 Oct 2018 17:48:35 +0200 +Subject: [PATCH] core: return true from cg_is_empty* on ENOENT + +(cherry picked from commit 1bcf3fc6c57d92927b96cad8c739099b4ceae236) + +Related: #2024903 +--- + src/basic/cgroup-util.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index 992b12811a..14abe6e014 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -1177,7 +1177,7 @@ int cg_is_empty(const char *controller, const char *path) { + + r = cg_enumerate_processes(controller, path, &f); + if (r == -ENOENT) +- return 1; ++ return true; + if (r < 0) + return r; + +@@ -1207,6 +1207,8 @@ int cg_is_empty_recursive(const char *controller, const char *path) { + * via the "populated" attribute of "cgroup.events". */ + + r = cg_read_event(controller, path, "populated", &t); ++ if (r == -ENOENT) ++ return true; + if (r < 0) + return r; + +@@ -1221,7 +1223,7 @@ int cg_is_empty_recursive(const char *controller, const char *path) { + + r = cg_enumerate_subgroups(controller, path, &d); + if (r == -ENOENT) +- return 1; ++ return true; + if (r < 0) + return r; + diff --git a/0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch b/0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch new file mode 100644 index 0000000..ffafa82 --- /dev/null +++ b/0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch @@ -0,0 +1,27 @@ +From 21c071fbd05d112ccd92b7a49e53bf8d38cdbd06 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Wed, 8 Dec 2021 09:49:24 +0100 +Subject: [PATCH] Do not fail if the same alt. name is set again + +This is a workaround for a kernel bug. + +RHEL-only + +Resolves: #2030027 +--- + src/udev/net/link-config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c +index 5220f247f0..9046c5bd2a 100644 +--- a/src/udev/net/link-config.c ++++ b/src/udev/net/link-config.c +@@ -526,7 +526,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, + strv_uniq(altnames); + strv_sort(altnames); + r = rtnl_set_link_alternative_names(&ctx->rtnl, ifindex, altnames); +- if (r == -EOPNOTSUPP) ++ if (IN_SET(r, -EOPNOTSUPP, -EEXIST)) + log_debug_errno(r, "Could not set AlternativeName= or apply AlternativeNamesPolicy= on %s, ignoring: %m", old_name); + else if (r < 0) + return log_warning_errno(r, "Could not set AlternativeName= or apply AlternativeNamesPolicy= on %s: %m", old_name); diff --git a/0667-meson-avoid-bogus-meson-warning.patch b/0667-meson-avoid-bogus-meson-warning.patch new file mode 100644 index 0000000..4bdfec5 --- /dev/null +++ b/0667-meson-avoid-bogus-meson-warning.patch @@ -0,0 +1,38 @@ +From 0e03f2192cd80e6a4a1bf83f0238cc6d133b8475 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 7 Nov 2019 11:32:26 +0100 +Subject: [PATCH] meson: avoid bogus meson warning + +With meson-0.52.0-1.module_f31+6771+f5d842eb.noarch I get: +src/test/meson.build:19: WARNING: Overriding previous value of environment variable 'PATH' with a new one + +When we're using *prepend*, the whole point is to modify an existing variable, +so meson shouldn't warn. But let's set avoid the warning and shorten things by +setting the final value immediately. + +(cherry picked from commit cbe804947482998cc767bfb0c169e6263a6ef097) + +Related: #2030027 +--- + src/test/meson.build | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/test/meson.build b/src/test/meson.build +index 7b310d4ec7..4bbc67d367 100644 +--- a/src/test/meson.build ++++ b/src/test/meson.build +@@ -10,12 +10,11 @@ test_hashmap_ordered_c = custom_target( + + test_include_dir = include_directories('.') + +-path = run_command('sh', ['-c', 'echo "$PATH"']).stdout() ++path = run_command('sh', ['-c', 'echo "$PATH"']).stdout().strip() + test_env = environment() + test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map) + test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map) +-test_env.set('PATH', path) +-test_env.prepend('PATH', meson.build_root()) ++test_env.set('PATH', '@0@:@1@'.format(meson.build_root(), path)) + + ############################################################ + diff --git a/0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch b/0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch new file mode 100644 index 0000000..9dc08d1 --- /dev/null +++ b/0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch @@ -0,0 +1,54 @@ +From 112de8e094470d2a8df4f7c9b8ca62bd68c96a70 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 12 Apr 2021 14:03:32 +0200 +Subject: [PATCH] meson: do not fail if rsync is not installed with meson + 0.57.2 + +https://github.com/mesonbuild/meson/issues/8641 + +Our CI started to fail. Even if the change is reverted in meson, +we need a quick workaround here. + +(cherry picked from commit 7c5fd25119a495009ea62f79e5daec34cc464628) + +Related: #2030027 +--- + man/meson.build | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/man/meson.build b/man/meson.build +index a953d34098..efc8836d0c 100644 +--- a/man/meson.build ++++ b/man/meson.build +@@ -178,17 +178,20 @@ html = custom_target( + depends : html_pages, + command : ['echo']) + +-run_target( +- 'doc-sync', +- depends : man_pages + html_pages, +- command : ['rsync', '-rlv', +- '--delete-excluded', +- '--include=man', +- '--include=*.html', +- '--exclude=*', +- '--omit-dir-times', +- meson.current_build_dir(), +- get_option('www-target')]) ++rsync = find_program('rsync', required : false) ++if rsync.found() ++ run_target( ++ 'doc-sync', ++ depends : man_pages + html_pages, ++ command : [rsync, '-rlv', ++ '--delete-excluded', ++ '--include=man', ++ '--include=*.html', ++ '--exclude=*', ++ '--omit-dir-times', ++ meson.current_build_dir(), ++ get_option('www-target')]) ++endif + + ############################################################ + diff --git a/1002-core-fix-a-null-reference-case-in-load_from_path.patch b/1002-core-fix-a-null-reference-case-in-load_from_path.patch deleted file mode 100644 index 9da687e..0000000 --- a/1002-core-fix-a-null-reference-case-in-load_from_path.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3262f6c71165c309605dd87c88c7daf7dd300e6f Mon Sep 17 00:00:00 2001 -From: Wen Yang -Date: Mon, 1 Jun 2020 17:06:53 +0800 -Subject: [PATCH] core: fix a null reference case in load_from_path() - ---- - src/core/load-fragment.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c -index 33fdb82754..be5d3c2816 100644 ---- a/src/core/load-fragment.c -+++ b/src/core/load-fragment.c -@@ -4415,7 +4415,6 @@ static int load_from_path(Unit *u, const char *path) { - r = open_follow(&filename, &f, symlink_names, &id); - if (r >= 0) - break; -- filename = mfree(filename); - - /* ENOENT means that the file is missing or is a dangling symlink. - * ENOTDIR means that one of paths we expect to be is a directory -@@ -4424,7 +4423,8 @@ static int load_from_path(Unit *u, const char *path) { - */ - if (r == -EACCES) - log_debug_errno(r, "Cannot access \"%s\": %m", filename); -- else if (!IN_SET(r, -ENOENT, -ENOTDIR)) -+ filename = mfree(filename); -+ if (!IN_SET(r, -ENOENT, -ENOTDIR)) - return r; - - /* Empty the symlink names for the next run */ --- -2.18.1 - diff --git a/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch b/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch deleted file mode 100644 index ebf2592..0000000 --- a/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 74dbb8676dcc35c9b1431254142b3cf24ac7e1a4 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 16 Dec 2018 20:53:38 -0800 -Subject: [PATCH] sysctl: Don't pass null directive argument to '%s' - -value pointer here is always NULL but subsequent use of that pointer -with a %s format will always be NULL, printing p instead would be a -valid string - -Signed-off-by: Khem Raj ---- - src/sysctl/sysctl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c -index 0151f7dabe..61447bb72e 100644 ---- a/src/sysctl/sysctl.c -+++ b/src/sysctl/sysctl.c -@@ -112,7 +112,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign - - value = strchr(p, '='); - if (!value) { -- log_error("Line is not an assignment at '%s:%u': %s", path, c, value); -+ log_error("Line is not an assignment at '%s:%u': %s", path, c, p); - - if (r == 0) - r = -EINVAL; --- -2.18.1 - diff --git a/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch b/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch deleted file mode 100644 index f5edab5..0000000 --- a/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 89bb4cdeae7903e58fe11431fb51f8d995deb0a3 Mon Sep 17 00:00:00 2001 -From: Filipe Brandenburger -Date: Tue, 11 Sep 2018 23:55:02 -0700 -Subject: [PATCH] test: use ${builddir}/systemd-runtest.env to set - $SYSTEMD_TEST_DATA - -This simplifies get_testdata_dir() to simply checking for an environment -variable, with an additional function to locate a systemd-runtest.env file in -the same directory as the test binary and reading environment variable -assignments from that file if it exists. - -This makes it possible to: -- Run `ninja test` from the build dir and have it use ${srcdir}/test for - test unit definitions. -- Run a test directly, such as `build/test-execute` and have it locate - them correctly. -- Run installed tests (from systemd-tests package) and locate the test - units in the installed location (/usr/lib/systemd/tests/testdata), in - which case the absence of the systemd-runtest.env file will have - get_testdata_dir() use the installed location hardcoded into the - binaries. - -Explicit setting of $SYSTEMD_TEST_DATA still overrides the contents of -systemd-runtest.env. - -Signed-off-by: Wen Yang -(cherry picked from commit e2d413707fc68ed033a83e10a055ca638a1e1e18) ---- - meson.build | 10 ++++++- - src/shared/tests.c | 67 ++++++++++++++++++++++------------------------ - 2 files changed, 41 insertions(+), 36 deletions(-) - -diff --git a/meson.build b/meson.build -index 0ba3f924ea..8c4549640b 100644 ---- a/meson.build -+++ b/meson.build -@@ -213,6 +213,7 @@ conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) - conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) - conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) - conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) -+conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) - conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) - conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) - conf.set_quoted('LIBDIR', libdir) -@@ -229,7 +230,6 @@ conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_ - conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no') - - conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) --conf.set_quoted('ABS_SRC_DIR', meson.source_root()) - - substs.set('prefix', prefixdir) - substs.set('exec_prefix', prefixdir) -@@ -2592,6 +2592,14 @@ executable('systemd-sulogin-shell', - - ############################################################ - -+custom_target( -+ 'systemd-runtest.env', -+ output : 'systemd-runtest.env', -+ command : ['sh', '-c', '{ ' + -+ 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(meson.current_source_dir(), 'test')) + -+ '} >@OUTPUT@'], -+ build_by_default : true) -+ - foreach tuple : tests - sources = tuple[0] - link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] -diff --git a/src/shared/tests.c b/src/shared/tests.c -index 100b62b9b0..102b343fef 100644 ---- a/src/shared/tests.c -+++ b/src/shared/tests.c -@@ -6,8 +6,11 @@ - #include - #include - --#include "tests.h" -+#include "alloc-util.h" -+#include "fileio.h" - #include "path-util.h" -+#include "strv.h" -+#include "tests.h" - - char* setup_fake_runtime_dir(void) { - char t[] = "/tmp/fake-xdg-runtime-XXXXXX", *p; -@@ -19,55 +22,49 @@ char* setup_fake_runtime_dir(void) { - return p; - } - --bool test_is_running_from_builddir(char **exedir) { -+static void load_testdata_env(void) { -+ static bool called = false; - _cleanup_free_ char *s = NULL; -- bool r; -+ _cleanup_free_ char *envpath = NULL; -+ _cleanup_strv_free_ char **pairs = NULL; -+ char **k, **v; - -- /* Check if we're running from the builddir. Optionally, this returns -- * the path to the directory where the binary is located. */ -+ if (called) -+ return; -+ called = true; - - assert_se(readlink_and_make_absolute("/proc/self/exe", &s) >= 0); -- r = path_startswith(s, ABS_BUILD_DIR); -+ dirname(s); - -- if (exedir) { -- dirname(s); -- *exedir = TAKE_PTR(s); -- } -+ envpath = path_join(NULL, s, "systemd-runtest.env"); -+ if (load_env_file_pairs(NULL, envpath, NULL, &pairs) < 0) -+ return; - -- return r; -+ STRV_FOREACH_PAIR(k, v, pairs) -+ setenv(*k, *v, 0); -+} -+ -+bool test_is_running_from_builddir(char **exedir) { -+ load_testdata_env(); -+ -+ return !!getenv("SYSTEMD_TEST_DATA"); - } - - const char* get_testdata_dir(void) { - const char *env; -- /* convenience: caller does not need to free result */ -- static char testdir[PATH_MAX]; -+ -+ load_testdata_env(); - - /* if the env var is set, use that */ - env = getenv("SYSTEMD_TEST_DATA"); -- testdir[sizeof(testdir) - 1] = '\0'; -- if (env) { -- if (access(env, F_OK) < 0) { -- fputs("ERROR: $SYSTEMD_TEST_DATA directory does not exist\n", stderr); -- exit(EXIT_FAILURE); -- } -- strncpy(testdir, env, sizeof(testdir) - 1); -- } else { -- _cleanup_free_ char *exedir = NULL; -- -- /* Check if we're running from the builddir. If so, use the compiled in path. */ -- if (test_is_running_from_builddir(&exedir)) -- assert_se(snprintf(testdir, sizeof(testdir), "%s/test", ABS_SRC_DIR) > 0); -- else -- /* Try relative path, according to the install-test layout */ -- assert_se(snprintf(testdir, sizeof(testdir), "%s/testdata", exedir) > 0); -- -- if (access(testdir, F_OK) < 0) { -- fputs("ERROR: Cannot find testdata directory, set $SYSTEMD_TEST_DATA\n", stderr); -- exit(EXIT_FAILURE); -- } -+ if (!env) -+ env = SYSTEMD_TEST_DATA; -+ if (access(env, F_OK) < 0) { -+ fprintf(stderr, "ERROR: $SYSTEMD_TEST_DATA directory [%s] does not exist\n", env); -+ exit(EXIT_FAILURE); - } - -- return testdir; -+ return env; - } - - void test_setup_logging(int level) { --- -2.18.1 - diff --git a/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch b/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch deleted file mode 100644 index b74edb7..0000000 --- a/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch +++ /dev/null @@ -1,139 +0,0 @@ -From c5e249d9eaabaeebc3ac447462d50adec3245f2f Mon Sep 17 00:00:00 2001 -From: Filipe Brandenburger -Date: Wed, 12 Sep 2018 00:23:40 -0700 -Subject: [PATCH] test: use ${builddir}/systemd-runtest.env for - $SYSTEMD_CATALOG_DIR - -This makes it so that tests no longer need to know the absolute paths to the -source and build dirs, instead using the systemd-runtest.env file to get these -paths when running from the build tree. - -Confirmed that test-catalog works on `ninja test`, when called standalone and -also when the environment file is not present, in which case it will use the -installed location under /usr/lib/systemd/catalog. - -The location can now also be overridden for this test by setting the -$SYSTEMD_CATALOG_DIR environment variable. - -Signed-off-by: Wen Yang -(cherry picked from commit fef716b28be6e866b8afe995805d5ebe2af6bbfa) ---- - meson.build | 4 ++-- - src/journal/test-catalog.c | 6 +----- - src/shared/tests.c | 22 ++++++++++++++++------ - src/shared/tests.h | 2 +- - src/test/meson.build | 3 +-- - 5 files changed, 21 insertions(+), 16 deletions(-) - -diff --git a/meson.build b/meson.build -index 8c4549640b..cf6990a50e 100644 ---- a/meson.build -+++ b/meson.build -@@ -214,6 +214,7 @@ conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) - conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) - conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) - conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) -+conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir) - conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) - conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) - conf.set_quoted('LIBDIR', libdir) -@@ -229,8 +230,6 @@ conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdata - conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false') - conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no') - --conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) -- - substs.set('prefix', prefixdir) - substs.set('exec_prefix', prefixdir) - substs.set('libdir', libdir) -@@ -2597,6 +2596,7 @@ custom_target( - output : 'systemd-runtest.env', - command : ['sh', '-c', '{ ' + - 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(meson.current_source_dir(), 'test')) + -+ 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(meson.current_build_dir(), 'catalog')) + - '} >@OUTPUT@'], - build_by_default : true) - -diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c -index 0c4da29f31..d9ee557b9c 100644 ---- a/src/journal/test-catalog.c -+++ b/src/journal/test-catalog.c -@@ -212,11 +212,7 @@ int main(int argc, char *argv[]) { - - /* If test-catalog is located at the build directory, then use catalogs in that. - * If it is not, e.g. installed by systemd-tests package, then use installed catalogs. */ -- if (test_is_running_from_builddir(NULL)) { -- assert_se(catalog_dir = path_join(NULL, ABS_BUILD_DIR, "catalog")); -- catalog_dirs = STRV_MAKE(catalog_dir); -- } else -- catalog_dirs = STRV_MAKE(CATALOG_DIR); -+ catalog_dirs = STRV_MAKE(get_catalog_dir()); - - assert_se(access(catalog_dirs[0], F_OK) >= 0); - log_notice("Using catalog directory '%s'", catalog_dirs[0]); -diff --git a/src/shared/tests.c b/src/shared/tests.c -index 102b343fef..7bd6f806b9 100644 ---- a/src/shared/tests.c -+++ b/src/shared/tests.c -@@ -44,12 +44,6 @@ static void load_testdata_env(void) { - setenv(*k, *v, 0); - } - --bool test_is_running_from_builddir(char **exedir) { -- load_testdata_env(); -- -- return !!getenv("SYSTEMD_TEST_DATA"); --} -- - const char* get_testdata_dir(void) { - const char *env; - -@@ -72,3 +66,19 @@ void test_setup_logging(int level) { - log_parse_environment(); - log_open(); - } -+ -+const char* get_catalog_dir(void) { -+ const char *env; -+ -+ load_testdata_env(); -+ -+ /* if the env var is set, use that */ -+ env = getenv("SYSTEMD_CATALOG_DIR"); -+ if (!env) -+ env = SYSTEMD_CATALOG_DIR; -+ if (access(env, F_OK) < 0) { -+ fprintf(stderr, "ERROR: $SYSTEMD_CATALOG_DIR directory [%s] does not exist\n", env); -+ exit(EXIT_FAILURE); -+ } -+ return env; -+} -diff --git a/src/shared/tests.h b/src/shared/tests.h -index 3d696d02fd..19a9fa0fee 100644 ---- a/src/shared/tests.h -+++ b/src/shared/tests.h -@@ -2,6 +2,6 @@ - #pragma once - - char* setup_fake_runtime_dir(void); --bool test_is_running_from_builddir(char **exedir); - const char* get_testdata_dir(void); -+const char* get_catalog_dir(void); - void test_setup_logging(int level); -diff --git a/src/test/meson.build b/src/test/meson.build -index 7b310d4ec7..b4b9e8a60e 100644 ---- a/src/test/meson.build -+++ b/src/test/meson.build -@@ -776,8 +776,7 @@ tests += [ - libshared], - [threads, - libxz, -- liblz4], -- '', '', '-DCATALOG_DIR="@0@"'.format(catalogdir)], -+ liblz4]], - - [['src/journal/test-compress.c'], - [libjournal_core, --- -2.18.1 - diff --git a/1006-strv-rework-FOREACH_STRING-macro.patch b/1006-strv-rework-FOREACH_STRING-macro.patch deleted file mode 100644 index 7d8bcf2..0000000 --- a/1006-strv-rework-FOREACH_STRING-macro.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f3ae2e70053c5145cdd9750b577f5d86077c7271 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Tue, 2 Jun 2020 02:48:29 +0000 -Subject: [PATCH] strv: rework FOREACH_STRING() macro - -upstream commit 66a64081f82dfad90f2f9394a477820a2e3e6510 - -So it's apparently problematic that we use STRV_MAKE() (i.e. a compound -initializer) outside of the {} block we use it in (and that includes -outside of the ({}) block, too). Hence, let's rework the macro to not -need that. - -This also makes the macro shorter, which is definitely a good and more -readable. Moreover, it will now complain if the iterator is a "char*" -instead of a "const char*", which is good too. - -Fixes: #11394 ---- - src/basic/strv.h | 15 ++++----------- - 1 file changed, 4 insertions(+), 11 deletions(-) - -diff --git a/src/basic/strv.h b/src/basic/strv.h -index c1e4c97..a09d767 100644 ---- a/src/basic/strv.h -+++ b/src/basic/strv.h -@@ -148,17 +148,10 @@ void strv_print(char **l); - _found; \ - }) - --#define FOREACH_STRING(x, ...) \ -- for (char **_l = ({ \ -- char **_ll = STRV_MAKE(__VA_ARGS__); \ -- x = _ll ? _ll[0] : NULL; \ -- _ll; \ -- }); \ -- _l && *_l; \ -- x = ({ \ -- _l ++; \ -- _l[0]; \ -- })) -+#define FOREACH_STRING(x, y, ...) \ -+ for (char **_l = STRV_MAKE(({ x = y; }), ##__VA_ARGS__); \ -+ x; \ -+ x = *(++_l)) - - char **strv_reverse(char **l); - char **strv_shell_escape(char **l, const char *bad); --- -2.18.1 - diff --git a/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch b/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch deleted file mode 100644 index eeb47f7..0000000 --- a/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 7188a29295f3a6f2c8e0a7c5a5ae4914088ee6fc Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Tue, 20 Nov 2018 16:55:51 +0100 -Subject: [PATCH] exit-status: introduce EXIT_EXCEPTION mapping to 255 - -cherry-picked from upstream 3584d3ca. - -Conflicts: - src/basic/exit-status.c - src/basic/exit-status.h - -Signed-off-by: Yuanhong Peng ---- - src/basic/exit-status.c | 10 +++++++--- - src/basic/exit-status.h | 2 ++ - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/src/basic/exit-status.c b/src/basic/exit-status.c -index 0a7a53b73d..58ebc3ca4d 100644 ---- a/src/basic/exit-status.c -+++ b/src/basic/exit-status.c -@@ -19,9 +19,10 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { - * 79…199 │ (Currently unmapped) - * 200…241 │ systemd's private error codes (might be extended to 254 in future development) - * 242…254 │ (Currently unmapped, but see above) -- * 255 │ (We should probably stay away from that one, it's frequently used by applications to indicate an -- * │ exit reason that cannot really be expressed in a single exit status value — such as a propagated -- * │ signal or such) -+ * -+ * 255 │ EXIT_EXCEPTION (We use this to propagate exit-by-signal events. It's frequently used by others apps (like bash) -+ * │ to indicate exit reason that cannot really be expressed in a single exit status value — such as a propagated -+ * │ signal or such, and we follow that logic here.) - */ - - switch (status) { /* We always cover the ISO C ones */ -@@ -158,6 +159,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { - - case EXIT_NUMA_POLICY: - return "NUMA_POLICY"; -+ -+ case EXIT_EXCEPTION: -+ return "EXCEPTION"; - } - } - -diff --git a/src/basic/exit-status.h b/src/basic/exit-status.h -index dc284aacb1..5637e6aa04 100644 ---- a/src/basic/exit-status.h -+++ b/src/basic/exit-status.h -@@ -70,6 +70,8 @@ enum { - EXIT_LOGS_DIRECTORY, /* 240 */ - EXIT_CONFIGURATION_DIRECTORY, - EXIT_NUMA_POLICY, -+ -+ EXIT_EXCEPTION = 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */ - }; - - typedef enum ExitStatusLevel { --- -2.18.1 - diff --git a/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch b/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch deleted file mode 100644 index 94923e1..0000000 --- a/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 6c76e460aed00997766a638fa8b40cc1b17a14d5 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Tue, 20 Nov 2018 13:16:48 +0100 -Subject: [PATCH] main: don't freeze PID 1 in containers, exit with - non-zero instead - -After all we have a nice way to propagate total failures, hence let's -use it. - -cherry-picked from upstream bb259772 without conflict. - -Signed-off-by: Yuanhong Peng ---- - src/core/main.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/src/core/main.c b/src/core/main.c -index 25536054b3..1ecdc47446 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -139,7 +139,14 @@ static NUMAPolicy arg_numa_policy; - static int parse_configuration(const struct rlimit *saved_rlimit_nofile, - const struct rlimit *saved_rlimit_memlock); - --_noreturn_ static void freeze_or_reboot(void) { -+_noreturn_ static void freeze_or_exit_or_reboot(void) { -+ -+ /* If we are running in a contianer, let's prefer exiting, after all we can propagate an exit code to the -+ * container manager, and thus inform it that something went wrong. */ -+ if (detect_container() > 0) { -+ log_emergency("Exiting PID 1..."); -+ exit(EXIT_EXCEPTION); -+ } - - if (arg_crash_reboot) { - log_notice("Rebooting in 10s..."); -@@ -247,7 +254,7 @@ _noreturn_ static void crash(int sig) { - } - } - -- freeze_or_reboot(); -+ freeze_or_exit_or_reboot(); - } - - static void install_crash_handler(void) { -@@ -2664,8 +2671,8 @@ finish: - if (error_message) - manager_status_printf(NULL, STATUS_TYPE_EMERGENCY, - ANSI_HIGHLIGHT_RED "!!!!!!" ANSI_NORMAL, -- "%s, freezing.", error_message); -- freeze_or_reboot(); -+ "%s.", error_message); -+ freeze_or_exit_or_reboot(); - } - - return retval; --- -2.18.1 - diff --git a/1009-Do-not-go-into-freeze-when-systemd-crashd.patch b/1009-Do-not-go-into-freeze-when-systemd-crashd.patch deleted file mode 100644 index 2b457bc..0000000 --- a/1009-Do-not-go-into-freeze-when-systemd-crashd.patch +++ /dev/null @@ -1,111 +0,0 @@ -From d05802b22fda63164a1f12a60ebf726a44fbecb4 Mon Sep 17 00:00:00 2001 -From: Yuanhong Peng -Date: Mon, 14 Dec 2020 17:04:28 +0800 -Subject: [PATCH] Do not go into freeze when systemd crashd - -If something unexpected happens which cause systemd to freeze, the system -cannot resume without a reboot, furthermore, if a service dies or exits, -no one else can recycle all child processes of the service, which will -cause a number of zombie processes remaining in the system. So we -introduce a mechanism, when systemd enters freeze state, you can send -SIGTERM to it to force systemd to re-exec. This may helps to resume the -system if it cannot reboot. - -Signed-off-by: Yuanhong Peng ---- - src/core/main.c | 40 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 39 insertions(+), 1 deletion(-) - -diff --git a/src/core/main.c b/src/core/main.c -index 1ecdc47446..a72c685b20 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -3,6 +3,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -10,6 +11,7 @@ - #include - #include - #include -+#include - #include - #if HAVE_SECCOMP - #include -@@ -135,10 +137,41 @@ static sd_id128_t arg_machine_id; - static EmergencyAction arg_cad_burst_action; - static CPUSet arg_cpu_affinity; - static NUMAPolicy arg_numa_policy; -+static bool reexec_jmp_can = false; -+static bool reexec_jmp_inited = false; -+static sigjmp_buf reexec_jmp_buf; - - static int parse_configuration(const struct rlimit *saved_rlimit_nofile, - const struct rlimit *saved_rlimit_memlock); - -+static void reexec_handler(int sig) { -+ reexec_jmp_can = true; -+} -+ -+_noreturn_ static void freeze_wait_upgrade(void) { -+ struct sigaction sa; -+ sigset_t ss; -+ -+ sigemptyset(&ss); -+ sigaddset(&ss, SIGTERM); -+ sigprocmask(SIG_UNBLOCK, &ss, NULL); -+ -+ sa.sa_handler = reexec_handler; -+ sa.sa_flags = SA_RESTART; -+ sigaction(SIGTERM, &sa, NULL); -+ -+ log_error("freeze_wait_upgrade: %d\n", reexec_jmp_inited); -+ reexec_jmp_can = false; -+ while(1) { -+ usleep(10000); -+ if (reexec_jmp_inited && reexec_jmp_can) { -+ log_error("goto manager_reexecute.\n"); -+ siglongjmp(reexec_jmp_buf, 1); -+ } -+ waitpid(-1, NULL, WNOHANG); -+ } -+} -+ - _noreturn_ static void freeze_or_exit_or_reboot(void) { - - /* If we are running in a contianer, let's prefer exiting, after all we can propagate an exit code to the -@@ -158,7 +191,7 @@ _noreturn_ static void freeze_or_exit_or_reboot(void) { - } - - log_emergency("Freezing execution."); -- freeze(); -+ freeze_wait_upgrade(); - } - - _noreturn_ static void crash(int sig) { -@@ -1668,6 +1701,10 @@ static int invoke_main_loop( - assert(ret_switch_root_init); - assert(ret_error_message); - -+ reexec_jmp_inited = true; -+ if (sigsetjmp(reexec_jmp_buf, 1)) -+ goto manager_reexecute; -+ - for (;;) { - r = manager_loop(m); - if (r < 0) { -@@ -1710,6 +1747,7 @@ static int invoke_main_loop( - - case MANAGER_REEXECUTE: - -+manager_reexecute: - r = prepare_reexecute(m, &arg_serialization, ret_fds, false); - if (r < 0) { - *ret_error_message = "Failed to prepare for reexecution"; --- -2.18.1 - diff --git a/1010-mount-setup-change-the-system-mount-propagation-to-s.patch b/1010-mount-setup-change-the-system-mount-propagation-to-s.patch deleted file mode 100644 index 4066dfd..0000000 --- a/1010-mount-setup-change-the-system-mount-propagation-to-s.patch +++ /dev/null @@ -1,77 +0,0 @@ -From bdd65129e7fbd09c7e0c1fd7fbaffeb9b0b81e1d Mon Sep 17 00:00:00 2001 -From: Wen Yang -Date: Mon, 23 Mar 2020 10:42:46 +0800 -Subject: [PATCH] mount-setup: change the system mount propagation to - shared by default only at bootup - -The commit b3ac5f8cb987 has changed the system mount propagation to -shared by default, and according to the following patch: -https://github.com/opencontainers/runc/pull/208 -When starting the container, the pouch daemon will call runc to execute -make-private. - -However, if the systemctl daemon-reexec is executed after the container -has been started, the system mount propagation will be changed to share -again by default, and the make-private operation above will have no chance -to execute. - -cherry-picked from upstream f74349d8 without conflict. - -Signed-off-by: Yuanhong Peng ---- - src/core/main.c | 2 +- - src/core/mount-setup.c | 4 ++-- - src/core/mount-setup.h | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/core/main.c b/src/core/main.c -index a72c685b20..55c54aecd5 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -2519,7 +2519,7 @@ int main(int argc, char *argv[]) { - if (!skip_setup) - kmod_setup(); - -- r = mount_setup(loaded_policy); -+ r = mount_setup(loaded_policy, skip_setup); - if (r < 0) { - error_message = "Failed to mount API filesystems"; - goto finish; -diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c -index b3cf13af2b..ff7fc18765 100644 ---- a/src/core/mount-setup.c -+++ b/src/core/mount-setup.c -@@ -400,7 +400,7 @@ static int relabel_cgroup_filesystems(void) { - } - #endif - --int mount_setup(bool loaded_policy) { -+int mount_setup(bool loaded_policy, bool leave_propagation) { - int r = 0; - - r = mount_points_setup(ELEMENTSOF(mount_table), loaded_policy); -@@ -444,7 +444,7 @@ int mount_setup(bool loaded_policy) { - * needed. Note that we set this only when we are invoked directly by the kernel. If we are invoked by a - * container manager we assume the container manager knows what it is doing (for example, because it set up - * some directories with different propagation modes). */ -- if (detect_container() <= 0) -+ if (detect_container() <= 0 && !leave_propagation) - if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0) - log_warning_errno(errno, "Failed to set up the root directory for shared mount propagation: %m"); - -diff --git a/src/core/mount-setup.h b/src/core/mount-setup.h -index 43cd8908de..7a011b25c8 100644 ---- a/src/core/mount-setup.h -+++ b/src/core/mount-setup.h -@@ -4,7 +4,7 @@ - #include - - int mount_setup_early(void); --int mount_setup(bool loaded_policy); -+int mount_setup(bool loaded_policy, bool leave_propagation); - - int mount_cgroup_controllers(char ***join_controllers); - --- -2.18.1 - diff --git a/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch b/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch deleted file mode 100644 index cbbec36..0000000 --- a/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 66ccec10af5ac97fa0528a309119f98e4eff44a7 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Wed, 28 Nov 2018 12:41:44 +0100 -Subject: [PATCH] mount: don't propagate errors from mount_setup_unit() further - up - -If we can't process a specific line in /proc/self/mountinfo we should -log about it (which we do), but this should not affect other lines, nor -further processing of mount units. Let's keep these failures local. - -Fixes: #10874 - -cherry-picked from upstream ba0d56f5. - -Conflicts: - src/core/mount.c - -Signed-off-by: Yuanhong Peng ---- - src/core/mount.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/src/core/mount.c b/src/core/mount.c -index 7e80a0c..9b1c59b 100644 ---- a/src/core/mount.c -+++ b/src/core/mount.c -@@ -1621,12 +1621,10 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { - if (r < 0) - return log_error_errno(r, "Failed to parse /proc/self/mountinfo: %m"); - -- r = 0; - for (;;) { - struct libmnt_fs *fs; - const char *device, *path, *options, *fstype; - _cleanup_free_ char *d = NULL, *p = NULL; -- int k; - - r = mnt_table_next_fs(table, iter, &fs); - if (r == 1) -@@ -1650,12 +1648,10 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { - - device_found_node(m, d, DEVICE_FOUND_MOUNT, DEVICE_FOUND_MOUNT); - -- k = mount_setup_unit(m, d, p, options, fstype, set_flags); -- if (r == 0 && k < 0) -- r = k; -+ (void) mount_setup_unit(m, d, p, options, fstype, set_flags); - } - -- return r; -+ return 0; - } - - static void mount_shutdown(Manager *m) { --- -2.27.0 - diff --git a/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch b/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch deleted file mode 100644 index 7936d17..0000000 --- a/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 334dddc80cb53561c49f9a7b4e5237a6451a9964 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Fri, 26 Oct 2018 15:31:30 +0200 -Subject: [PATCH] cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned - -Otherwise doing comparing a CGroupMask (which is unsigned in effect) -with the result of CGROUP_CONTROLLER_TO_MASK() will result in warnings -about signedness differences. - -cherry-picked from upstream 46f84f95 without conflict. - -Signed-off-by: Yuanhong Peng ---- - src/basic/cgroup-util.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h -index 1210b38a83..76659c3790 100644 ---- a/src/basic/cgroup-util.h -+++ b/src/basic/cgroup-util.h -@@ -31,7 +31,7 @@ typedef enum CGroupController { - _CGROUP_CONTROLLER_INVALID = -1, - } CGroupController; - --#define CGROUP_CONTROLLER_TO_MASK(c) (1 << (c)) -+#define CGROUP_CONTROLLER_TO_MASK(c) (1U << (c)) - - /* A bit mask of well known cgroup controllers */ - typedef enum CGroupMask { --- -2.18.1 - diff --git a/1013-cgroup-update-only-siblings-that-got-realized-once.patch b/1013-cgroup-update-only-siblings-that-got-realized-once.patch deleted file mode 100644 index cd83cd1..0000000 --- a/1013-cgroup-update-only-siblings-that-got-realized-once.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 18561b46343c94af359d74a48c34974739b46eeb Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Mon, 13 Jan 2020 20:06:39 +0100 -Subject: [PATCH] cgroup: update only siblings that got realized once - -Fixes: #14475 -Replaces: #14554 - -cherry-picked from upstream e1e98911 without conflict. - -Signed-off-by: Yuanhong Peng ---- - src/core/cgroup.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/src/core/cgroup.c b/src/core/cgroup.c -index e0eb184fd2..00121e3f37 100644 ---- a/src/core/cgroup.c -+++ b/src/core/cgroup.c -@@ -1964,7 +1964,15 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { - Unit *slice; - - /* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup -- * queue. (But neither the specified unit itself nor the parents.) */ -+ * queue. (But neither the specified unit itself nor the parents.) -+ * -+ * Propagation of realization "side-ways" (i.e. towards siblings) is in relevant on cgroup-v1 where -+ * scheduling become very weird if two units that own processes reside in the same slice, but one is -+ * realized in the "cpu" hierarchy and once is not (for example because one has CPUWeight= set and -+ * the other does not), because that means processes need to be scheduled against groups. Let's avoid -+ * this asymmetry by always ensuring that units below a slice that are realized at all are hence -+ * always realized in *all* their hierarchies, and it is sufficient for a unit's sibling to be -+ * realized for a unit to be realized too. */ - - while ((slice = UNIT_DEREF(u->slice))) { - Iterator i; -@@ -1972,6 +1980,7 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { - void *v; - - HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) { -+ - /* Skip units that have a dependency on the slice but aren't actually in it. */ - if (UNIT_DEREF(m->slice) != slice) - continue; -@@ -1980,6 +1989,11 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { - if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m))) - continue; - -+ /* We only enqueue siblings if they were realized once at least, in the main -+ * hierarchy. */ -+ if (!m->cgroup_realized) -+ continue; -+ - /* If the unit doesn't need any new controllers and has current ones realized, it - * doesn't need any changes. */ - if (unit_has_mask_realized(m, -@@ -2264,6 +2278,7 @@ void unit_add_to_cgroup_empty_queue(Unit *u) { - /* Let's verify that the cgroup is really empty */ - if (!u->cgroup_path) - return; -+ - r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path); - if (r < 0) { - log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", u->cgroup_path); --- -2.18.1 - diff --git a/1014-core-add-a-config-item-to-support-setting-the-value-.patch b/1014-core-add-a-config-item-to-support-setting-the-value-.patch deleted file mode 100644 index 08d87b1..0000000 --- a/1014-core-add-a-config-item-to-support-setting-the-value-.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 729300a386ee380406b6ea92e0924877066b1a3d Mon Sep 17 00:00:00 2001 -From: Yuanhong Peng -Date: Tue, 15 Dec 2020 11:47:49 +0800 -Subject: [PATCH] core: add a config item to support setting the value - of cpuset.clone_children when systemd is starting - -Signed-off-by: Yuanhong Peng ---- - src/core/main.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 68 insertions(+) - -diff --git a/src/core/main.c b/src/core/main.c -index 55c54aecd5..f241707842 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -140,6 +140,7 @@ static NUMAPolicy arg_numa_policy; - static bool reexec_jmp_can = false; - static bool reexec_jmp_inited = false; - static sigjmp_buf reexec_jmp_buf; -+static bool arg_default_cpuset_clone_children = false; - - static int parse_configuration(const struct rlimit *saved_rlimit_nofile, - const struct rlimit *saved_rlimit_memlock); -@@ -528,6 +529,14 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat - - parse_path_argument_and_warn(value, false, &arg_watchdog_device); - -+ } else if (proc_cmdline_key_streq(key, "systemd.cpuset_clone_children") && value) { -+ -+ r = parse_boolean(value); -+ if (r < 0) -+ log_warning("Failed to parse cpuset_clone_children switch %s. Ignoring.", value); -+ else -+ arg_default_cpuset_clone_children = r; -+ - } else if (streq(key, "quiet") && !value) { - - if (arg_show_status == _SHOW_STATUS_UNSET) -@@ -756,6 +765,7 @@ static int parse_config_file(void) { - { "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting }, - { "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max }, - { "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action }, -+ { "Manager", "DefaultCPUSetCloneChildren",config_parse_bool, 0, &arg_default_cpuset_clone_children }, - {} - }; - -@@ -1872,6 +1882,63 @@ static void log_execution_mode(bool *ret_first_boot) { - } - } - -+static bool is_use_triple_cgroup(void) { -+ const char * path ="/sys/fs/cgroup/cpuset"; -+ _cleanup_strv_free_ char **l = NULL; -+ char buf[128] = {0}; -+ int r; -+ -+ r = is_symlink(path); -+ if (r <= 0) -+ return false; -+ -+ r = readlink(path, buf, sizeof(buf)); -+ if (r < 0 || (unsigned int)r >= sizeof(buf)) -+ return false; -+ -+ buf[r] = '\0'; -+ l = strv_split(buf, ","); -+ if (!l) -+ return false; -+ -+ strv_sort(l); -+ if (strv_length(l) != 3) -+ return false; -+ -+ if (streq(l[0],"cpu") && streq(l[1], "cpuacct") && -+ streq(l[2], "cpuset")) { -+ log_debug(PACKAGE_STRING " use_triple_cgroup: %s", buf); -+ return true; -+ } -+ return false; -+} -+ -+static int ali_handle_cpuset_clone_children(void) -+{ -+ const char *file = "/sys/fs/cgroup/cpuset/cgroup.clone_children"; -+ _cleanup_free_ char *buf = NULL; -+ int r; -+ -+ r = read_one_line_file(file, &buf); -+ if (r < 0) { -+ log_warning_errno(r, "Cannot read %s: %m", file); -+ return r; -+ } -+ -+ if (streq(buf, "1") && arg_default_cpuset_clone_children) -+ return 0; -+ -+ if (streq(buf, "0") && (!arg_default_cpuset_clone_children)) -+ return 0; -+ -+ if (!is_use_triple_cgroup()) -+ return 0; -+ -+ r = write_string_file(file, one_zero(arg_default_cpuset_clone_children), 0); -+ log_info(PACKAGE_STRING " set %s to %s, ret=%d", file, one_zero(arg_default_cpuset_clone_children), r); -+ return r; -+} -+ - static int initialize_runtime( - bool skip_setup, - struct rlimit *saved_rlimit_nofile, -@@ -1906,6 +1973,7 @@ static int initialize_runtime( - return r; - } - -+ ali_handle_cpuset_clone_children(); - status_welcome(); - hostname_setup(); - machine_id_setup(NULL, arg_machine_id, NULL); --- -2.18.1 - diff --git a/1015-systemd-anolis-support-loongarch64.patch b/1015-systemd-anolis-support-loongarch64.patch deleted file mode 100644 index 8f23b97..0000000 --- a/1015-systemd-anolis-support-loongarch64.patch +++ /dev/null @@ -1,56 +0,0 @@ -From bd646124c244f6de65cd829b33f5912c1d540bb4 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Fri, 6 Aug 2021 08:15:19 +0000 -Subject: [PATCH] support loongarch64 for systemd - ---- - src/basic/architecture.c | 3 +++ - src/basic/architecture.h | 4 ++++ - 2 files changed, 7 insertions(+) - -diff --git a/src/basic/architecture.c b/src/basic/architecture.c -index 85837b5..3807ea5 100644 ---- a/src/basic/architecture.c -+++ b/src/basic/architecture.c -@@ -118,6 +118,8 @@ int uname_architecture(void) { - #elif defined(__arc__) - { "arc", ARCHITECTURE_ARC }, - { "arceb", ARCHITECTURE_ARC_BE }, -+#elif defined(__loongarch64) -+ { "loongarch64", ARCHITECTURE_LOONGARCH64 }, - #else - #error "Please register your architecture here!" - #endif -@@ -173,6 +175,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { - [ARCHITECTURE_RISCV64] = "riscv64", - [ARCHITECTURE_ARC] = "arc", - [ARCHITECTURE_ARC_BE] = "arc-be", -+ [ARCHITECTURE_LOONGARCH64] = "loongarch64", - }; - - DEFINE_STRING_TABLE_LOOKUP(architecture, int); -diff --git a/src/basic/architecture.h b/src/basic/architecture.h -index 443e890..935622c 100644 ---- a/src/basic/architecture.h -+++ b/src/basic/architecture.h -@@ -44,6 +44,7 @@ enum { - ARCHITECTURE_RISCV64, - ARCHITECTURE_ARC, - ARCHITECTURE_ARC_BE, -+ ARCHITECTURE_LOONGARCH64, - _ARCHITECTURE_MAX, - _ARCHITECTURE_INVALID = -1 - }; -@@ -229,6 +230,9 @@ int uname_architecture(void); - # define native_architecture() ARCHITECTURE_ARC - # define LIB_ARCH_TUPLE "arc-linux" - # endif -+#elif defined(__loongarch64) -+# define native_architecture() ARCHITECTURE_LOONGARCH64 -+# define LIB_ARCH_TUPLE "loongarch64-linux-gnu" - #else - # error "Please register your architecture here!" - #endif --- -2.27.0 - diff --git a/systemd.spec b/systemd.spec index e1bd3e8..1ad8a84 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,5 +1,3 @@ -%define anolis_release .0.2 - #global gitcommit 10e465b5321bd53c1fc59ffab27e724535c6bc0f %{?gitcommit:%global gitcommitshort %(c=%{gitcommit}; echo ${c:0:7})} @@ -15,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 51%{anolis_release}%{?dist} +Release: 51%{?dist}.3 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -710,21 +708,17 @@ Patch0655: 0655-udev-do-not-try-to-reassign-alternative-names.patch Patch0656: 0656-Fix-LGTM-build.patch Patch0657: 0657-sd-hwdb-allow-empty-properties.patch Patch0658: 0658-Update-hwdb.patch +Patch0659: 0659-sd-event-take-ref-on-event-loop-object-before-dispat.patch +Patch0660: 0660-pid1-fix-free-of-uninitialized-pointer-in-unit_fail_.patch +Patch0661: 0661-Disable-iptables-for-CI.patch +Patch0662: 0662-test-seccomp-accept-ENOSYS-from-sysctl-2-too.patch +Patch0663: 0663-Disable-libpitc-to-fix-CentOS-Stream-CI.patch +Patch0664: 0664-test-accept-that-char-device-0-0-can-now-be-created-.patch +Patch0665: 0665-core-return-true-from-cg_is_empty-on-ENOENT.patch +Patch0666: 0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch +Patch0667: 0667-meson-avoid-bogus-meson-warning.patch +Patch0668: 0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch -Patch1002: 1002-core-fix-a-null-reference-case-in-load_from_path.patch -Patch1003: 1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch -Patch1004: 1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch -Patch1005: 1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch -Patch1006: 1006-strv-rework-FOREACH_STRING-macro.patch -Patch1007: 1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch -Patch1008: 1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch -Patch1009: 1009-Do-not-go-into-freeze-when-systemd-crashd.patch -Patch1010: 1010-mount-setup-change-the-system-mount-propagation-to-s.patch -Patch1011: 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch -Patch1012: 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch -Patch1013: 1013-cgroup-update-only-siblings-that-got-realized-once.patch -Patch1014: 1014-core-add-a-config-item-to-support-setting-the-value-.patch -Patch1015: 1015-systemd-anolis-support-loongarch64.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1351,23 +1345,21 @@ fi %files tests -f .file-list-tests %changelog -* Tue Jan 25 2022 zhangwenlong - 239-51.0.2 -- support loongarch for systemd - -* Tue Jan 18 2022 Yuanhong Peng - 239-51.0.1 -- core: fix a null reference case in load_from_path() -- sysctl: Don't pass null directive argument to '%s' -- test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA -- test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIR -- strv: rework FOREACH_STRING() macro -- exit-status: introduce EXIT_EXCEPTION mapping to 255 -- main: don't freeze PID 1 in containers, exit with non-zero instead -- Do not go into freeze when systemd crashd -- mount-setup: change the system mount propagation to shared by default only at bootup -- mount: don't propagate errors from mount_setup_unit() further up -- cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned -- cgroup: update only siblings that got realized once -- core: add a config item to support setting the value of cpuset.clone_children when systemd is starting +* Fri Dec 10 2021 systemd maintenance team - 239-51.3 +- Do not fail if the same alt. name is set again (#2030027) +- meson: avoid bogus meson warning (#2030027) +- meson: do not fail if rsync is not installed with meson 0.57.2 (#2030027) + +* Fri Dec 03 2021 systemd maintenance team - 239-51.2 +- core: return true from cg_is_empty* on ENOENT (#2024903) + +* Wed Dec 01 2021 systemd maintenance team - 239-51.1 +- sd-event: take ref on event loop object before dispatching event sources (#2024903) +- pid1: fix free of uninitialized pointer in unit_fail_if_noncanonical() (#2024903) +- Disable iptables for CI (#2024903) +- test-seccomp: accept ENOSYS from sysctl(2) too (#2024903) +- Disable libpitc to fix CentOS Stream CI (#2024903) +- test: accept that char device 0/0 can now be created witout privileges (#2024903) * Thu Sep 23 2021 systemd maintenance team - 239-51 - define newly needed constants (#1850986) -- Gitee From 3b3d89658252ea1990574df6d1877c8011946291 Mon Sep 17 00:00:00 2001 From: Yuanhong Peng Date: Tue, 14 Dec 2021 15:45:16 +0800 Subject: [PATCH 2/3] Add optimized patches - core: fix a null reference case in load_from_path() - sysctl: Don't pass null directive argument to '%s' - test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA - test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIR - strv: rework FOREACH_STRING() macro - exit-status: introduce EXIT_EXCEPTION mapping to 255 - main: don't freeze PID 1 in containers, exit with non-zero instead - Do not go into freeze when systemd crashd - mount-setup: change the system mount propagation to shared by default only at bootup - mount: don't propagate errors from mount_setup_unit() further up - cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned - cgroup: update only siblings that got realized once - core: add a config item to support setting the value of cpuset.clone_children when systemd is starting Signed-off-by: Yuanhong Peng Signed-off-by: ZhouWeitao --- ...ull-reference-case-in-load_from_path.patch | 34 ++++ ...-t-pass-null-directive-argument-to-s.patch | 30 +++ ...r-systemd-runtest.env-to-set-SYSTEMD.patch | 171 ++++++++++++++++++ ...r-systemd-runtest.env-for-SYSTEMD_CA.patch | 139 ++++++++++++++ 1006-strv-rework-FOREACH_STRING-macro.patch | 50 +++++ ...roduce-EXIT_EXCEPTION-mapping-to-255.patch | 61 +++++++ ...e-PID-1-in-containers-exit-with-non-.patch | 59 ++++++ ...t-go-into-freeze-when-systemd-crashd.patch | 111 ++++++++++++ ...ge-the-system-mount-propagation-to-s.patch | 77 ++++++++ ...agate-errors-from-mount_setup_unit-f.patch | 57 ++++++ ...-definition-of-CGROUP_CONTROLLER_TO_.patch | 32 ++++ ...only-siblings-that-got-realized-once.patch | 67 +++++++ ...g-item-to-support-setting-the-value-.patch | 121 +++++++++++++ systemd.spec | 32 +++- 14 files changed, 1040 insertions(+), 1 deletion(-) create mode 100644 1002-core-fix-a-null-reference-case-in-load_from_path.patch create mode 100644 1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch create mode 100644 1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch create mode 100644 1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch create mode 100644 1006-strv-rework-FOREACH_STRING-macro.patch create mode 100644 1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch create mode 100644 1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch create mode 100644 1009-Do-not-go-into-freeze-when-systemd-crashd.patch create mode 100644 1010-mount-setup-change-the-system-mount-propagation-to-s.patch create mode 100644 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch create mode 100644 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch create mode 100644 1013-cgroup-update-only-siblings-that-got-realized-once.patch create mode 100644 1014-core-add-a-config-item-to-support-setting-the-value-.patch diff --git a/1002-core-fix-a-null-reference-case-in-load_from_path.patch b/1002-core-fix-a-null-reference-case-in-load_from_path.patch new file mode 100644 index 0000000..9da687e --- /dev/null +++ b/1002-core-fix-a-null-reference-case-in-load_from_path.patch @@ -0,0 +1,34 @@ +From 3262f6c71165c309605dd87c88c7daf7dd300e6f Mon Sep 17 00:00:00 2001 +From: Wen Yang +Date: Mon, 1 Jun 2020 17:06:53 +0800 +Subject: [PATCH] core: fix a null reference case in load_from_path() + +--- + src/core/load-fragment.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c +index 33fdb82754..be5d3c2816 100644 +--- a/src/core/load-fragment.c ++++ b/src/core/load-fragment.c +@@ -4415,7 +4415,6 @@ static int load_from_path(Unit *u, const char *path) { + r = open_follow(&filename, &f, symlink_names, &id); + if (r >= 0) + break; +- filename = mfree(filename); + + /* ENOENT means that the file is missing or is a dangling symlink. + * ENOTDIR means that one of paths we expect to be is a directory +@@ -4424,7 +4423,8 @@ static int load_from_path(Unit *u, const char *path) { + */ + if (r == -EACCES) + log_debug_errno(r, "Cannot access \"%s\": %m", filename); +- else if (!IN_SET(r, -ENOENT, -ENOTDIR)) ++ filename = mfree(filename); ++ if (!IN_SET(r, -ENOENT, -ENOTDIR)) + return r; + + /* Empty the symlink names for the next run */ +-- +2.18.1 + diff --git a/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch b/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch new file mode 100644 index 0000000..ebf2592 --- /dev/null +++ b/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch @@ -0,0 +1,30 @@ +From 74dbb8676dcc35c9b1431254142b3cf24ac7e1a4 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 16 Dec 2018 20:53:38 -0800 +Subject: [PATCH] sysctl: Don't pass null directive argument to '%s' + +value pointer here is always NULL but subsequent use of that pointer +with a %s format will always be NULL, printing p instead would be a +valid string + +Signed-off-by: Khem Raj +--- + src/sysctl/sysctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c +index 0151f7dabe..61447bb72e 100644 +--- a/src/sysctl/sysctl.c ++++ b/src/sysctl/sysctl.c +@@ -112,7 +112,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign + + value = strchr(p, '='); + if (!value) { +- log_error("Line is not an assignment at '%s:%u': %s", path, c, value); ++ log_error("Line is not an assignment at '%s:%u': %s", path, c, p); + + if (r == 0) + r = -EINVAL; +-- +2.18.1 + diff --git a/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch b/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch new file mode 100644 index 0000000..f5edab5 --- /dev/null +++ b/1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch @@ -0,0 +1,171 @@ +From 89bb4cdeae7903e58fe11431fb51f8d995deb0a3 Mon Sep 17 00:00:00 2001 +From: Filipe Brandenburger +Date: Tue, 11 Sep 2018 23:55:02 -0700 +Subject: [PATCH] test: use ${builddir}/systemd-runtest.env to set + $SYSTEMD_TEST_DATA + +This simplifies get_testdata_dir() to simply checking for an environment +variable, with an additional function to locate a systemd-runtest.env file in +the same directory as the test binary and reading environment variable +assignments from that file if it exists. + +This makes it possible to: +- Run `ninja test` from the build dir and have it use ${srcdir}/test for + test unit definitions. +- Run a test directly, such as `build/test-execute` and have it locate + them correctly. +- Run installed tests (from systemd-tests package) and locate the test + units in the installed location (/usr/lib/systemd/tests/testdata), in + which case the absence of the systemd-runtest.env file will have + get_testdata_dir() use the installed location hardcoded into the + binaries. + +Explicit setting of $SYSTEMD_TEST_DATA still overrides the contents of +systemd-runtest.env. + +Signed-off-by: Wen Yang +(cherry picked from commit e2d413707fc68ed033a83e10a055ca638a1e1e18) +--- + meson.build | 10 ++++++- + src/shared/tests.c | 67 ++++++++++++++++++++++------------------------ + 2 files changed, 41 insertions(+), 36 deletions(-) + +diff --git a/meson.build b/meson.build +index 0ba3f924ea..8c4549640b 100644 +--- a/meson.build ++++ b/meson.build +@@ -213,6 +213,7 @@ conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) + conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) + conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) + conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) ++conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) + conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) + conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) + conf.set_quoted('LIBDIR', libdir) +@@ -229,7 +230,6 @@ conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_ + conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no') + + conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) +-conf.set_quoted('ABS_SRC_DIR', meson.source_root()) + + substs.set('prefix', prefixdir) + substs.set('exec_prefix', prefixdir) +@@ -2592,6 +2592,14 @@ executable('systemd-sulogin-shell', + + ############################################################ + ++custom_target( ++ 'systemd-runtest.env', ++ output : 'systemd-runtest.env', ++ command : ['sh', '-c', '{ ' + ++ 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(meson.current_source_dir(), 'test')) + ++ '} >@OUTPUT@'], ++ build_by_default : true) ++ + foreach tuple : tests + sources = tuple[0] + link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] +diff --git a/src/shared/tests.c b/src/shared/tests.c +index 100b62b9b0..102b343fef 100644 +--- a/src/shared/tests.c ++++ b/src/shared/tests.c +@@ -6,8 +6,11 @@ + #include + #include + +-#include "tests.h" ++#include "alloc-util.h" ++#include "fileio.h" + #include "path-util.h" ++#include "strv.h" ++#include "tests.h" + + char* setup_fake_runtime_dir(void) { + char t[] = "/tmp/fake-xdg-runtime-XXXXXX", *p; +@@ -19,55 +22,49 @@ char* setup_fake_runtime_dir(void) { + return p; + } + +-bool test_is_running_from_builddir(char **exedir) { ++static void load_testdata_env(void) { ++ static bool called = false; + _cleanup_free_ char *s = NULL; +- bool r; ++ _cleanup_free_ char *envpath = NULL; ++ _cleanup_strv_free_ char **pairs = NULL; ++ char **k, **v; + +- /* Check if we're running from the builddir. Optionally, this returns +- * the path to the directory where the binary is located. */ ++ if (called) ++ return; ++ called = true; + + assert_se(readlink_and_make_absolute("/proc/self/exe", &s) >= 0); +- r = path_startswith(s, ABS_BUILD_DIR); ++ dirname(s); + +- if (exedir) { +- dirname(s); +- *exedir = TAKE_PTR(s); +- } ++ envpath = path_join(NULL, s, "systemd-runtest.env"); ++ if (load_env_file_pairs(NULL, envpath, NULL, &pairs) < 0) ++ return; + +- return r; ++ STRV_FOREACH_PAIR(k, v, pairs) ++ setenv(*k, *v, 0); ++} ++ ++bool test_is_running_from_builddir(char **exedir) { ++ load_testdata_env(); ++ ++ return !!getenv("SYSTEMD_TEST_DATA"); + } + + const char* get_testdata_dir(void) { + const char *env; +- /* convenience: caller does not need to free result */ +- static char testdir[PATH_MAX]; ++ ++ load_testdata_env(); + + /* if the env var is set, use that */ + env = getenv("SYSTEMD_TEST_DATA"); +- testdir[sizeof(testdir) - 1] = '\0'; +- if (env) { +- if (access(env, F_OK) < 0) { +- fputs("ERROR: $SYSTEMD_TEST_DATA directory does not exist\n", stderr); +- exit(EXIT_FAILURE); +- } +- strncpy(testdir, env, sizeof(testdir) - 1); +- } else { +- _cleanup_free_ char *exedir = NULL; +- +- /* Check if we're running from the builddir. If so, use the compiled in path. */ +- if (test_is_running_from_builddir(&exedir)) +- assert_se(snprintf(testdir, sizeof(testdir), "%s/test", ABS_SRC_DIR) > 0); +- else +- /* Try relative path, according to the install-test layout */ +- assert_se(snprintf(testdir, sizeof(testdir), "%s/testdata", exedir) > 0); +- +- if (access(testdir, F_OK) < 0) { +- fputs("ERROR: Cannot find testdata directory, set $SYSTEMD_TEST_DATA\n", stderr); +- exit(EXIT_FAILURE); +- } ++ if (!env) ++ env = SYSTEMD_TEST_DATA; ++ if (access(env, F_OK) < 0) { ++ fprintf(stderr, "ERROR: $SYSTEMD_TEST_DATA directory [%s] does not exist\n", env); ++ exit(EXIT_FAILURE); + } + +- return testdir; ++ return env; + } + + void test_setup_logging(int level) { +-- +2.18.1 + diff --git a/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch b/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch new file mode 100644 index 0000000..b74edb7 --- /dev/null +++ b/1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch @@ -0,0 +1,139 @@ +From c5e249d9eaabaeebc3ac447462d50adec3245f2f Mon Sep 17 00:00:00 2001 +From: Filipe Brandenburger +Date: Wed, 12 Sep 2018 00:23:40 -0700 +Subject: [PATCH] test: use ${builddir}/systemd-runtest.env for + $SYSTEMD_CATALOG_DIR + +This makes it so that tests no longer need to know the absolute paths to the +source and build dirs, instead using the systemd-runtest.env file to get these +paths when running from the build tree. + +Confirmed that test-catalog works on `ninja test`, when called standalone and +also when the environment file is not present, in which case it will use the +installed location under /usr/lib/systemd/catalog. + +The location can now also be overridden for this test by setting the +$SYSTEMD_CATALOG_DIR environment variable. + +Signed-off-by: Wen Yang +(cherry picked from commit fef716b28be6e866b8afe995805d5ebe2af6bbfa) +--- + meson.build | 4 ++-- + src/journal/test-catalog.c | 6 +----- + src/shared/tests.c | 22 ++++++++++++++++------ + src/shared/tests.h | 2 +- + src/test/meson.build | 3 +-- + 5 files changed, 21 insertions(+), 16 deletions(-) + +diff --git a/meson.build b/meson.build +index 8c4549640b..cf6990a50e 100644 +--- a/meson.build ++++ b/meson.build +@@ -214,6 +214,7 @@ conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) + conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) + conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) + conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) ++conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir) + conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) + conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) + conf.set_quoted('LIBDIR', libdir) +@@ -229,8 +230,6 @@ conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdata + conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false') + conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no') + +-conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) +- + substs.set('prefix', prefixdir) + substs.set('exec_prefix', prefixdir) + substs.set('libdir', libdir) +@@ -2597,6 +2596,7 @@ custom_target( + output : 'systemd-runtest.env', + command : ['sh', '-c', '{ ' + + 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(meson.current_source_dir(), 'test')) + ++ 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(meson.current_build_dir(), 'catalog')) + + '} >@OUTPUT@'], + build_by_default : true) + +diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c +index 0c4da29f31..d9ee557b9c 100644 +--- a/src/journal/test-catalog.c ++++ b/src/journal/test-catalog.c +@@ -212,11 +212,7 @@ int main(int argc, char *argv[]) { + + /* If test-catalog is located at the build directory, then use catalogs in that. + * If it is not, e.g. installed by systemd-tests package, then use installed catalogs. */ +- if (test_is_running_from_builddir(NULL)) { +- assert_se(catalog_dir = path_join(NULL, ABS_BUILD_DIR, "catalog")); +- catalog_dirs = STRV_MAKE(catalog_dir); +- } else +- catalog_dirs = STRV_MAKE(CATALOG_DIR); ++ catalog_dirs = STRV_MAKE(get_catalog_dir()); + + assert_se(access(catalog_dirs[0], F_OK) >= 0); + log_notice("Using catalog directory '%s'", catalog_dirs[0]); +diff --git a/src/shared/tests.c b/src/shared/tests.c +index 102b343fef..7bd6f806b9 100644 +--- a/src/shared/tests.c ++++ b/src/shared/tests.c +@@ -44,12 +44,6 @@ static void load_testdata_env(void) { + setenv(*k, *v, 0); + } + +-bool test_is_running_from_builddir(char **exedir) { +- load_testdata_env(); +- +- return !!getenv("SYSTEMD_TEST_DATA"); +-} +- + const char* get_testdata_dir(void) { + const char *env; + +@@ -72,3 +66,19 @@ void test_setup_logging(int level) { + log_parse_environment(); + log_open(); + } ++ ++const char* get_catalog_dir(void) { ++ const char *env; ++ ++ load_testdata_env(); ++ ++ /* if the env var is set, use that */ ++ env = getenv("SYSTEMD_CATALOG_DIR"); ++ if (!env) ++ env = SYSTEMD_CATALOG_DIR; ++ if (access(env, F_OK) < 0) { ++ fprintf(stderr, "ERROR: $SYSTEMD_CATALOG_DIR directory [%s] does not exist\n", env); ++ exit(EXIT_FAILURE); ++ } ++ return env; ++} +diff --git a/src/shared/tests.h b/src/shared/tests.h +index 3d696d02fd..19a9fa0fee 100644 +--- a/src/shared/tests.h ++++ b/src/shared/tests.h +@@ -2,6 +2,6 @@ + #pragma once + + char* setup_fake_runtime_dir(void); +-bool test_is_running_from_builddir(char **exedir); + const char* get_testdata_dir(void); ++const char* get_catalog_dir(void); + void test_setup_logging(int level); +diff --git a/src/test/meson.build b/src/test/meson.build +index 7b310d4ec7..b4b9e8a60e 100644 +--- a/src/test/meson.build ++++ b/src/test/meson.build +@@ -776,8 +776,7 @@ tests += [ + libshared], + [threads, + libxz, +- liblz4], +- '', '', '-DCATALOG_DIR="@0@"'.format(catalogdir)], ++ liblz4]], + + [['src/journal/test-compress.c'], + [libjournal_core, +-- +2.18.1 + diff --git a/1006-strv-rework-FOREACH_STRING-macro.patch b/1006-strv-rework-FOREACH_STRING-macro.patch new file mode 100644 index 0000000..7d8bcf2 --- /dev/null +++ b/1006-strv-rework-FOREACH_STRING-macro.patch @@ -0,0 +1,50 @@ +From f3ae2e70053c5145cdd9750b577f5d86077c7271 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 2 Jun 2020 02:48:29 +0000 +Subject: [PATCH] strv: rework FOREACH_STRING() macro + +upstream commit 66a64081f82dfad90f2f9394a477820a2e3e6510 + +So it's apparently problematic that we use STRV_MAKE() (i.e. a compound +initializer) outside of the {} block we use it in (and that includes +outside of the ({}) block, too). Hence, let's rework the macro to not +need that. + +This also makes the macro shorter, which is definitely a good and more +readable. Moreover, it will now complain if the iterator is a "char*" +instead of a "const char*", which is good too. + +Fixes: #11394 +--- + src/basic/strv.h | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/src/basic/strv.h b/src/basic/strv.h +index c1e4c97..a09d767 100644 +--- a/src/basic/strv.h ++++ b/src/basic/strv.h +@@ -148,17 +148,10 @@ void strv_print(char **l); + _found; \ + }) + +-#define FOREACH_STRING(x, ...) \ +- for (char **_l = ({ \ +- char **_ll = STRV_MAKE(__VA_ARGS__); \ +- x = _ll ? _ll[0] : NULL; \ +- _ll; \ +- }); \ +- _l && *_l; \ +- x = ({ \ +- _l ++; \ +- _l[0]; \ +- })) ++#define FOREACH_STRING(x, y, ...) \ ++ for (char **_l = STRV_MAKE(({ x = y; }), ##__VA_ARGS__); \ ++ x; \ ++ x = *(++_l)) + + char **strv_reverse(char **l); + char **strv_shell_escape(char **l, const char *bad); +-- +2.18.1 + diff --git a/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch b/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch new file mode 100644 index 0000000..eeb47f7 --- /dev/null +++ b/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch @@ -0,0 +1,61 @@ +From 7188a29295f3a6f2c8e0a7c5a5ae4914088ee6fc Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 20 Nov 2018 16:55:51 +0100 +Subject: [PATCH] exit-status: introduce EXIT_EXCEPTION mapping to 255 + +cherry-picked from upstream 3584d3ca. + +Conflicts: + src/basic/exit-status.c + src/basic/exit-status.h + +Signed-off-by: Yuanhong Peng +--- + src/basic/exit-status.c | 10 +++++++--- + src/basic/exit-status.h | 2 ++ + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/basic/exit-status.c b/src/basic/exit-status.c +index 0a7a53b73d..58ebc3ca4d 100644 +--- a/src/basic/exit-status.c ++++ b/src/basic/exit-status.c +@@ -19,9 +19,10 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { + * 79…199 │ (Currently unmapped) + * 200…241 │ systemd's private error codes (might be extended to 254 in future development) + * 242…254 │ (Currently unmapped, but see above) +- * 255 │ (We should probably stay away from that one, it's frequently used by applications to indicate an +- * │ exit reason that cannot really be expressed in a single exit status value — such as a propagated +- * │ signal or such) ++ * ++ * 255 │ EXIT_EXCEPTION (We use this to propagate exit-by-signal events. It's frequently used by others apps (like bash) ++ * │ to indicate exit reason that cannot really be expressed in a single exit status value — such as a propagated ++ * │ signal or such, and we follow that logic here.) + */ + + switch (status) { /* We always cover the ISO C ones */ +@@ -158,6 +159,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { + + case EXIT_NUMA_POLICY: + return "NUMA_POLICY"; ++ ++ case EXIT_EXCEPTION: ++ return "EXCEPTION"; + } + } + +diff --git a/src/basic/exit-status.h b/src/basic/exit-status.h +index dc284aacb1..5637e6aa04 100644 +--- a/src/basic/exit-status.h ++++ b/src/basic/exit-status.h +@@ -70,6 +70,8 @@ enum { + EXIT_LOGS_DIRECTORY, /* 240 */ + EXIT_CONFIGURATION_DIRECTORY, + EXIT_NUMA_POLICY, ++ ++ EXIT_EXCEPTION = 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */ + }; + + typedef enum ExitStatusLevel { +-- +2.18.1 + diff --git a/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch b/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch new file mode 100644 index 0000000..94923e1 --- /dev/null +++ b/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch @@ -0,0 +1,59 @@ +From 6c76e460aed00997766a638fa8b40cc1b17a14d5 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 20 Nov 2018 13:16:48 +0100 +Subject: [PATCH] main: don't freeze PID 1 in containers, exit with + non-zero instead + +After all we have a nice way to propagate total failures, hence let's +use it. + +cherry-picked from upstream bb259772 without conflict. + +Signed-off-by: Yuanhong Peng +--- + src/core/main.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index 25536054b3..1ecdc47446 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -139,7 +139,14 @@ static NUMAPolicy arg_numa_policy; + static int parse_configuration(const struct rlimit *saved_rlimit_nofile, + const struct rlimit *saved_rlimit_memlock); + +-_noreturn_ static void freeze_or_reboot(void) { ++_noreturn_ static void freeze_or_exit_or_reboot(void) { ++ ++ /* If we are running in a contianer, let's prefer exiting, after all we can propagate an exit code to the ++ * container manager, and thus inform it that something went wrong. */ ++ if (detect_container() > 0) { ++ log_emergency("Exiting PID 1..."); ++ exit(EXIT_EXCEPTION); ++ } + + if (arg_crash_reboot) { + log_notice("Rebooting in 10s..."); +@@ -247,7 +254,7 @@ _noreturn_ static void crash(int sig) { + } + } + +- freeze_or_reboot(); ++ freeze_or_exit_or_reboot(); + } + + static void install_crash_handler(void) { +@@ -2664,8 +2671,8 @@ finish: + if (error_message) + manager_status_printf(NULL, STATUS_TYPE_EMERGENCY, + ANSI_HIGHLIGHT_RED "!!!!!!" ANSI_NORMAL, +- "%s, freezing.", error_message); +- freeze_or_reboot(); ++ "%s.", error_message); ++ freeze_or_exit_or_reboot(); + } + + return retval; +-- +2.18.1 + diff --git a/1009-Do-not-go-into-freeze-when-systemd-crashd.patch b/1009-Do-not-go-into-freeze-when-systemd-crashd.patch new file mode 100644 index 0000000..2b457bc --- /dev/null +++ b/1009-Do-not-go-into-freeze-when-systemd-crashd.patch @@ -0,0 +1,111 @@ +From d05802b22fda63164a1f12a60ebf726a44fbecb4 Mon Sep 17 00:00:00 2001 +From: Yuanhong Peng +Date: Mon, 14 Dec 2020 17:04:28 +0800 +Subject: [PATCH] Do not go into freeze when systemd crashd + +If something unexpected happens which cause systemd to freeze, the system +cannot resume without a reboot, furthermore, if a service dies or exits, +no one else can recycle all child processes of the service, which will +cause a number of zombie processes remaining in the system. So we +introduce a mechanism, when systemd enters freeze state, you can send +SIGTERM to it to force systemd to re-exec. This may helps to resume the +system if it cannot reboot. + +Signed-off-by: Yuanhong Peng +--- + src/core/main.c | 40 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 39 insertions(+), 1 deletion(-) + +diff --git a/src/core/main.c b/src/core/main.c +index 1ecdc47446..a72c685b20 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -10,6 +11,7 @@ + #include + #include + #include ++#include + #include + #if HAVE_SECCOMP + #include +@@ -135,10 +137,41 @@ static sd_id128_t arg_machine_id; + static EmergencyAction arg_cad_burst_action; + static CPUSet arg_cpu_affinity; + static NUMAPolicy arg_numa_policy; ++static bool reexec_jmp_can = false; ++static bool reexec_jmp_inited = false; ++static sigjmp_buf reexec_jmp_buf; + + static int parse_configuration(const struct rlimit *saved_rlimit_nofile, + const struct rlimit *saved_rlimit_memlock); + ++static void reexec_handler(int sig) { ++ reexec_jmp_can = true; ++} ++ ++_noreturn_ static void freeze_wait_upgrade(void) { ++ struct sigaction sa; ++ sigset_t ss; ++ ++ sigemptyset(&ss); ++ sigaddset(&ss, SIGTERM); ++ sigprocmask(SIG_UNBLOCK, &ss, NULL); ++ ++ sa.sa_handler = reexec_handler; ++ sa.sa_flags = SA_RESTART; ++ sigaction(SIGTERM, &sa, NULL); ++ ++ log_error("freeze_wait_upgrade: %d\n", reexec_jmp_inited); ++ reexec_jmp_can = false; ++ while(1) { ++ usleep(10000); ++ if (reexec_jmp_inited && reexec_jmp_can) { ++ log_error("goto manager_reexecute.\n"); ++ siglongjmp(reexec_jmp_buf, 1); ++ } ++ waitpid(-1, NULL, WNOHANG); ++ } ++} ++ + _noreturn_ static void freeze_or_exit_or_reboot(void) { + + /* If we are running in a contianer, let's prefer exiting, after all we can propagate an exit code to the +@@ -158,7 +191,7 @@ _noreturn_ static void freeze_or_exit_or_reboot(void) { + } + + log_emergency("Freezing execution."); +- freeze(); ++ freeze_wait_upgrade(); + } + + _noreturn_ static void crash(int sig) { +@@ -1668,6 +1701,10 @@ static int invoke_main_loop( + assert(ret_switch_root_init); + assert(ret_error_message); + ++ reexec_jmp_inited = true; ++ if (sigsetjmp(reexec_jmp_buf, 1)) ++ goto manager_reexecute; ++ + for (;;) { + r = manager_loop(m); + if (r < 0) { +@@ -1710,6 +1747,7 @@ static int invoke_main_loop( + + case MANAGER_REEXECUTE: + ++manager_reexecute: + r = prepare_reexecute(m, &arg_serialization, ret_fds, false); + if (r < 0) { + *ret_error_message = "Failed to prepare for reexecution"; +-- +2.18.1 + diff --git a/1010-mount-setup-change-the-system-mount-propagation-to-s.patch b/1010-mount-setup-change-the-system-mount-propagation-to-s.patch new file mode 100644 index 0000000..4066dfd --- /dev/null +++ b/1010-mount-setup-change-the-system-mount-propagation-to-s.patch @@ -0,0 +1,77 @@ +From bdd65129e7fbd09c7e0c1fd7fbaffeb9b0b81e1d Mon Sep 17 00:00:00 2001 +From: Wen Yang +Date: Mon, 23 Mar 2020 10:42:46 +0800 +Subject: [PATCH] mount-setup: change the system mount propagation to + shared by default only at bootup + +The commit b3ac5f8cb987 has changed the system mount propagation to +shared by default, and according to the following patch: +https://github.com/opencontainers/runc/pull/208 +When starting the container, the pouch daemon will call runc to execute +make-private. + +However, if the systemctl daemon-reexec is executed after the container +has been started, the system mount propagation will be changed to share +again by default, and the make-private operation above will have no chance +to execute. + +cherry-picked from upstream f74349d8 without conflict. + +Signed-off-by: Yuanhong Peng +--- + src/core/main.c | 2 +- + src/core/mount-setup.c | 4 ++-- + src/core/mount-setup.h | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index a72c685b20..55c54aecd5 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -2519,7 +2519,7 @@ int main(int argc, char *argv[]) { + if (!skip_setup) + kmod_setup(); + +- r = mount_setup(loaded_policy); ++ r = mount_setup(loaded_policy, skip_setup); + if (r < 0) { + error_message = "Failed to mount API filesystems"; + goto finish; +diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c +index b3cf13af2b..ff7fc18765 100644 +--- a/src/core/mount-setup.c ++++ b/src/core/mount-setup.c +@@ -400,7 +400,7 @@ static int relabel_cgroup_filesystems(void) { + } + #endif + +-int mount_setup(bool loaded_policy) { ++int mount_setup(bool loaded_policy, bool leave_propagation) { + int r = 0; + + r = mount_points_setup(ELEMENTSOF(mount_table), loaded_policy); +@@ -444,7 +444,7 @@ int mount_setup(bool loaded_policy) { + * needed. Note that we set this only when we are invoked directly by the kernel. If we are invoked by a + * container manager we assume the container manager knows what it is doing (for example, because it set up + * some directories with different propagation modes). */ +- if (detect_container() <= 0) ++ if (detect_container() <= 0 && !leave_propagation) + if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0) + log_warning_errno(errno, "Failed to set up the root directory for shared mount propagation: %m"); + +diff --git a/src/core/mount-setup.h b/src/core/mount-setup.h +index 43cd8908de..7a011b25c8 100644 +--- a/src/core/mount-setup.h ++++ b/src/core/mount-setup.h +@@ -4,7 +4,7 @@ + #include + + int mount_setup_early(void); +-int mount_setup(bool loaded_policy); ++int mount_setup(bool loaded_policy, bool leave_propagation); + + int mount_cgroup_controllers(char ***join_controllers); + +-- +2.18.1 + diff --git a/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch b/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch new file mode 100644 index 0000000..cbbec36 --- /dev/null +++ b/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch @@ -0,0 +1,57 @@ +From 66ccec10af5ac97fa0528a309119f98e4eff44a7 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 28 Nov 2018 12:41:44 +0100 +Subject: [PATCH] mount: don't propagate errors from mount_setup_unit() further + up + +If we can't process a specific line in /proc/self/mountinfo we should +log about it (which we do), but this should not affect other lines, nor +further processing of mount units. Let's keep these failures local. + +Fixes: #10874 + +cherry-picked from upstream ba0d56f5. + +Conflicts: + src/core/mount.c + +Signed-off-by: Yuanhong Peng +--- + src/core/mount.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 7e80a0c..9b1c59b 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1621,12 +1621,10 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { + if (r < 0) + return log_error_errno(r, "Failed to parse /proc/self/mountinfo: %m"); + +- r = 0; + for (;;) { + struct libmnt_fs *fs; + const char *device, *path, *options, *fstype; + _cleanup_free_ char *d = NULL, *p = NULL; +- int k; + + r = mnt_table_next_fs(table, iter, &fs); + if (r == 1) +@@ -1650,12 +1648,10 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { + + device_found_node(m, d, DEVICE_FOUND_MOUNT, DEVICE_FOUND_MOUNT); + +- k = mount_setup_unit(m, d, p, options, fstype, set_flags); +- if (r == 0 && k < 0) +- r = k; ++ (void) mount_setup_unit(m, d, p, options, fstype, set_flags); + } + +- return r; ++ return 0; + } + + static void mount_shutdown(Manager *m) { +-- +2.27.0 + diff --git a/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch b/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch new file mode 100644 index 0000000..7936d17 --- /dev/null +++ b/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch @@ -0,0 +1,32 @@ +From 334dddc80cb53561c49f9a7b4e5237a6451a9964 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 26 Oct 2018 15:31:30 +0200 +Subject: [PATCH] cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned + +Otherwise doing comparing a CGroupMask (which is unsigned in effect) +with the result of CGROUP_CONTROLLER_TO_MASK() will result in warnings +about signedness differences. + +cherry-picked from upstream 46f84f95 without conflict. + +Signed-off-by: Yuanhong Peng +--- + src/basic/cgroup-util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h +index 1210b38a83..76659c3790 100644 +--- a/src/basic/cgroup-util.h ++++ b/src/basic/cgroup-util.h +@@ -31,7 +31,7 @@ typedef enum CGroupController { + _CGROUP_CONTROLLER_INVALID = -1, + } CGroupController; + +-#define CGROUP_CONTROLLER_TO_MASK(c) (1 << (c)) ++#define CGROUP_CONTROLLER_TO_MASK(c) (1U << (c)) + + /* A bit mask of well known cgroup controllers */ + typedef enum CGroupMask { +-- +2.18.1 + diff --git a/1013-cgroup-update-only-siblings-that-got-realized-once.patch b/1013-cgroup-update-only-siblings-that-got-realized-once.patch new file mode 100644 index 0000000..cd83cd1 --- /dev/null +++ b/1013-cgroup-update-only-siblings-that-got-realized-once.patch @@ -0,0 +1,67 @@ +From 18561b46343c94af359d74a48c34974739b46eeb Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 13 Jan 2020 20:06:39 +0100 +Subject: [PATCH] cgroup: update only siblings that got realized once + +Fixes: #14475 +Replaces: #14554 + +cherry-picked from upstream e1e98911 without conflict. + +Signed-off-by: Yuanhong Peng +--- + src/core/cgroup.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index e0eb184fd2..00121e3f37 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -1964,7 +1964,15 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { + Unit *slice; + + /* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup +- * queue. (But neither the specified unit itself nor the parents.) */ ++ * queue. (But neither the specified unit itself nor the parents.) ++ * ++ * Propagation of realization "side-ways" (i.e. towards siblings) is in relevant on cgroup-v1 where ++ * scheduling become very weird if two units that own processes reside in the same slice, but one is ++ * realized in the "cpu" hierarchy and once is not (for example because one has CPUWeight= set and ++ * the other does not), because that means processes need to be scheduled against groups. Let's avoid ++ * this asymmetry by always ensuring that units below a slice that are realized at all are hence ++ * always realized in *all* their hierarchies, and it is sufficient for a unit's sibling to be ++ * realized for a unit to be realized too. */ + + while ((slice = UNIT_DEREF(u->slice))) { + Iterator i; +@@ -1972,6 +1980,7 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { + void *v; + + HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) { ++ + /* Skip units that have a dependency on the slice but aren't actually in it. */ + if (UNIT_DEREF(m->slice) != slice) + continue; +@@ -1980,6 +1989,11 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { + if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m))) + continue; + ++ /* We only enqueue siblings if they were realized once at least, in the main ++ * hierarchy. */ ++ if (!m->cgroup_realized) ++ continue; ++ + /* If the unit doesn't need any new controllers and has current ones realized, it + * doesn't need any changes. */ + if (unit_has_mask_realized(m, +@@ -2264,6 +2278,7 @@ void unit_add_to_cgroup_empty_queue(Unit *u) { + /* Let's verify that the cgroup is really empty */ + if (!u->cgroup_path) + return; ++ + r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path); + if (r < 0) { + log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", u->cgroup_path); +-- +2.18.1 + diff --git a/1014-core-add-a-config-item-to-support-setting-the-value-.patch b/1014-core-add-a-config-item-to-support-setting-the-value-.patch new file mode 100644 index 0000000..08d87b1 --- /dev/null +++ b/1014-core-add-a-config-item-to-support-setting-the-value-.patch @@ -0,0 +1,121 @@ +From 729300a386ee380406b6ea92e0924877066b1a3d Mon Sep 17 00:00:00 2001 +From: Yuanhong Peng +Date: Tue, 15 Dec 2020 11:47:49 +0800 +Subject: [PATCH] core: add a config item to support setting the value + of cpuset.clone_children when systemd is starting + +Signed-off-by: Yuanhong Peng +--- + src/core/main.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + +diff --git a/src/core/main.c b/src/core/main.c +index 55c54aecd5..f241707842 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -140,6 +140,7 @@ static NUMAPolicy arg_numa_policy; + static bool reexec_jmp_can = false; + static bool reexec_jmp_inited = false; + static sigjmp_buf reexec_jmp_buf; ++static bool arg_default_cpuset_clone_children = false; + + static int parse_configuration(const struct rlimit *saved_rlimit_nofile, + const struct rlimit *saved_rlimit_memlock); +@@ -528,6 +529,14 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat + + parse_path_argument_and_warn(value, false, &arg_watchdog_device); + ++ } else if (proc_cmdline_key_streq(key, "systemd.cpuset_clone_children") && value) { ++ ++ r = parse_boolean(value); ++ if (r < 0) ++ log_warning("Failed to parse cpuset_clone_children switch %s. Ignoring.", value); ++ else ++ arg_default_cpuset_clone_children = r; ++ + } else if (streq(key, "quiet") && !value) { + + if (arg_show_status == _SHOW_STATUS_UNSET) +@@ -756,6 +765,7 @@ static int parse_config_file(void) { + { "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting }, + { "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max }, + { "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action }, ++ { "Manager", "DefaultCPUSetCloneChildren",config_parse_bool, 0, &arg_default_cpuset_clone_children }, + {} + }; + +@@ -1872,6 +1882,63 @@ static void log_execution_mode(bool *ret_first_boot) { + } + } + ++static bool is_use_triple_cgroup(void) { ++ const char * path ="/sys/fs/cgroup/cpuset"; ++ _cleanup_strv_free_ char **l = NULL; ++ char buf[128] = {0}; ++ int r; ++ ++ r = is_symlink(path); ++ if (r <= 0) ++ return false; ++ ++ r = readlink(path, buf, sizeof(buf)); ++ if (r < 0 || (unsigned int)r >= sizeof(buf)) ++ return false; ++ ++ buf[r] = '\0'; ++ l = strv_split(buf, ","); ++ if (!l) ++ return false; ++ ++ strv_sort(l); ++ if (strv_length(l) != 3) ++ return false; ++ ++ if (streq(l[0],"cpu") && streq(l[1], "cpuacct") && ++ streq(l[2], "cpuset")) { ++ log_debug(PACKAGE_STRING " use_triple_cgroup: %s", buf); ++ return true; ++ } ++ return false; ++} ++ ++static int ali_handle_cpuset_clone_children(void) ++{ ++ const char *file = "/sys/fs/cgroup/cpuset/cgroup.clone_children"; ++ _cleanup_free_ char *buf = NULL; ++ int r; ++ ++ r = read_one_line_file(file, &buf); ++ if (r < 0) { ++ log_warning_errno(r, "Cannot read %s: %m", file); ++ return r; ++ } ++ ++ if (streq(buf, "1") && arg_default_cpuset_clone_children) ++ return 0; ++ ++ if (streq(buf, "0") && (!arg_default_cpuset_clone_children)) ++ return 0; ++ ++ if (!is_use_triple_cgroup()) ++ return 0; ++ ++ r = write_string_file(file, one_zero(arg_default_cpuset_clone_children), 0); ++ log_info(PACKAGE_STRING " set %s to %s, ret=%d", file, one_zero(arg_default_cpuset_clone_children), r); ++ return r; ++} ++ + static int initialize_runtime( + bool skip_setup, + struct rlimit *saved_rlimit_nofile, +@@ -1906,6 +1973,7 @@ static int initialize_runtime( + return r; + } + ++ ali_handle_cpuset_clone_children(); + status_welcome(); + hostname_setup(); + machine_id_setup(NULL, arg_machine_id, NULL); +-- +2.18.1 + diff --git a/systemd.spec b/systemd.spec index 1ad8a84..d356d91 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,3 +1,5 @@ +%define anolis_release .0.1 + #global gitcommit 10e465b5321bd53c1fc59ffab27e724535c6bc0f %{?gitcommit:%global gitcommitshort %(c=%{gitcommit}; echo ${c:0:7})} @@ -13,7 +15,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 51%{?dist}.3 +Release: 51%{anolis_release}%{?dist}.3 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -719,6 +721,19 @@ Patch0666: 0666-Do-not-fail-if-the-same-alt.-name-is-set-again.patch Patch0667: 0667-meson-avoid-bogus-meson-warning.patch Patch0668: 0668-meson-do-not-fail-if-rsync-is-not-installed-with-mes.patch +Patch1002: 1002-core-fix-a-null-reference-case-in-load_from_path.patch +Patch1003: 1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch +Patch1004: 1004-test-use-builddir-systemd-runtest.env-to-set-SYSTEMD.patch +Patch1005: 1005-test-use-builddir-systemd-runtest.env-for-SYSTEMD_CA.patch +Patch1006: 1006-strv-rework-FOREACH_STRING-macro.patch +Patch1007: 1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch +Patch1008: 1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch +Patch1009: 1009-Do-not-go-into-freeze-when-systemd-crashd.patch +Patch1010: 1010-mount-setup-change-the-system-mount-propagation-to-s.patch +Patch1011: 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch +Patch1012: 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch +Patch1013: 1013-cgroup-update-only-siblings-that-got-realized-once.patch +Patch1014: 1014-core-add-a-config-item-to-support-setting-the-value-.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1345,6 +1360,21 @@ fi %files tests -f .file-list-tests %changelog +* Tue Jan 18 2022 Yuanhong Peng - 239-51.3.0.1 +- core: fix a null reference case in load_from_path() +- sysctl: Don't pass null directive argument to '%s' +- test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA +- test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIR +- strv: rework FOREACH_STRING() macro +- exit-status: introduce EXIT_EXCEPTION mapping to 255 +- main: don't freeze PID 1 in containers, exit with non-zero instead +- Do not go into freeze when systemd crashd +- mount-setup: change the system mount propagation to shared by default only at bootup +- mount: don't propagate errors from mount_setup_unit() further up +- cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned +- cgroup: update only siblings that got realized once +- core: add a config item to support setting the value of cpuset.clone_children when systemd is starting + * Fri Dec 10 2021 systemd maintenance team - 239-51.3 - Do not fail if the same alt. name is set again (#2030027) - meson: avoid bogus meson warning (#2030027) -- Gitee From 3dbedd99ae735358f188472e1c012d167df3f1b9 Mon Sep 17 00:00:00 2001 From: gongwen Date: Sun, 29 Aug 2021 10:56:49 +0800 Subject: [PATCH 3/3] support loongarch Signed-off-by: Yuanhong Peng --- 1015-systemd-anolis-support-loongarch64.patch | 56 +++++++++++++++++++ systemd.spec | 6 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 1015-systemd-anolis-support-loongarch64.patch diff --git a/1015-systemd-anolis-support-loongarch64.patch b/1015-systemd-anolis-support-loongarch64.patch new file mode 100644 index 0000000..8f23b97 --- /dev/null +++ b/1015-systemd-anolis-support-loongarch64.patch @@ -0,0 +1,56 @@ +From bd646124c244f6de65cd829b33f5912c1d540bb4 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Fri, 6 Aug 2021 08:15:19 +0000 +Subject: [PATCH] support loongarch64 for systemd + +--- + src/basic/architecture.c | 3 +++ + src/basic/architecture.h | 4 ++++ + 2 files changed, 7 insertions(+) + +diff --git a/src/basic/architecture.c b/src/basic/architecture.c +index 85837b5..3807ea5 100644 +--- a/src/basic/architecture.c ++++ b/src/basic/architecture.c +@@ -118,6 +118,8 @@ int uname_architecture(void) { + #elif defined(__arc__) + { "arc", ARCHITECTURE_ARC }, + { "arceb", ARCHITECTURE_ARC_BE }, ++#elif defined(__loongarch64) ++ { "loongarch64", ARCHITECTURE_LOONGARCH64 }, + #else + #error "Please register your architecture here!" + #endif +@@ -173,6 +175,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { + [ARCHITECTURE_RISCV64] = "riscv64", + [ARCHITECTURE_ARC] = "arc", + [ARCHITECTURE_ARC_BE] = "arc-be", ++ [ARCHITECTURE_LOONGARCH64] = "loongarch64", + }; + + DEFINE_STRING_TABLE_LOOKUP(architecture, int); +diff --git a/src/basic/architecture.h b/src/basic/architecture.h +index 443e890..935622c 100644 +--- a/src/basic/architecture.h ++++ b/src/basic/architecture.h +@@ -44,6 +44,7 @@ enum { + ARCHITECTURE_RISCV64, + ARCHITECTURE_ARC, + ARCHITECTURE_ARC_BE, ++ ARCHITECTURE_LOONGARCH64, + _ARCHITECTURE_MAX, + _ARCHITECTURE_INVALID = -1 + }; +@@ -229,6 +230,9 @@ int uname_architecture(void); + # define native_architecture() ARCHITECTURE_ARC + # define LIB_ARCH_TUPLE "arc-linux" + # endif ++#elif defined(__loongarch64) ++# define native_architecture() ARCHITECTURE_LOONGARCH64 ++# define LIB_ARCH_TUPLE "loongarch64-linux-gnu" + #else + # error "Please register your architecture here!" + #endif +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index d356d91..67e3821 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 #global gitcommit 10e465b5321bd53c1fc59ffab27e724535c6bc0f %{?gitcommit:%global gitcommitshort %(c=%{gitcommit}; echo ${c:0:7})} @@ -734,6 +734,7 @@ Patch1011: 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch Patch1012: 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch Patch1013: 1013-cgroup-update-only-siblings-that-got-realized-once.patch Patch1014: 1014-core-add-a-config-item-to-support-setting-the-value-.patch +Patch1015: 1015-systemd-anolis-support-loongarch64.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1360,6 +1361,9 @@ fi %files tests -f .file-list-tests %changelog +* Tue Jan 25 2022 zhangwenlong - 239-51.3.0.2 +- support loongarch for systemd + * Tue Jan 18 2022 Yuanhong Peng - 239-51.3.0.1 - core: fix a null reference case in load_from_path() - sysctl: Don't pass null directive argument to '%s' -- Gitee