diff --git a/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch b/0669-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch similarity index 87% rename from 1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch rename to 0669-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch index cbbec36e461fbb2badb177866ac2e615d7c7342a..670c4434d7b2e0f05ce999f619da06a210e2b02b 100644 --- a/1011-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch +++ b/0669-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch @@ -1,4 +1,4 @@ -From 66ccec10af5ac97fa0528a309119f98e4eff44a7 Mon Sep 17 00:00:00 2001 +From 4662575605089b38d611a911c03c60ec260fde05 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 @@ -10,18 +10,15 @@ further processing of mount units. Let's keep these failures local. Fixes: #10874 -cherry-picked from upstream ba0d56f5. +(cherry picked from commit ba0d56f55f2073164799be714b5bd1aad94d059a) -Conflicts: - src/core/mount.c - -Signed-off-by: Yuanhong Peng +Resolves: #2039327 --- 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 +index 7e80a0c974..9b1c59b1c3 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) { @@ -52,6 +49,3 @@ index 7e80a0c..9b1c59b 100644 } static void mount_shutdown(Manager *m) { --- -2.27.0 - diff --git a/0670-test-make-TEST-47-less-racy.patch b/0670-test-make-TEST-47-less-racy.patch new file mode 100644 index 0000000000000000000000000000000000000000..e5c9f8867fd7694bcc3285c0862a7a371a4b3305 --- /dev/null +++ b/0670-test-make-TEST-47-less-racy.patch @@ -0,0 +1,35 @@ +From a423abe6a3914364c36d4299c1b770fdbe376834 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Wed, 15 Dec 2021 12:15:19 +0100 +Subject: [PATCH] test: make TEST-47 less racy + +Based on: + - 2e7090e94d0c8b31d418555ab2f6a9b75318f6a4 + - e00e2e0b50bbd120290572c8d1242703fb98b34e + - 197298ff9fc930de450330095cc5b67d165d0801 + +Related: #2039327 + +(cherry picked from commit de7125dcfe6d6c8af05262ab786f9fe7cbf15113) +--- + test/TEST-47-ISSUE-14566/testsuite.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/test/TEST-47-ISSUE-14566/testsuite.sh b/test/TEST-47-ISSUE-14566/testsuite.sh +index d917cf52ff..b12b50e96c 100755 +--- a/test/TEST-47-ISSUE-14566/testsuite.sh ++++ b/test/TEST-47-ISSUE-14566/testsuite.sh +@@ -6,11 +6,13 @@ systemd-analyze log-level debug + systemd-analyze log-target console + + systemctl start issue_14566_test ++sleep 4 + systemctl status issue_14566_test + + leaked_pid=$(cat /leakedtestpid) + + systemctl stop issue_14566_test ++sleep 4 + + # Leaked PID will still be around if we're buggy. + # I personally prefer to see 42. diff --git a/0671-macro-define-HAS_FEATURE_ADDRESS_SANITIZER-also-on-g.patch b/0671-macro-define-HAS_FEATURE_ADDRESS_SANITIZER-also-on-g.patch new file mode 100644 index 0000000000000000000000000000000000000000..ed2f3d5854b761b811469ef39ec7f1b1db5c03c1 --- /dev/null +++ b/0671-macro-define-HAS_FEATURE_ADDRESS_SANITIZER-also-on-g.patch @@ -0,0 +1,38 @@ +From c132731b260174f5939099ceb4fccde84710c502 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 3 Dec 2018 17:30:19 +0100 +Subject: [PATCH] macro: define HAS_FEATURE_ADDRESS_SANITIZER also on gcc + +Let's make differences between compilers more minimal. + +Related: #2039327 + +(cherry picked from commit 01da36fadd365329cfd9e2c97eb419c63404b25f) +--- + src/basic/macro.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/basic/macro.h b/src/basic/macro.h +index 0fe6a62aa8..e87026882f 100644 +--- a/src/basic/macro.h ++++ b/src/basic/macro.h +@@ -55,6 +55,19 @@ + # endif + #endif + ++#if !defined(HAS_FEATURE_ADDRESS_SANITIZER) ++# ifdef __SANITIZE_ADDRESS__ ++# define HAS_FEATURE_ADDRESS_SANITIZER 1 ++# elif defined(__has_feature) ++# if __has_feature(address_sanitizer) ++# define HAS_FEATURE_ADDRESS_SANITIZER 1 ++# endif ++# endif ++# if !defined(HAS_FEATURE_ADDRESS_SANITIZER) ++# define HAS_FEATURE_ADDRESS_SANITIZER 0 ++# endif ++#endif ++ + /* Temporarily disable some warnings */ + #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT \ + _Pragma("GCC diagnostic push"); \ diff --git a/0672-tests-add-helper-function-to-autodetect-CI-environme.patch b/0672-tests-add-helper-function-to-autodetect-CI-environme.patch new file mode 100644 index 0000000000000000000000000000000000000000..01d87096cd6d8171a47de42297ab838211f97098 --- /dev/null +++ b/0672-tests-add-helper-function-to-autodetect-CI-environme.patch @@ -0,0 +1,104 @@ +From ccdf0a116dcba01ec4d8caec0baef2910d8d9800 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 29 Nov 2021 13:00:21 +0100 +Subject: [PATCH] tests: add helper function to autodetect CI environments + +Sadly there is no standarized way to check if we're running in some +CI environment. So let's try to gather the heuristics in one helper +function. + +(cherry picked from commit 6fbbf368f5a6d181b21f448255d5a4182dc2ab3a) + +Related: #2039327 +--- + src/basic/string-util.h | 6 ++++++ + src/shared/tests.c | 42 +++++++++++++++++++++++++++++++++++++++++ + src/shared/tests.h | 3 +++ + 3 files changed, 51 insertions(+) + +diff --git a/src/basic/string-util.h b/src/basic/string-util.h +index 96a9260f93..742b566932 100644 +--- a/src/basic/string-util.h ++++ b/src/basic/string-util.h +@@ -32,6 +32,12 @@ static inline bool streq_ptr(const char *a, const char *b) { + return strcmp_ptr(a, b) == 0; + } + ++static inline char* strstr_ptr(const char *haystack, const char *needle) { ++ if (!haystack || !needle) ++ return NULL; ++ return strstr(haystack, needle); ++} ++ + static inline const char* strempty(const char *s) { + return s ?: ""; + } +diff --git a/src/shared/tests.c b/src/shared/tests.c +index 100b62b9b0..1da80d653f 100644 +--- a/src/shared/tests.c ++++ b/src/shared/tests.c +@@ -7,7 +7,9 @@ + #include + + #include "tests.h" ++#include "env-util.h" + #include "path-util.h" ++#include "strv.h" + + char* setup_fake_runtime_dir(void) { + char t[] = "/tmp/fake-xdg-runtime-XXXXXX", *p; +@@ -75,3 +77,43 @@ void test_setup_logging(int level) { + log_parse_environment(); + log_open(); + } ++ ++const char *ci_environment(void) { ++ /* We return a string because we might want to provide multiple bits of information later on: not ++ * just the general CI environment type, but also whether we're sanitizing or not, etc. The caller is ++ * expected to use strstr on the returned value. */ ++ static const char *ans = (void*) UINTPTR_MAX; ++ const char *p; ++ int r; ++ ++ if (ans != (void*) UINTPTR_MAX) ++ return ans; ++ ++ /* We allow specifying the environment with $CITYPE. Nobody uses this so far, but we are ready. */ ++ p = getenv("CITYPE"); ++ if (!isempty(p)) ++ return (ans = p); ++ ++ if (getenv_bool("TRAVIS") > 0) ++ return (ans = "travis"); ++ if (getenv_bool("SEMAPHORE") > 0) ++ return (ans = "semaphore"); ++ if (getenv_bool("GITHUB_ACTIONS") > 0) ++ return (ans = "github-actions"); ++ if (getenv("AUTOPKGTEST_ARTIFACTS") || getenv("AUTOPKGTEST_TMP")) ++ return (ans = "autopkgtest"); ++ ++ FOREACH_STRING(p, "CI", "CONTINOUS_INTEGRATION") { ++ /* Those vars are booleans according to Semaphore and Travis docs: ++ * https://docs.travis-ci.com/user/environment-variables/#default-environment-variables ++ * https://docs.semaphoreci.com/ci-cd-environment/environment-variables/#ci ++ */ ++ r = getenv_bool(p); ++ if (r > 0) ++ return (ans = "unknown"); /* Some other unknown thing */ ++ if (r == 0) ++ return (ans = NULL); ++ } ++ ++ return (ans = NULL); ++} +diff --git a/src/shared/tests.h b/src/shared/tests.h +index 3d696d02fd..4f8f349097 100644 +--- a/src/shared/tests.h ++++ b/src/shared/tests.h +@@ -5,3 +5,6 @@ char* setup_fake_runtime_dir(void); + bool test_is_running_from_builddir(char **exedir); + const char* get_testdata_dir(void); + void test_setup_logging(int level); ++ ++/* Provide a convenient way to check if we're running in CI. */ ++const char *ci_environment(void); diff --git a/1006-strv-rework-FOREACH_STRING-macro.patch b/0673-strv-rework-FOREACH_STRING-macro.patch similarity index 86% rename from 1006-strv-rework-FOREACH_STRING-macro.patch rename to 0673-strv-rework-FOREACH_STRING-macro.patch index 7d8bcf2e5c8193e777292cfa21f82e8196be28fa..ca1493171778357df68ee53f30c3561ebb38bfaa 100644 --- a/1006-strv-rework-FOREACH_STRING-macro.patch +++ b/0673-strv-rework-FOREACH_STRING-macro.patch @@ -1,10 +1,8 @@ -From f3ae2e70053c5145cdd9750b577f5d86077c7271 Mon Sep 17 00:00:00 2001 +From ad8b47946941e6a1f3ae778f5e8563ddf532b2ba Mon Sep 17 00:00:00 2001 From: Lennart Poettering -Date: Tue, 2 Jun 2020 02:48:29 +0000 +Date: Wed, 16 Jan 2019 00:13:38 +0100 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 @@ -15,12 +13,17 @@ readable. Moreover, it will now complain if the iterator is a "char*" instead of a "const char*", which is good too. Fixes: #11394 +(cherry picked from commit 66a64081f82dfad90f2f9394a477820a2e3e6510) + +(cherry picked from commit 3539a72c260063713e4ecba17966ba9a768d8af9) + +Related: #2039327 --- 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 +index c1e4c973b6..a09d76706d 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -148,17 +148,10 @@ void strv_print(char **l); @@ -45,6 +48,3 @@ index c1e4c97..a09d767 100644 char **strv_reverse(char **l); char **strv_shell_escape(char **l, const char *bad); --- -2.18.1 - diff --git a/0674-test-systemctl-use-const-char-instead-of-char.patch b/0674-test-systemctl-use-const-char-instead-of-char.patch new file mode 100644 index 0000000000000000000000000000000000000000..da4898deca29bcefc22d87941bfa5bb7e3b938c6 --- /dev/null +++ b/0674-test-systemctl-use-const-char-instead-of-char.patch @@ -0,0 +1,47 @@ +From 5a45664f9b5d2ba7550ed1c12550554688b70f5c Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 29 Nov 2021 13:47:24 +0100 +Subject: [PATCH] test,systemctl: use "const char*" instead of "char*" + +as iterator for FOREACH_STRING() + +The macro iterates through literal strings (i.e. constant strings), +hence it's more correct to have the iterator const too. + +Based on b2238e380e5f2fbcc129643b3fbd66f2828fd57c. + +(cherry picked from commit fdfff847313222eed3306ac605db46d8cbd23212) + +Related: #2039327 +--- + src/systemctl/systemctl.c | 3 ++- + src/test/test-execute.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 3dd7c1522f..b967550b97 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -7011,7 +7011,8 @@ static int run_editor(char **paths) { + if (r == 0) { + const char **args; + char *editor, **editor_args = NULL; +- char **tmp_path, **original_path, *p; ++ char **tmp_path, **original_path; ++ const char *p; + size_t n_editor_args = 0, i = 1; + size_t argc; + +diff --git a/src/test/test-execute.c b/src/test/test-execute.c +index 294f8fe7dd..4d21301982 100644 +--- a/src/test/test-execute.c ++++ b/src/test/test-execute.c +@@ -146,7 +146,7 @@ invalid: + } + + static bool is_inaccessible_available(void) { +- char *p; ++ const char *p; + + FOREACH_STRING(p, + "/run/systemd/inaccessible/reg", diff --git a/0675-ci-pass-the-GITHUB_ACTIONS-variable-to-the-CentOS-co.patch b/0675-ci-pass-the-GITHUB_ACTIONS-variable-to-the-CentOS-co.patch new file mode 100644 index 0000000000000000000000000000000000000000..6d1f06d7cd6db879a3add65572ff0e6645f222f8 --- /dev/null +++ b/0675-ci-pass-the-GITHUB_ACTIONS-variable-to-the-CentOS-co.patch @@ -0,0 +1,29 @@ +From d9542b919237306baee2d2396794f63da67b1314 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 29 Nov 2021 13:59:41 +0100 +Subject: [PATCH] ci: pass the $GITHUB_ACTIONS variable to the CentOS container + +so we can properly skip tests which are problematic when running in GH +Actions. + +Related: #2039327 +rhel-only + +(cherry picked from commit a8fd8d157c832ddad34a9a3e372579c58261f7fb) +--- + .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 814870e7a0..c1311310fb 100755 +--- a/.github/workflows/unit_tests.sh ++++ b/.github/workflows/unit_tests.sh +@@ -131,7 +131,7 @@ for phase in "${PHASES[@]}"; do + # Pull a Docker image and start a new container + docker pull quay.io/centos/centos:$CENTOS_RELEASE + info "Starting container $CONT_NAME" +- $DOCKER_RUN -v $REPO_ROOT:/build:rw \ ++ $DOCKER_RUN -v $REPO_ROOT:/build:rw -e GITHUB_ACTIONS="$GITHUB_ACTIONS" \ + -w /build --privileged=true --name $CONT_NAME \ + -dit --net=host quay.io/centos/centos:$CENTOS_RELEASE /sbin/init + diff --git a/0676-core-rename-unit_-start_limit-condition-assert-_test.patch b/0676-core-rename-unit_-start_limit-condition-assert-_test.patch new file mode 100644 index 0000000000000000000000000000000000000000..0913a4958f23a68a6522b6286a9ff3832a57efde --- /dev/null +++ b/0676-core-rename-unit_-start_limit-condition-assert-_test.patch @@ -0,0 +1,179 @@ +From f1f0eb4d262e91830324de3f99fa58cd154a7876 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 18 Mar 2019 12:21:27 +0100 +Subject: [PATCH] core: rename unit_{start_limit|condition|assert}_test() to + unit_test_xyz() + +Just some renaming, no change in behaviour. + +Background: I'd like to add more functions unit_test_xyz() that test +various things, hence let's streamline the naming a bit. + +(cherry picked from commit 97a3f4ee052e1b8a0ff03accfa478e352891a84f) + +Related: #2037395 +--- + src/core/automount.c | 2 +- + src/core/mount.c | 2 +- + src/core/path.c | 2 +- + src/core/service.c | 2 +- + src/core/socket.c | 2 +- + src/core/swap.c | 2 +- + src/core/timer.c | 2 +- + src/core/unit.c | 11 +++++------ + src/core/unit.h | 2 +- + 9 files changed, 13 insertions(+), 14 deletions(-) + +diff --git a/src/core/automount.c b/src/core/automount.c +index 76e70f4dac..2bc160cb07 100644 +--- a/src/core/automount.c ++++ b/src/core/automount.c +@@ -808,7 +808,7 @@ static int automount_start(Unit *u) { + return -ENOENT; + } + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + automount_enter_dead(a, AUTOMOUNT_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/mount.c b/src/core/mount.c +index 9b1c59b1c3..4cb49d845d 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1065,7 +1065,7 @@ static int mount_start(Unit *u) { + + assert(IN_SET(m->state, MOUNT_DEAD, MOUNT_FAILED)); + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/path.c b/src/core/path.c +index ed40bc6c19..4bccc0396b 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -565,7 +565,7 @@ static int path_start(Unit *u) { + return -ENOENT; + } + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + path_enter_dead(p, PATH_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/service.c b/src/core/service.c +index 5e3e75b5ae..01cb1a375e 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -2357,7 +2357,7 @@ static int service_start(Unit *u) { + assert(IN_SET(s->state, SERVICE_DEAD, SERVICE_FAILED)); + + /* Make sure we don't enter a busy loop of some kind. */ +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false); + return r; +diff --git a/src/core/socket.c b/src/core/socket.c +index 50c32ed8f4..09491c6677 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -2469,7 +2469,7 @@ static int socket_start(Unit *u) { + + assert(IN_SET(s->state, SOCKET_DEAD, SOCKET_FAILED)); + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + socket_enter_dead(s, SOCKET_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/swap.c b/src/core/swap.c +index a8f127f660..823699699e 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -851,7 +851,7 @@ static int swap_start(Unit *u) { + if (UNIT(other)->job && UNIT(other)->job->state == JOB_RUNNING) + return -EAGAIN; + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/timer.c b/src/core/timer.c +index 1718ffc5a5..be16321296 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -599,7 +599,7 @@ static int timer_start(Unit *u) { + return -ENOENT; + } + +- r = unit_start_limit_test(u); ++ r = unit_test_start_limit(u); + if (r < 0) { + timer_enter_dead(t, TIMER_FAILURE_START_LIMIT_HIT); + return r; +diff --git a/src/core/unit.c b/src/core/unit.c +index 152a860d08..fa94a67fdd 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -1633,7 +1633,7 @@ static bool unit_condition_test_list(Unit *u, Condition *first, const char *(*to + return triggered != 0; + } + +-static bool unit_condition_test(Unit *u) { ++static bool unit_test_condition(Unit *u) { + assert(u); + + dual_timestamp_get(&u->condition_timestamp); +@@ -1642,7 +1642,7 @@ static bool unit_condition_test(Unit *u) { + return u->condition_result; + } + +-static bool unit_assert_test(Unit *u) { ++static bool unit_test_assert(Unit *u) { + assert(u); + + dual_timestamp_get(&u->assert_timestamp); +@@ -1657,8 +1657,7 @@ void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg + REENABLE_WARNING; + } + +- +-int unit_start_limit_test(Unit *u) { ++int unit_test_start_limit(Unit *u) { + assert(u); + + if (ratelimit_below(&u->start_limit)) { +@@ -1748,14 +1747,14 @@ int unit_start(Unit *u) { + * speed up activation in case there is some hold-off time, + * but we don't want to recheck the condition in that case. */ + if (state != UNIT_ACTIVATING && +- !unit_condition_test(u)) { ++ !unit_test_condition(u)) { + log_unit_debug(u, "Starting requested but condition failed. Not starting unit."); + return -EALREADY; + } + + /* If the asserts failed, fail the entire job */ + if (state != UNIT_ACTIVATING && +- !unit_assert_test(u)) { ++ !unit_test_assert(u)) { + log_unit_notice(u, "Starting requested but asserts failed."); + return -EPROTO; + } +diff --git a/src/core/unit.h b/src/core/unit.h +index ec45b5fb48..a8bc350b66 100644 +--- a/src/core/unit.h ++++ b/src/core/unit.h +@@ -786,7 +786,7 @@ static inline bool unit_supported(Unit *u) { + void unit_warn_if_dir_nonempty(Unit *u, const char* where); + int unit_fail_if_noncanonical(Unit *u, const char* where); + +-int unit_start_limit_test(Unit *u); ++int unit_test_start_limit(Unit *u); + + void unit_unref_uid(Unit *u, bool destroy_now); + int unit_ref_uid(Unit *u, uid_t uid, bool clean_ipc); diff --git a/0677-core-Check-unit-start-rate-limiting-earlier.patch b/0677-core-Check-unit-start-rate-limiting-earlier.patch new file mode 100644 index 0000000000000000000000000000000000000000..0f792d0688e9f3fe2390233e730bd8e4672b3b62 --- /dev/null +++ b/0677-core-Check-unit-start-rate-limiting-earlier.patch @@ -0,0 +1,400 @@ +From 6f3b6308bb5705fdcadec3f4cac105211bc0a3e2 Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Tue, 24 Aug 2021 16:46:47 +0100 +Subject: [PATCH] core: Check unit start rate limiting earlier + +Fixes #17433. Currently, if any of the validations we do before we +check start rate limiting fail, we can still enter a busy loop as +no rate limiting gets applied. A common occurence of this scenario +is path units triggering a service that fails a condition check. + +To fix the issue, we simply move up start rate limiting checks to +be the first thing we do when starting a unit. To achieve this, +we add a new method to the unit vtable and implement it for the +relevant unit types so that we can do the start rate limit checks +earlier on. + +(cherry picked from commit 9727f2427ff6b2e1f4ab927cc57ad8e888f04e95) + +Related: #2037395 + +[msekleta: I've deleted part of the original commit that adds test for +issue #17433. This was necessary because upstream commit assumes newer +organization of the test code which we don't have in RHEL-8 tree. As +a consequence we must add explicit test for this in the internal +test-suite.] +--- + src/core/automount.c | 23 +++++++++++++++++------ + src/core/mount.c | 23 +++++++++++++++++------ + src/core/path.c | 23 +++++++++++++++++------ + src/core/service.c | 25 ++++++++++++++++++------- + src/core/socket.c | 23 +++++++++++++++++------ + src/core/swap.c | 23 +++++++++++++++++------ + src/core/timer.c | 22 ++++++++++++++++------ + src/core/unit.c | 14 ++++++++++---- + src/core/unit.h | 4 ++++ + 9 files changed, 133 insertions(+), 47 deletions(-) + +diff --git a/src/core/automount.c b/src/core/automount.c +index 2bc160cb07..5e16adabb5 100644 +--- a/src/core/automount.c ++++ b/src/core/automount.c +@@ -808,12 +808,6 @@ static int automount_start(Unit *u) { + return -ENOENT; + } + +- r = unit_test_start_limit(u); +- if (r < 0) { +- automount_enter_dead(a, AUTOMOUNT_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -1077,6 +1071,21 @@ static bool automount_supported(void) { + return supported; + } + ++static int automount_test_start_limit(Unit *u) { ++ Automount *a = AUTOMOUNT(u); ++ int r; ++ ++ assert(a); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ automount_enter_dead(a, AUTOMOUNT_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const automount_result_table[_AUTOMOUNT_RESULT_MAX] = { + [AUTOMOUNT_SUCCESS] = "success", + [AUTOMOUNT_FAILURE_RESOURCES] = "resources", +@@ -1135,4 +1144,6 @@ const UnitVTable automount_vtable = { + [JOB_FAILED] = "Failed to unset automount %s.", + }, + }, ++ ++ .test_start_limit = automount_test_start_limit, + }; +diff --git a/src/core/mount.c b/src/core/mount.c +index 4cb49d845d..619f64d5b7 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1065,12 +1065,6 @@ static int mount_start(Unit *u) { + + assert(IN_SET(m->state, MOUNT_DEAD, MOUNT_FAILED)); + +- r = unit_test_start_limit(u); +- if (r < 0) { +- mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -1953,6 +1947,21 @@ static int mount_control_pid(Unit *u) { + return m->control_pid; + } + ++static int mount_test_start_limit(Unit *u) { ++ Mount *m = MOUNT(u); ++ int r; ++ ++ assert(m); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const mount_exec_command_table[_MOUNT_EXEC_COMMAND_MAX] = { + [MOUNT_EXEC_MOUNT] = "ExecMount", + [MOUNT_EXEC_UNMOUNT] = "ExecUnmount", +@@ -2044,4 +2053,6 @@ const UnitVTable mount_vtable = { + [JOB_TIMEOUT] = "Timed out unmounting %s.", + }, + }, ++ ++ .test_start_limit = mount_test_start_limit, + }; +diff --git a/src/core/path.c b/src/core/path.c +index 4bccc0396b..1e69a1f05f 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -565,12 +565,6 @@ static int path_start(Unit *u) { + return -ENOENT; + } + +- r = unit_test_start_limit(u); +- if (r < 0) { +- path_enter_dead(p, PATH_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -730,6 +724,21 @@ static void path_reset_failed(Unit *u) { + p->result = PATH_SUCCESS; + } + ++static int path_test_start_limit(Unit *u) { ++ Path *p = PATH(u); ++ int r; ++ ++ assert(p); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ path_enter_dead(p, PATH_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const path_type_table[_PATH_TYPE_MAX] = { + [PATH_EXISTS] = "PathExists", + [PATH_EXISTS_GLOB] = "PathExistsGlob", +@@ -782,4 +791,6 @@ const UnitVTable path_vtable = { + + .bus_vtable = bus_path_vtable, + .bus_set_property = bus_path_set_property, ++ ++ .test_start_limit = path_test_start_limit, + }; +diff --git a/src/core/service.c b/src/core/service.c +index 01cb1a375e..a21d98ab8f 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -2356,13 +2356,6 @@ static int service_start(Unit *u) { + + assert(IN_SET(s->state, SERVICE_DEAD, SERVICE_FAILED)); + +- /* Make sure we don't enter a busy loop of some kind. */ +- r = unit_test_start_limit(u); +- if (r < 0) { +- service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -4050,6 +4043,22 @@ static bool service_needs_console(Unit *u) { + SERVICE_FINAL_SIGKILL); + } + ++static int service_test_start_limit(Unit *u) { ++ Service *s = SERVICE(u); ++ int r; ++ ++ assert(s); ++ ++ /* Make sure we don't enter a busy loop of some kind. */ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ service_enter_dead(s, SERVICE_FAILURE_START_LIMIT_HIT, false); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const service_restart_table[_SERVICE_RESTART_MAX] = { + [SERVICE_RESTART_NO] = "no", + [SERVICE_RESTART_ON_SUCCESS] = "on-success", +@@ -4191,4 +4200,6 @@ const UnitVTable service_vtable = { + [JOB_FAILED] = "Stopped (with error) %s.", + }, + }, ++ ++ .test_start_limit = service_test_start_limit, + }; +diff --git a/src/core/socket.c b/src/core/socket.c +index 09491c6677..36d2e4f823 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -2469,12 +2469,6 @@ static int socket_start(Unit *u) { + + assert(IN_SET(s->state, SOCKET_DEAD, SOCKET_FAILED)); + +- r = unit_test_start_limit(u); +- if (r < 0) { +- socket_enter_dead(s, SOCKET_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -3267,6 +3261,21 @@ static int socket_control_pid(Unit *u) { + return s->control_pid; + } + ++static int socket_test_start_limit(Unit *u) { ++ Socket *s = SOCKET(u); ++ int r; ++ ++ assert(s); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ socket_enter_dead(s, SOCKET_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const socket_exec_command_table[_SOCKET_EXEC_COMMAND_MAX] = { + [SOCKET_EXEC_START_PRE] = "ExecStartPre", + [SOCKET_EXEC_START_CHOWN] = "ExecStartChown", +@@ -3359,4 +3368,6 @@ const UnitVTable socket_vtable = { + [JOB_TIMEOUT] = "Timed out stopping %s.", + }, + }, ++ ++ .test_start_limit = socket_test_start_limit, + }; +diff --git a/src/core/swap.c b/src/core/swap.c +index 823699699e..90fcd69300 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -851,12 +851,6 @@ static int swap_start(Unit *u) { + if (UNIT(other)->job && UNIT(other)->job->state == JOB_RUNNING) + return -EAGAIN; + +- r = unit_test_start_limit(u); +- if (r < 0) { +- swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -1458,6 +1452,21 @@ static int swap_control_pid(Unit *u) { + return s->control_pid; + } + ++static int swap_test_start_limit(Unit *u) { ++ Swap *s = SWAP(u); ++ int r; ++ ++ assert(s); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const swap_exec_command_table[_SWAP_EXEC_COMMAND_MAX] = { + [SWAP_EXEC_ACTIVATE] = "ExecActivate", + [SWAP_EXEC_DEACTIVATE] = "ExecDeactivate", +@@ -1547,4 +1556,6 @@ const UnitVTable swap_vtable = { + [JOB_TIMEOUT] = "Timed out deactivating swap %s.", + }, + }, ++ ++ .test_start_limit = swap_test_start_limit, + }; +diff --git a/src/core/timer.c b/src/core/timer.c +index be16321296..fb9ae17990 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -599,12 +599,6 @@ static int timer_start(Unit *u) { + return -ENOENT; + } + +- r = unit_test_start_limit(u); +- if (r < 0) { +- timer_enter_dead(t, TIMER_FAILURE_START_LIMIT_HIT); +- return r; +- } +- + r = unit_acquire_invocation_id(u); + if (r < 0) + return r; +@@ -829,6 +823,21 @@ static void timer_timezone_change(Unit *u) { + timer_enter_waiting(t, false); + } + ++static int timer_test_start_limit(Unit *u) { ++ Timer *t = TIMER(u); ++ int r; ++ ++ assert(t); ++ ++ r = unit_test_start_limit(u); ++ if (r < 0) { ++ timer_enter_dead(t, TIMER_FAILURE_START_LIMIT_HIT); ++ return r; ++ } ++ ++ return 0; ++} ++ + static const char* const timer_base_table[_TIMER_BASE_MAX] = { + [TIMER_ACTIVE] = "OnActiveSec", + [TIMER_BOOT] = "OnBootSec", +@@ -884,4 +893,5 @@ const UnitVTable timer_vtable = { + .bus_set_property = bus_timer_set_property, + + .can_transient = true, ++ .test_start_limit = timer_test_start_limit, + }; +diff --git a/src/core/unit.c b/src/core/unit.c +index fa94a67fdd..9005f79df3 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -1726,10 +1726,16 @@ int unit_start(Unit *u) { + + assert(u); + +- /* If this is already started, then this will succeed. Note +- * that this will even succeed if this unit is not startable +- * by the user. This is relied on to detect when we need to +- * wait for units and when waiting is finished. */ ++ /* Check start rate limiting early so that failure conditions don't cause us to enter a busy loop. */ ++ if (UNIT_VTABLE(u)->test_start_limit) { ++ int r = UNIT_VTABLE(u)->test_start_limit(u); ++ if (r < 0) ++ return r; ++ } ++ ++ /* If this is already started, then this will succeed. Note that this will even succeed if this unit ++ * is not startable by the user. This is relied on to detect when we need to wait for units and when ++ * waiting is finished. */ + state = unit_active_state(u); + if (UNIT_IS_ACTIVE_OR_RELOADING(state)) + return -EALREADY; +diff --git a/src/core/unit.h b/src/core/unit.h +index a8bc350b66..9e6f1bcf81 100644 +--- a/src/core/unit.h ++++ b/src/core/unit.h +@@ -567,6 +567,10 @@ typedef struct UnitVTable { + /* The bus vtable */ + const sd_bus_vtable *bus_vtable; + ++ /* If this function is set, it's invoked first as part of starting a unit to allow start rate ++ * limiting checks to occur before we do anything else. */ ++ int (*test_start_limit)(Unit *u); ++ + /* The strings to print in status messages */ + UnitStatusMessageFormats status_message_formats; + diff --git a/0678-sd-event-introduce-callback-invoked-when-event-sourc.patch b/0678-sd-event-introduce-callback-invoked-when-event-sourc.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8b8338b3ed640a56097d622933226ee48da51a3 --- /dev/null +++ b/0678-sd-event-introduce-callback-invoked-when-event-sourc.patch @@ -0,0 +1,226 @@ +From 5f2ee8632f15a8978c522de6789777171e898671 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Mon, 4 Oct 2021 19:44:06 +0200 +Subject: [PATCH] sd-event: introduce callback invoked when event source + ratelimit expires + +(cherry picked from commit fd69f2247520b0be3190ded96d646a415edc97b7) + +Related: #2037395 +--- + src/libsystemd/libsystemd.sym | 5 +++ + src/libsystemd/sd-event/sd-event.c | 61 +++++++++++++++++++++++----- + src/libsystemd/sd-event/test-event.c | 12 ++++++ + src/systemd/sd-event.h | 1 + + 4 files changed, 68 insertions(+), 11 deletions(-) + +diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym +index 149d2e7b82..f4a1426248 100644 +--- a/src/libsystemd/libsystemd.sym ++++ b/src/libsystemd/libsystemd.sym +@@ -579,3 +579,8 @@ global: + sd_event_source_get_ratelimit; + sd_event_source_is_ratelimited; + } LIBSYSTEMD_239; ++ ++LIBSYSTEMD_250 { ++global: ++ sd_event_source_set_ratelimit_expire_callback; ++} LIBSYSTEMD_248; +diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c +index 47cf93b3f4..0adfdd9e1a 100644 +--- a/src/libsystemd/sd-event/sd-event.c ++++ b/src/libsystemd/sd-event/sd-event.c +@@ -125,6 +125,7 @@ struct sd_event_source { + uint64_t prepare_iteration; + + sd_event_destroy_t destroy_callback; ++ sd_event_handler_t ratelimit_expire_callback; + + LIST_FIELDS(sd_event_source, sources); + +@@ -2734,7 +2735,7 @@ fail: + return r; + } + +-static int event_source_leave_ratelimit(sd_event_source *s) { ++static int event_source_leave_ratelimit(sd_event_source *s, bool run_callback) { + int r; + + assert(s); +@@ -2766,6 +2767,23 @@ static int event_source_leave_ratelimit(sd_event_source *s) { + ratelimit_reset(&s->rate_limit); + + log_debug("Event source %p (%s) left rate limit state.", s, strna(s->description)); ++ ++ if (run_callback && s->ratelimit_expire_callback) { ++ s->dispatching = true; ++ r = s->ratelimit_expire_callback(s, s->userdata); ++ s->dispatching = false; ++ ++ if (r < 0) { ++ log_debug_errno(r, "Ratelimit expiry callback of event source %s (type %s) returned error, disabling: %m", ++ strna(s->description), ++ event_source_type_to_string(s->type)); ++ ++ sd_event_source_set_enabled(s, SD_EVENT_OFF); ++ } ++ ++ return 1; ++ } ++ + return 0; + + fail: +@@ -2966,6 +2984,7 @@ static int process_timer( + struct clock_data *d) { + + sd_event_source *s; ++ bool callback_invoked = false; + int r; + + assert(e); +@@ -2981,9 +3000,11 @@ static int process_timer( + * again. */ + assert(s->ratelimited); + +- r = event_source_leave_ratelimit(s); ++ r = event_source_leave_ratelimit(s, /* run_callback */ true); + if (r < 0) + return r; ++ else if (r == 1) ++ callback_invoked = true; + + continue; + } +@@ -2998,7 +3019,7 @@ static int process_timer( + event_source_time_prioq_reshuffle(s); + } + +- return 0; ++ return callback_invoked; + } + + static int process_child(sd_event *e) { +@@ -3698,15 +3719,15 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) { + if (r < 0) + goto finish; + +- r = process_timer(e, e->timestamp.realtime, &e->realtime); ++ r = process_inotify(e); + if (r < 0) + goto finish; + +- r = process_timer(e, e->timestamp.boottime, &e->boottime); ++ r = process_timer(e, e->timestamp.realtime, &e->realtime); + if (r < 0) + goto finish; + +- r = process_timer(e, e->timestamp.monotonic, &e->monotonic); ++ r = process_timer(e, e->timestamp.boottime, &e->boottime); + if (r < 0) + goto finish; + +@@ -3718,16 +3739,27 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) { + if (r < 0) + goto finish; + ++ r = process_timer(e, e->timestamp.monotonic, &e->monotonic); ++ if (r < 0) ++ goto finish; ++ else if (r == 1) { ++ /* Ratelimit expiry callback was called. Let's postpone processing pending sources and ++ * put loop in the initial state in order to evaluate (in the next iteration) also sources ++ * there were potentially re-enabled by the callback. ++ * ++ * Wondering why we treat only this invocation of process_timer() differently? Once event ++ * source is ratelimited we essentially transform it into CLOCK_MONOTONIC timer hence ++ * ratelimit expiry callback is never called for any other timer type. */ ++ r = 0; ++ goto finish; ++ } ++ + if (e->need_process_child) { + r = process_child(e); + if (r < 0) + goto finish; + } + +- r = process_inotify(e); +- if (r < 0) +- goto finish; +- + if (event_next_pending(e)) { + e->state = SD_EVENT_PENDING; + +@@ -4054,7 +4086,7 @@ _public_ int sd_event_source_set_ratelimit(sd_event_source *s, uint64_t interval + + /* When ratelimiting is configured we'll always reset the rate limit state first and start fresh, + * non-ratelimited. */ +- r = event_source_leave_ratelimit(s); ++ r = event_source_leave_ratelimit(s, /* run_callback */ false); + if (r < 0) + return r; + +@@ -4062,6 +4094,13 @@ _public_ int sd_event_source_set_ratelimit(sd_event_source *s, uint64_t interval + return 0; + } + ++_public_ int sd_event_source_set_ratelimit_expire_callback(sd_event_source *s, sd_event_handler_t callback) { ++ assert_return(s, -EINVAL); ++ ++ s->ratelimit_expire_callback = callback; ++ return 0; ++} ++ + _public_ int sd_event_source_get_ratelimit(sd_event_source *s, uint64_t *ret_interval, unsigned *ret_burst) { + assert_return(s, -EINVAL); + +diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c +index e3ee4cd5c3..9135b22839 100644 +--- a/src/libsystemd/sd-event/test-event.c ++++ b/src/libsystemd/sd-event/test-event.c +@@ -506,6 +506,11 @@ static int ratelimit_time_handler(sd_event_source *s, uint64_t usec, void *userd + return 0; + } + ++static int expired = -1; ++static int ratelimit_expired(sd_event_source *s, void *userdata) { ++ return ++expired; ++} ++ + static void test_ratelimit(void) { + _cleanup_close_pair_ int p[2] = {-1, -1}; + _cleanup_(sd_event_unrefp) sd_event *e = NULL; +@@ -568,12 +573,19 @@ static void test_ratelimit(void) { + + assert_se(sd_event_source_set_ratelimit(s, 1 * USEC_PER_SEC, 10) >= 0); + ++ /* Set callback that will be invoked when we leave rate limited state. */ ++ assert_se(sd_event_source_set_ratelimit_expire_callback(s, ratelimit_expired) >= 0); ++ + do { + assert_se(sd_event_run(e, UINT64_MAX) >= 0); + } while (!sd_event_source_is_ratelimited(s)); + + log_info("ratelimit_time_handler: called 10 more times, event source got ratelimited"); + assert_se(count == 20); ++ ++ /* Dispatch the event loop once more and check that ratelimit expiration callback got called */ ++ assert_se(sd_event_run(e, UINT64_MAX) >= 0); ++ assert_se(expired == 0); + } + + int main(int argc, char *argv[]) { +diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h +index a17a9b3488..c2e9c9614d 100644 +--- a/src/systemd/sd-event.h ++++ b/src/systemd/sd-event.h +@@ -147,6 +147,7 @@ int sd_event_source_get_destroy_callback(sd_event_source *s, sd_event_destroy_t + int sd_event_source_set_ratelimit(sd_event_source *s, uint64_t interval_usec, unsigned burst); + int sd_event_source_get_ratelimit(sd_event_source *s, uint64_t *ret_interval_usec, unsigned *ret_burst); + int sd_event_source_is_ratelimited(sd_event_source *s); ++int sd_event_source_set_ratelimit_expire_callback(sd_event_source *s, sd_event_handler_t callback); + + /* Define helpers so that __attribute__((cleanup(sd_event_unrefp))) and similar may be used. */ + _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_event, sd_event_unref); diff --git a/0679-core-rename-generalize-UNIT-u-test_start_limit-hook.patch b/0679-core-rename-generalize-UNIT-u-test_start_limit-hook.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3b520b16183821c32569280628b714b7fc58736 --- /dev/null +++ b/0679-core-rename-generalize-UNIT-u-test_start_limit-hook.patch @@ -0,0 +1,263 @@ +From c08bb8f464ff4d27fbf762d19d28fe92955a668d Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Mon, 4 Oct 2021 17:51:52 +0200 +Subject: [PATCH] core: rename/generalize UNIT(u)->test_start_limit() hook + +Up until now the main reason why we didn't proceed with starting the +unit was exceed start limit burst. However, for unit types like mounts +the other reason could be effective ratelimit on /proc/self/mountinfo +event source. That means our mount unit state may not reflect current +kernel state. Hence, we need to attempt to re-run the start job again +after ratelimit on event source expires. + +As we will be introducing another reason than start limit let's rename +the virtual function that implements the check. + +(cherry picked from commit 705578c3b9d794097233aa66010cf67b2a444716) + +Related: #2037395 +--- + src/core/automount.c | 6 +++--- + src/core/mount.c | 6 +++--- + src/core/path.c | 6 +++--- + src/core/service.c | 6 +++--- + src/core/socket.c | 6 +++--- + src/core/swap.c | 6 +++--- + src/core/timer.c | 6 +++--- + src/core/unit.c | 6 +++--- + src/core/unit.h | 2 +- + 9 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/src/core/automount.c b/src/core/automount.c +index 5e16adabb5..f212620c8f 100644 +--- a/src/core/automount.c ++++ b/src/core/automount.c +@@ -1071,7 +1071,7 @@ static bool automount_supported(void) { + return supported; + } + +-static int automount_test_start_limit(Unit *u) { ++static int automount_can_start(Unit *u) { + Automount *a = AUTOMOUNT(u); + int r; + +@@ -1083,7 +1083,7 @@ static int automount_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const automount_result_table[_AUTOMOUNT_RESULT_MAX] = { +@@ -1145,5 +1145,5 @@ const UnitVTable automount_vtable = { + }, + }, + +- .test_start_limit = automount_test_start_limit, ++ .can_start = automount_can_start, + }; +diff --git a/src/core/mount.c b/src/core/mount.c +index 619f64d5b7..72341fe685 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1947,7 +1947,7 @@ static int mount_control_pid(Unit *u) { + return m->control_pid; + } + +-static int mount_test_start_limit(Unit *u) { ++static int mount_can_start(Unit *u) { + Mount *m = MOUNT(u); + int r; + +@@ -1959,7 +1959,7 @@ static int mount_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const mount_exec_command_table[_MOUNT_EXEC_COMMAND_MAX] = { +@@ -2054,5 +2054,5 @@ const UnitVTable mount_vtable = { + }, + }, + +- .test_start_limit = mount_test_start_limit, ++ .can_start = mount_can_start, + }; +diff --git a/src/core/path.c b/src/core/path.c +index 1e69a1f05f..58f490589d 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -724,7 +724,7 @@ static void path_reset_failed(Unit *u) { + p->result = PATH_SUCCESS; + } + +-static int path_test_start_limit(Unit *u) { ++static int path_can_start(Unit *u) { + Path *p = PATH(u); + int r; + +@@ -736,7 +736,7 @@ static int path_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const path_type_table[_PATH_TYPE_MAX] = { +@@ -792,5 +792,5 @@ const UnitVTable path_vtable = { + .bus_vtable = bus_path_vtable, + .bus_set_property = bus_path_set_property, + +- .test_start_limit = path_test_start_limit, ++ .can_start = path_can_start, + }; +diff --git a/src/core/service.c b/src/core/service.c +index a21d98ab8f..2b7e85d3eb 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -4043,7 +4043,7 @@ static bool service_needs_console(Unit *u) { + SERVICE_FINAL_SIGKILL); + } + +-static int service_test_start_limit(Unit *u) { ++static int service_can_start(Unit *u) { + Service *s = SERVICE(u); + int r; + +@@ -4056,7 +4056,7 @@ static int service_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const service_restart_table[_SERVICE_RESTART_MAX] = { +@@ -4201,5 +4201,5 @@ const UnitVTable service_vtable = { + }, + }, + +- .test_start_limit = service_test_start_limit, ++ .can_start = service_can_start, + }; +diff --git a/src/core/socket.c b/src/core/socket.c +index 36d2e4f823..3589300e68 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -3261,7 +3261,7 @@ static int socket_control_pid(Unit *u) { + return s->control_pid; + } + +-static int socket_test_start_limit(Unit *u) { ++static int socket_can_start(Unit *u) { + Socket *s = SOCKET(u); + int r; + +@@ -3273,7 +3273,7 @@ static int socket_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const socket_exec_command_table[_SOCKET_EXEC_COMMAND_MAX] = { +@@ -3369,5 +3369,5 @@ const UnitVTable socket_vtable = { + }, + }, + +- .test_start_limit = socket_test_start_limit, ++ .can_start = socket_can_start, + }; +diff --git a/src/core/swap.c b/src/core/swap.c +index 90fcd69300..498c5a6d69 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -1452,7 +1452,7 @@ static int swap_control_pid(Unit *u) { + return s->control_pid; + } + +-static int swap_test_start_limit(Unit *u) { ++static int swap_can_start(Unit *u) { + Swap *s = SWAP(u); + int r; + +@@ -1464,7 +1464,7 @@ static int swap_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const swap_exec_command_table[_SWAP_EXEC_COMMAND_MAX] = { +@@ -1557,5 +1557,5 @@ const UnitVTable swap_vtable = { + }, + }, + +- .test_start_limit = swap_test_start_limit, ++ .can_start = swap_can_start, + }; +diff --git a/src/core/timer.c b/src/core/timer.c +index fb9ae17990..684180bf99 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -823,7 +823,7 @@ static void timer_timezone_change(Unit *u) { + timer_enter_waiting(t, false); + } + +-static int timer_test_start_limit(Unit *u) { ++static int timer_can_start(Unit *u) { + Timer *t = TIMER(u); + int r; + +@@ -835,7 +835,7 @@ static int timer_test_start_limit(Unit *u) { + return r; + } + +- return 0; ++ return 1; + } + + static const char* const timer_base_table[_TIMER_BASE_MAX] = { +@@ -893,5 +893,5 @@ const UnitVTable timer_vtable = { + .bus_set_property = bus_timer_set_property, + + .can_transient = true, +- .test_start_limit = timer_test_start_limit, ++ .can_start = timer_can_start, + }; +diff --git a/src/core/unit.c b/src/core/unit.c +index 9005f79df3..bd0a6bb7cc 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -1726,9 +1726,9 @@ int unit_start(Unit *u) { + + assert(u); + +- /* Check start rate limiting early so that failure conditions don't cause us to enter a busy loop. */ +- if (UNIT_VTABLE(u)->test_start_limit) { +- int r = UNIT_VTABLE(u)->test_start_limit(u); ++ /* Check our ability to start early so that failure conditions don't cause us to enter a busy loop. */ ++ if (UNIT_VTABLE(u)->can_start) { ++ int r = UNIT_VTABLE(u)->can_start(u); + if (r < 0) + return r; + } +diff --git a/src/core/unit.h b/src/core/unit.h +index 9e6f1bcf81..0cd259411f 100644 +--- a/src/core/unit.h ++++ b/src/core/unit.h +@@ -569,7 +569,7 @@ typedef struct UnitVTable { + + /* If this function is set, it's invoked first as part of starting a unit to allow start rate + * limiting checks to occur before we do anything else. */ +- int (*test_start_limit)(Unit *u); ++ int (*can_start)(Unit *u); + + /* The strings to print in status messages */ + UnitStatusMessageFormats status_message_formats; diff --git a/0680-mount-make-mount-units-start-jobs-not-runnable-if-p-.patch b/0680-mount-make-mount-units-start-jobs-not-runnable-if-p-.patch new file mode 100644 index 0000000000000000000000000000000000000000..7d21e321aaa3139bc49ab16040d6674ce7d03722 --- /dev/null +++ b/0680-mount-make-mount-units-start-jobs-not-runnable-if-p-.patch @@ -0,0 +1,27 @@ +From faaac88f0686066e0b930952f12010f6d93fd6cf Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Mon, 4 Oct 2021 19:41:34 +0200 +Subject: [PATCH] mount: make mount units start jobs not runnable if + /p/s/mountinfo ratelimit is in effect + +(cherry picked from commit a7c93dfe91e88a5a561341c523a45c7f8d71a588) + +Related: #2037395 +--- + src/core/mount.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 72341fe685..dbac1b7cb1 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1953,6 +1953,9 @@ static int mount_can_start(Unit *u) { + + assert(m); + ++ if (sd_event_source_is_ratelimited(u->manager->mount_event_source)) ++ return -EAGAIN; ++ + r = unit_test_start_limit(u); + if (r < 0) { + mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT); diff --git a/0681-mount-retrigger-run-queue-after-ratelimit-expired-to.patch b/0681-mount-retrigger-run-queue-after-ratelimit-expired-to.patch new file mode 100644 index 0000000000000000000000000000000000000000..6887e73c9f0ef8affc88490cbe50f500370b29f6 --- /dev/null +++ b/0681-mount-retrigger-run-queue-after-ratelimit-expired-to.patch @@ -0,0 +1,54 @@ +From 0b28134258e40b2fc054326175317db65c23bcd6 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Mon, 4 Oct 2021 20:31:49 +0200 +Subject: [PATCH] mount: retrigger run queue after ratelimit expired to run + delayed mount start jobs + +Fixes #20329 + +(cherry picked from commit edc027b4f1cfaa49e8ecdde763eb8c623402d464) + +Related: #2037395 +--- + src/core/mount.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/src/core/mount.c b/src/core/mount.c +index dbac1b7cb1..c05779343c 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1706,6 +1706,21 @@ static bool mount_is_mounted(Mount *m) { + return UNIT(m)->perpetual || m->is_mounted; + } + ++static int mount_on_ratelimit_expire(sd_event_source *s, void *userdata) { ++ Manager *m = userdata; ++ int r; ++ ++ assert(m); ++ ++ /* By entering ratelimited state we made all mount start jobs not runnable, now rate limit is over so let's ++ * make sure we dispatch them in the next iteration. */ ++ r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_ONESHOT); ++ if (r < 0) ++ log_debug_errno(r, "Failed to enable run queue event source, ignoring: %m"); ++ ++ return 0; ++} ++ + static void mount_enumerate(Manager *m) { + int r; + +@@ -1759,6 +1774,12 @@ static void mount_enumerate(Manager *m) { + goto fail; + } + ++ r = sd_event_source_set_ratelimit_expire_callback(m->mount_event_source, mount_on_ratelimit_expire); ++ if (r < 0) { ++ log_error_errno(r, "Failed to enable rate limit for mount events: %m"); ++ goto fail; ++ } ++ + (void) sd_event_source_set_description(m->mount_event_source, "mount-monitor-dispatch"); + } + diff --git a/0682-pid1-add-a-manager_trigger_run_queue-helper.patch b/0682-pid1-add-a-manager_trigger_run_queue-helper.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c12d00437de956e627a9431bbe26f04c356bd73 --- /dev/null +++ b/0682-pid1-add-a-manager_trigger_run_queue-helper.patch @@ -0,0 +1,98 @@ +From 567c8855016ee5e7641d6c5f1ed84badd9fae10d Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 12 Nov 2021 09:43:07 +0100 +Subject: [PATCH] pid1: add a manager_trigger_run_queue() helper + +We have two different places where we re-trigger the run queue now. +let's unify it under a common function, that is part of the Manager +code. + +Follow-up for #20953 + +(cherry picked from commit b0c4b2824693fe6a27ea9439ec7a6328a0e23704) + +Related: #2037395 +--- + src/core/job.c | 5 ++--- + src/core/manager.c | 12 ++++++++++++ + src/core/manager.h | 2 ++ + src/core/mount.c | 9 +++------ + 4 files changed, 19 insertions(+), 9 deletions(-) + +diff --git a/src/core/job.c b/src/core/job.c +index 870ec0a387..cc6e1ee65a 100644 +--- a/src/core/job.c ++++ b/src/core/job.c +@@ -1137,11 +1137,10 @@ void job_add_to_run_queue(Job *j) { + if (j->in_run_queue) + return; + +- if (!j->manager->run_queue) +- sd_event_source_set_enabled(j->manager->run_queue_event_source, SD_EVENT_ONESHOT); +- + LIST_PREPEND(run_queue, j->manager->run_queue, j); + j->in_run_queue = true; ++ ++ manager_trigger_run_queue(j->manager); + } + + void job_add_to_dbus_queue(Job *j) { +diff --git a/src/core/manager.c b/src/core/manager.c +index 3c44ad3dbc..ae6ce35d99 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -2120,6 +2120,18 @@ static int manager_dispatch_run_queue(sd_event_source *source, void *userdata) { + return 1; + } + ++void manager_trigger_run_queue(Manager *m) { ++ int r; ++ ++ assert(m); ++ ++ r = sd_event_source_set_enabled( ++ m->run_queue_event_source, ++ m->run_queue ? SD_EVENT_ONESHOT: SD_EVENT_OFF); ++ if (r < 0) ++ log_warning_errno(r, "Failed to enable job run queue event source, ignoring: %m"); ++} ++ + static unsigned manager_dispatch_dbus_queue(Manager *m) { + unsigned n = 0, budget; + Unit *u; +diff --git a/src/core/manager.h b/src/core/manager.h +index c4b8e80093..7b572c8dfd 100644 +--- a/src/core/manager.h ++++ b/src/core/manager.h +@@ -416,6 +416,8 @@ unsigned manager_dispatch_load_queue(Manager *m); + int manager_environment_add(Manager *m, char **minus, char **plus); + int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit); + ++void manager_trigger_run_queue(Manager *m); ++ + int manager_loop(Manager *m); + + int manager_open_serialization(Manager *m, FILE **_f); +diff --git a/src/core/mount.c b/src/core/mount.c +index c05779343c..9ff7c71edd 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1708,15 +1708,12 @@ static bool mount_is_mounted(Mount *m) { + + static int mount_on_ratelimit_expire(sd_event_source *s, void *userdata) { + Manager *m = userdata; +- int r; + + assert(m); + +- /* By entering ratelimited state we made all mount start jobs not runnable, now rate limit is over so let's +- * make sure we dispatch them in the next iteration. */ +- r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_ONESHOT); +- if (r < 0) +- log_debug_errno(r, "Failed to enable run queue event source, ignoring: %m"); ++ /* By entering ratelimited state we made all mount start jobs not runnable, now rate limit is over so ++ * let's make sure we dispatch them in the next iteration. */ ++ manager_trigger_run_queue(m); + + return 0; + } diff --git a/0683-unit-add-jobs-that-were-skipped-because-of-ratelimit.patch b/0683-unit-add-jobs-that-were-skipped-because-of-ratelimit.patch new file mode 100644 index 0000000000000000000000000000000000000000..af625ce1853f3f534cb3f9d470135b9b32453b8f --- /dev/null +++ b/0683-unit-add-jobs-that-were-skipped-because-of-ratelimit.patch @@ -0,0 +1,46 @@ +From a9a25019ea307741d7d42178ac0f47a2320f8e94 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Thu, 25 Nov 2021 18:28:25 +0100 +Subject: [PATCH] unit: add jobs that were skipped because of ratelimit back to + run_queue + +Assumption in edc027b was that job we first skipped because of active +ratelimit is still in run_queue. Hence we trigger the queue and dispatch +it in the next iteration. Actually we remove jobs from run_queue in +job_run_and_invalidate() before we call unit_start(). Hence if we want +to attempt to run the job again in the future we need to add it back +to run_queue. + +Fixes #21458 + +(cherry picked from commit c29e6a9530316823b0455cd83eb6d0bb8dd664f4) + +Related: #2037395 +--- + src/core/mount.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 9ff7c71edd..4e0a4f238a 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1708,9 +1708,19 @@ static bool mount_is_mounted(Mount *m) { + + static int mount_on_ratelimit_expire(sd_event_source *s, void *userdata) { + Manager *m = userdata; ++ Job *j; ++ Iterator i; + + assert(m); + ++ /* Let's enqueue all start jobs that were previously skipped because of active ratelimit. */ ++ HASHMAP_FOREACH(j, m->jobs, i) { ++ if (j->unit->type != UNIT_MOUNT) ++ continue; ++ ++ job_add_to_run_queue(j); ++ } ++ + /* By entering ratelimited state we made all mount start jobs not runnable, now rate limit is over so + * let's make sure we dispatch them in the next iteration. */ + manager_trigger_run_queue(m); diff --git a/0684-udev-net_id-introduce-naming-scheme-for-RHEL-8.5.patch b/0684-udev-net_id-introduce-naming-scheme-for-RHEL-8.5.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0cbf3c3f55e350b66ef4775cc59d499521c04b0 --- /dev/null +++ b/0684-udev-net_id-introduce-naming-scheme-for-RHEL-8.5.patch @@ -0,0 +1,50 @@ +From 6882d94ae68468b414597696727108d588402f43 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Wed, 12 Jan 2022 15:35:19 +0100 +Subject: [PATCH] udev/net_id: introduce naming scheme for RHEL-8.5 + +RHEL-only + +Related: #2040244 +--- + man/systemd.net-naming-scheme.xml | 6 ++++++ + src/udev/udev-builtin-net_id.c | 2 ++ + 2 files changed, 8 insertions(+) + +diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml +index 10e71dcb15..be969bc8d0 100644 +--- a/man/systemd.net-naming-scheme.xml ++++ b/man/systemd.net-naming-scheme.xml +@@ -301,6 +301,12 @@ + avoid possible naming conflict. + + ++ ++ rhel-8.5 ++ ++ Same as naming scheme rhel-8.4. ++ ++ + Note that latest may be used to denote the latest scheme known (to this + particular version of systemd. + +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 0611c08234..3a0b3b1eae 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -135,6 +135,7 @@ typedef enum NamingSchemeFlags { + NAMING_RHEL_8_2 = NAMING_V239, + NAMING_RHEL_8_3 = NAMING_V239, + NAMING_RHEL_8_4 = NAMING_V239|NAMING_BRIDGE_NO_SLOT, ++ NAMING_RHEL_8_5 = NAMING_RHEL_8_4, + + _NAMING_SCHEME_FLAGS_INVALID = -1, + } NamingSchemeFlags; +@@ -152,6 +153,7 @@ static const NamingScheme naming_schemes[] = { + { "rhel-8.2", NAMING_RHEL_8_2 }, + { "rhel-8.3", NAMING_RHEL_8_3 }, + { "rhel-8.4", NAMING_RHEL_8_4 }, ++ { "rhel-8.5", NAMING_RHEL_8_5 }, + /* … add more schemes here, as the logic to name devices is updated … */ + }; + diff --git a/0685-udev-net_id-remove-extraneous-bracket.patch b/0685-udev-net_id-remove-extraneous-bracket.patch new file mode 100644 index 0000000000000000000000000000000000000000..3c454f70231482d2fddf237291a9b4b6cb62de32 --- /dev/null +++ b/0685-udev-net_id-remove-extraneous-bracket.patch @@ -0,0 +1,25 @@ +From d5d728d24b34194438e74580c1a58f5727b59444 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Wed, 12 Jan 2022 15:35:54 +0100 +Subject: [PATCH] udev/net_id: remove extraneous bracket + +RHEL-only + +Related: #2040244 +--- + man/systemd.net-naming-scheme.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml +index be969bc8d0..a65da5c6c1 100644 +--- a/man/systemd.net-naming-scheme.xml ++++ b/man/systemd.net-naming-scheme.xml +@@ -307,7 +307,7 @@ + Same as naming scheme rhel-8.4. + + +- Note that latest may be used to denote the latest scheme known (to this ++ Note that latest may be used to denote the latest scheme known to this + particular version of systemd. + + diff --git a/0686-mount-do-not-update-exec-deps-on-mountinfo-changes.patch b/0686-mount-do-not-update-exec-deps-on-mountinfo-changes.patch new file mode 100644 index 0000000000000000000000000000000000000000..01bf38f60820766c3156ea4fb3ebddae848e26de --- /dev/null +++ b/0686-mount-do-not-update-exec-deps-on-mountinfo-changes.patch @@ -0,0 +1,87 @@ +From 9807f473b1b3e2aaf86bcbc6e6b9ad1328548b22 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 15 Nov 2019 14:00:54 +0100 +Subject: [PATCH] mount: do not update exec deps on mountinfo changes + +Fixes: #13978 +(cherry picked from commit bf7eedbf8f8c83d9e775c80275f98f506ec963c6) + +Related: #2038878 +--- + src/core/mount.c | 42 ++++++++++++++++++++++++++++-------------- + 1 file changed, 28 insertions(+), 14 deletions(-) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 4e0a4f238a..73c0531158 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -535,6 +535,32 @@ static int mount_verify(Mount *m) { + return 0; + } + ++static int mount_add_non_exec_dependencies(Mount *m) { ++ int r; ++ assert(m); ++ ++ /* Adds in all dependencies directly responsible for ordering the mount, as opposed to dependencies ++ * resulting from the ExecContext and such. */ ++ ++ r = mount_add_device_dependencies(m); ++ if (r < 0) ++ return r; ++ ++ r = mount_add_mount_dependencies(m); ++ if (r < 0) ++ return r; ++ ++ r = mount_add_quota_dependencies(m); ++ if (r < 0) ++ return r; ++ ++ r = mount_add_default_dependencies(m); ++ if (r < 0) ++ return r; ++ ++ return 0; ++} ++ + static int mount_add_extras(Mount *m) { + Unit *u = UNIT(m); + int r; +@@ -558,18 +584,6 @@ static int mount_add_extras(Mount *m) { + return r; + } + +- r = mount_add_device_dependencies(m); +- if (r < 0) +- return r; +- +- r = mount_add_mount_dependencies(m); +- if (r < 0) +- return r; +- +- r = mount_add_quota_dependencies(m); +- if (r < 0) +- return r; +- + r = unit_patch_contexts(u); + if (r < 0) + return r; +@@ -582,7 +596,7 @@ static int mount_add_extras(Mount *m) { + if (r < 0) + return r; + +- r = mount_add_default_dependencies(m); ++ r = mount_add_non_exec_dependencies(m); + if (r < 0) + return r; + +@@ -1526,7 +1540,7 @@ static int mount_setup_existing_unit( + } + + if (load_extras) +- return mount_add_extras(MOUNT(u)); ++ return mount_add_non_exec_dependencies(MOUNT(u)); + + return 0; + } diff --git a/0687-core-mount-add-implicit-unit-dependencies-even-if-wh.patch b/0687-core-mount-add-implicit-unit-dependencies-even-if-wh.patch new file mode 100644 index 0000000000000000000000000000000000000000..e893fab939a050e6b47447aa052334691601abac --- /dev/null +++ b/0687-core-mount-add-implicit-unit-dependencies-even-if-wh.patch @@ -0,0 +1,46 @@ +From f68eeaf2809d6866f9cca3d7746795ffc3e71f46 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Sun, 29 Aug 2021 21:20:43 +0900 +Subject: [PATCH] core/mount: add implicit unit dependencies even if when mount + unit is generated from /proc/self/mountinfo + +Hopefully fixes #20566. + +(cherry picked from commit aebff2e7ce209fc2d75b894a3ae8b80f6f36ec11) + +Resolves: #2038878 +--- + src/core/mount.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/core/mount.c b/src/core/mount.c +index 73c0531158..9547cb9b29 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1437,6 +1437,7 @@ static int mount_setup_new_unit( + MountSetupFlags *flags) { + + MountParameters *p; ++ int r; + + assert(u); + assert(flags); +@@ -1458,7 +1459,6 @@ static int mount_setup_new_unit( + + if (!mount_is_extrinsic(MOUNT(u))) { + const char *target; +- int r; + + target = mount_is_network(p) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET; + r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true, UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT); +@@ -1470,6 +1470,10 @@ static int mount_setup_new_unit( + return r; + } + ++ r = mount_add_non_exec_dependencies(MOUNT(u)); ++ if (r < 0) ++ return r; ++ + unit_add_to_load_queue(u); + flags->is_mounted = true; + flags->just_mounted = true; diff --git a/1002-core-fix-a-null-reference-case-in-load_from_path.patch b/1001-core-fix-a-null-reference-case-in-load_from_path.patch similarity index 100% rename from 1002-core-fix-a-null-reference-case-in-load_from_path.patch rename to 1001-core-fix-a-null-reference-case-in-load_from_path.patch diff --git a/1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch b/1002-sysctl-Don-t-pass-null-directive-argument-to-s.patch similarity index 100% rename from 1003-sysctl-Don-t-pass-null-directive-argument-to-s.patch rename to 1002-sysctl-Don-t-pass-null-directive-argument-to-s.patch diff --git a/1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch b/1003-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch similarity index 100% rename from 1007-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch rename to 1003-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch diff --git a/1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch b/1004-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch similarity index 100% rename from 1008-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch rename to 1004-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch 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 f5edab547b0275f0f68f495c70256d30a26fade4..0000000000000000000000000000000000000000 --- 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/1009-Do-not-go-into-freeze-when-systemd-crashd.patch b/1005-Do-not-go-into-freeze-when-systemd-crashd.patch similarity index 100% rename from 1009-Do-not-go-into-freeze-when-systemd-crashd.patch rename to 1005-Do-not-go-into-freeze-when-systemd-crashd.patch 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 b74edb73d705a728f0bee37116eab207833bba0e..0000000000000000000000000000000000000000 --- 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/1010-mount-setup-change-the-system-mount-propagation-to-s.patch b/1006-mount-setup-change-the-system-mount-propagation-to-s.patch similarity index 100% rename from 1010-mount-setup-change-the-system-mount-propagation-to-s.patch rename to 1006-mount-setup-change-the-system-mount-propagation-to-s.patch diff --git a/1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch b/1007-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch similarity index 100% rename from 1012-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch rename to 1007-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch diff --git a/1013-cgroup-update-only-siblings-that-got-realized-once.patch b/1008-cgroup-update-only-siblings-that-got-realized-once.patch similarity index 100% rename from 1013-cgroup-update-only-siblings-that-got-realized-once.patch rename to 1008-cgroup-update-only-siblings-that-got-realized-once.patch diff --git a/1014-core-add-a-config-item-to-support-setting-the-value-.patch b/1009-core-add-a-config-item-to-support-setting-the-value-.patch similarity index 100% rename from 1014-core-add-a-config-item-to-support-setting-the-value-.patch rename to 1009-core-add-a-config-item-to-support-setting-the-value-.patch diff --git a/1015-systemd-anolis-support-loongarch64.patch b/1010-systemd-anolis-support-loongarch64.patch similarity index 100% rename from 1015-systemd-anolis-support-loongarch64.patch rename to 1010-systemd-anolis-support-loongarch64.patch diff --git a/systemd.spec b/systemd.spec index 67e3821e41617fea29c2789dc8b2148632823b3e..d5f0bfaf0db6ff318bd4699bdda1bf06fcdc774c 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.2 +%define anolis_release .0.1 #global gitcommit 10e465b5321bd53c1fc59ffab27e724535c6bc0f %{?gitcommit:%global gitcommitshort %(c=%{gitcommit}; echo ${c:0:7})} @@ -15,7 +15,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 51%{anolis_release}%{?dist}.3 +Release: 51%{anolis_release}%{?dist}.5 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -720,21 +720,36 @@ 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 +Patch0669: 0669-mount-don-t-propagate-errors-from-mount_setup_unit-f.patch +Patch0670: 0670-test-make-TEST-47-less-racy.patch +Patch0671: 0671-macro-define-HAS_FEATURE_ADDRESS_SANITIZER-also-on-g.patch +Patch0672: 0672-tests-add-helper-function-to-autodetect-CI-environme.patch +Patch0673: 0673-strv-rework-FOREACH_STRING-macro.patch +Patch0674: 0674-test-systemctl-use-const-char-instead-of-char.patch +Patch0675: 0675-ci-pass-the-GITHUB_ACTIONS-variable-to-the-CentOS-co.patch +Patch0676: 0676-core-rename-unit_-start_limit-condition-assert-_test.patch +Patch0677: 0677-core-Check-unit-start-rate-limiting-earlier.patch +Patch0678: 0678-sd-event-introduce-callback-invoked-when-event-sourc.patch +Patch0679: 0679-core-rename-generalize-UNIT-u-test_start_limit-hook.patch +Patch0680: 0680-mount-make-mount-units-start-jobs-not-runnable-if-p-.patch +Patch0681: 0681-mount-retrigger-run-queue-after-ratelimit-expired-to.patch +Patch0682: 0682-pid1-add-a-manager_trigger_run_queue-helper.patch +Patch0683: 0683-unit-add-jobs-that-were-skipped-because-of-ratelimit.patch +Patch0684: 0684-udev-net_id-introduce-naming-scheme-for-RHEL-8.5.patch +Patch0685: 0685-udev-net_id-remove-extraneous-bracket.patch +Patch0686: 0686-mount-do-not-update-exec-deps-on-mountinfo-changes.patch +Patch0687: 0687-core-mount-add-implicit-unit-dependencies-even-if-wh.patch + +Patch1001: 1001-core-fix-a-null-reference-case-in-load_from_path.patch +Patch1002: 1002-sysctl-Don-t-pass-null-directive-argument-to-s.patch +Patch1003: 1003-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch +Patch1004: 1004-main-don-t-freeze-PID-1-in-containers-exit-with-non-.patch +Patch1005: 1005-Do-not-go-into-freeze-when-systemd-crashd.patch +Patch1006: 1006-mount-setup-change-the-system-mount-propagation-to-s.patch +Patch1007: 1007-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch +Patch1008: 1008-cgroup-update-only-siblings-that-got-realized-once.patch +Patch1009: 1009-core-add-a-config-item-to-support-setting-the-value-.patch +Patch1010: 1010-systemd-anolis-support-loongarch64.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1361,23 +1376,40 @@ 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 +* Wed Mar 16 2022 Yuanhong Peng - 239-51.5.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 +- support loongarch for systemd + +* Tue Jan 25 2022 systemd maintenance team - 239-51.5 +- mount: do not update exec deps on mountinfo changes (#2038878) +- core/mount: add implicit unit dependencies even if when mount unit is generated from /proc/self/mountinfo (#2038878) + +* Thu Jan 13 2022 systemd maintenance team - 239-51.4 +- mount: don't propagate errors from mount_setup_unit() further up (#2039327) +- test: make TEST-47 less racy (#2039327) +- macro: define HAS_FEATURE_ADDRESS_SANITIZER also on gcc (#2039327) +- tests: add helper function to autodetect CI environments (#2039327) +- strv: rework FOREACH_STRING() macro (#2039327) +- test,systemctl: use "const char*" instead of "char*" (#2039327) +- ci: pass the $GITHUB_ACTIONS variable to the CentOS container (#2039327) +- core: rename unit_{start_limit|condition|assert}_test() to unit_test_xyz() (#2037395) +- core: Check unit start rate limiting earlier (#2037395) +- sd-event: introduce callback invoked when event source ratelimit expires (#2037395) +- core: rename/generalize UNIT(u)->test_start_limit() hook (#2037395) +- mount: make mount units start jobs not runnable if /p/s/mountinfo ratelimit is in effect (#2037395) +- mount: retrigger run queue after ratelimit expired to run delayed mount start jobs (#2037395) +- pid1: add a manager_trigger_run_queue() helper (#2037395) +- unit: add jobs that were skipped because of ratelimit back to run_queue (#2037395) +- udev/net_id: introduce naming scheme for RHEL-8.5 (#2040244) +- udev/net_id: remove extraneous bracket (#2040244) * Fri Dec 10 2021 systemd maintenance team - 239-51.3 - Do not fail if the same alt. name is set again (#2030027)