systemd: fix segfault when terminating systemd --test
PATCH 1/1 systemd: fix segfault when terminating systemd --test
Currently, if "systemd --test" is not allowed to complete sending output, it will segfault.
Signed-off-by Joe Slater <[email protected]>
--- ...te-presets-after-generators-have-run-6526.patch | 69 +++++++++ ...any-initialization-steps-when-running-in-.patch | 163 +++++++++++++++++++++ meta/recipes-core/systemd/systemd_234.bb | 2 + 3 files changed, 234 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch create mode 100644 meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch
meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch new file +69 -0
@@ -0,0 +1,69 @@ +From 28dd66ecfce743b1ea9046c7bb501e0fcaeff724 Mon Sep 17 00:00:00 2001 +From: Luca Bruno <[email protected]> +Date: Sun, 6 Aug 2017 13:24:24 +0000 +Subject: [PATCH] core: evaluate presets after generators have run (#6526) + +This commit moves the first-boot system preset-settings evaluation out +of main and into the manager startup logic itself. Notably, it reverses +the order between generators and presets evaluation, so that any changes +performed by first-boot generators are taken into the account by presets +logic. + +After this change, units created by a generator can be enabled as part +of a preset. + +Upstream-Status: Backport + +Signed-off-by: Catalin Enache <[email protected]> +--- + src/core/main.c | 12 ++---------- + src/core/manager.c | 8 ++++++++ + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index dfedc3d..11ac9cf 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1809,18 +1809,10 @@ int main(int argc, char *argv[]) { + if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) + log_warning_errno(errno, "Failed to make us a subreaper: %m"); + +- if (arg_system) { ++ if (arg_system) ++ /* Bump up RLIMIT_NOFILE for systemd itself */ + (void) bump_rlimit_nofile(&saved_rlimit_nofile); + +- if (empty_etc) { +- r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0); +- if (r < 0) +- log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, "Failed to populate /etc with preset unit settings, ignoring: %m"); +- else +- log_info("Populated /etc with preset unit settings."); +- } +- } +- + r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m); + if (r < 0) { + log_emergency_errno(r, "Failed to allocate manager object: %m"); +diff --git a/src/core/manager.c b/src/core/manager.c +index 1aadb70..fb5e2b5 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -1328,6 +1328,14 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { + if (r < 0) + return r; + ++ if (m->first_boot && m->unit_file_scope == UNIT_FILE_SYSTEM) { ++ q = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0); ++ if (q < 0) ++ log_full_errno(q == -EEXIST ? LOG_NOTICE : LOG_WARNING, q, "Failed to populate /etc with preset unit settings, ignoring: %m"); ++ else ++ log_info("Populated /etc with preset unit settings."); ++ } ++ + lookup_paths_reduce(&m->lookup_paths); + manager_build_unit_path_cache(m); + +-- +2.10.2 +
meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch new file +163 -0
163 lines not on this page · raw message
meta/recipes-core/systemd/systemd_234.bb +2 -0
@@ -42,6 +42,8 @@ SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \ file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ file://0001-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0001-core-evaluate-presets-after-generators-have-run-6526.patch \ + file://0001-main-skip-many-initialization-steps-when-running-in-.patch \ " SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
Signature · 1 line
2.7.4