From dcda249f12f7592949dfd3863e75b59ca29b436f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jan 12 2023 08:27:52 +0000 Subject: import systemd-239-68.el8_7.1 --- diff --git a/SOURCES/0832-time-util-fix-buffer-over-run.patch b/SOURCES/0832-time-util-fix-buffer-over-run.patch new file mode 100644 index 0000000..7f587b4 --- /dev/null +++ b/SOURCES/0832-time-util-fix-buffer-over-run.patch @@ -0,0 +1,44 @@ +From 3ec7e3ece5474475b9123a67636f1ba3eec1e3c4 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Thu, 7 Jul 2022 18:27:02 +0900 +Subject: [PATCH] time-util: fix buffer-over-run + +Fixes #23928. + +(cherry picked from commit 9102c625a673a3246d7e73d8737f3494446bad4e) + +Resolves: #2139390 +--- + src/basic/time-util.c | 2 +- + src/test/test-time-util.c | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index c36e462193..d46d884be5 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -515,7 +515,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { + t = b; + } + +- n = MIN((size_t) k, l); ++ n = MIN((size_t) k, l-1); + + l -= n; + p += n; +diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c +index 354a01dd1a..6ebde4153c 100644 +--- a/src/test/test-time-util.c ++++ b/src/test/test-time-util.c +@@ -187,6 +187,11 @@ static void test_format_timespan(usec_t accuracy) { + test_format_timespan_one(500 * USEC_PER_MSEC, accuracy); + test_format_timespan_one(9*USEC_PER_YEAR/5 - 23, accuracy); + test_format_timespan_one(USEC_INFINITY, accuracy); ++ ++ /* See issue #23928. */ ++ _cleanup_free_ char *buf; ++ assert_se(buf = new(char, 5)); ++ assert_se(buf == format_timespan(buf, 5, 100005, 1000)); + } + + static void test_timezone_is_valid(void) { diff --git a/SOURCES/0833-core-move-reset_arguments-to-the-end-of-main-s-finis.patch b/SOURCES/0833-core-move-reset_arguments-to-the-end-of-main-s-finis.patch new file mode 100644 index 0000000..d74b950 --- /dev/null +++ b/SOURCES/0833-core-move-reset_arguments-to-the-end-of-main-s-finis.patch @@ -0,0 +1,49 @@ +From 944596e66a9cd947545c714c4682681fdbefc09f Mon Sep 17 00:00:00 2001 +From: Anita Zhang +Date: Thu, 17 Sep 2020 01:49:17 -0700 +Subject: [PATCH] core: move reset_arguments() to the end of main's finish + +Fixes #16991 + +fb39af4ce42d7ef9af63009f271f404038703704 replaced `free_arguments()` with +`reset_arguments()`, which frees arg_* variables as before, but also resets all +of them to the default values. `reset_arguments()` was positioned +in such a way that it overrode some arg_* values still in use at shutdown. + +To avoid further unintentional resets, I moved `reset_arguments()` +right before the return, when nothing else will be using the arg_* variables. + +(cherry picked from commit 7d9eea2bd3d4f83668c7a78754d201b226acbf1e) + +Resolves: #2127170 +--- + src/core/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/core/main.c b/src/core/main.c +index bfd4c531a7..cfa6fec930 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -2631,7 +2631,6 @@ finish: + m = manager_free(m); + } + +- reset_arguments(); + mac_selinux_finish(); + + if (reexecute) +@@ -2656,6 +2655,7 @@ finish: + * in become_shutdown() so normally we cannot free them yet. */ + watchdog_free_device(); + arg_watchdog_device = mfree(arg_watchdog_device); ++ reset_arguments(); + return retval; + } + #endif +@@ -2677,5 +2677,6 @@ finish: + freeze_or_reboot(); + } + ++ reset_arguments(); + return retval; + } diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 9692c92..7c3dd96 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -13,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 68%{?dist} +Release: 68%{?dist}.1 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -881,6 +881,8 @@ Patch0828: 0828-core-load-fragment-move-config_parse_sec_fix_0-to-sr.patch Patch0829: 0829-sd-event-add-relative-timer-calls.patch Patch0830: 0830-logind-add-option-to-stop-idle-sessions-after-specif.patch Patch0831: 0831-logind-schedule-idle-check-full-interval-from-now-if.patch +Patch0832: 0832-time-util-fix-buffer-over-run.patch +Patch0833: 0833-core-move-reset_arguments-to-the-end-of-main-s-finis.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1510,6 +1512,10 @@ fi %files tests -f .file-list-tests %changelog +* Mon Nov 07 2022 systemd maintenance team - 239-68.1 +- time-util: fix buffer-over-run (#2139390) +- core: move reset_arguments() to the end of main's finish (#2127170) + * Tue Sep 27 2022 systemd maintenance team - 239-68 - logind: optionally watch utmp for login data (#2122288) - logind: add hashtable for finding session by leader PID (#2122288)