summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorJoe Slater <jslater@windriver.com>2017-12-06 11:27:18 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-18 18:03:57 +0000
commite76779d77e0b42641073ef503019ecfef0c1681d (patch)
tree3bfd447a7714e67e4c5c18c08c25be1a15f5d30d /meta/recipes-core
parent05bcd72f9f6fb89d853a74d6fbb7becdfb06db84 (diff)
downloadpoky-e76779d77e0b42641073ef503019ecfef0c1681d.tar.gz
systemd: fix segfault when terminating systemd --test
Currently, if "systemd --test" is not allowed to complete sending output, it will segfault. (From OE-Core rev: 7e4632f17ba92ac71351e45acf11f0d7dfe14e0c) Signed-off-by: Joe Slater <jslater@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch69
-rw-r--r--meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch163
-rw-r--r--meta/recipes-core/systemd/systemd_234.bb2
3 files changed, 234 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch b/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch
new file mode 100644
index 0000000000..df100e587d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch
@@ -0,0 +1,69 @@
1From 28dd66ecfce743b1ea9046c7bb501e0fcaeff724 Mon Sep 17 00:00:00 2001
2From: Luca Bruno <luca.bruno@coreos.com>
3Date: Sun, 6 Aug 2017 13:24:24 +0000
4Subject: [PATCH] core: evaluate presets after generators have run (#6526)
5
6This commit moves the first-boot system preset-settings evaluation out
7of main and into the manager startup logic itself. Notably, it reverses
8the order between generators and presets evaluation, so that any changes
9performed by first-boot generators are taken into the account by presets
10logic.
11
12After this change, units created by a generator can be enabled as part
13of a preset.
14
15Upstream-Status: Backport
16
17Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
18---
19 src/core/main.c | 12 ++----------
20 src/core/manager.c | 8 ++++++++
21 2 files changed, 10 insertions(+), 10 deletions(-)
22
23diff --git a/src/core/main.c b/src/core/main.c
24index dfedc3d..11ac9cf 100644
25--- a/src/core/main.c
26+++ b/src/core/main.c
27@@ -1809,18 +1809,10 @@ int main(int argc, char *argv[]) {
28 if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0)
29 log_warning_errno(errno, "Failed to make us a subreaper: %m");
30
31- if (arg_system) {
32+ if (arg_system)
33+ /* Bump up RLIMIT_NOFILE for systemd itself */
34 (void) bump_rlimit_nofile(&saved_rlimit_nofile);
35
36- if (empty_etc) {
37- r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0);
38- if (r < 0)
39- log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, "Failed to populate /etc with preset unit settings, ignoring: %m");
40- else
41- log_info("Populated /etc with preset unit settings.");
42- }
43- }
44-
45 r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m);
46 if (r < 0) {
47 log_emergency_errno(r, "Failed to allocate manager object: %m");
48diff --git a/src/core/manager.c b/src/core/manager.c
49index 1aadb70..fb5e2b5 100644
50--- a/src/core/manager.c
51+++ b/src/core/manager.c
52@@ -1328,6 +1328,14 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
53 if (r < 0)
54 return r;
55
56+ if (m->first_boot && m->unit_file_scope == UNIT_FILE_SYSTEM) {
57+ q = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0);
58+ if (q < 0)
59+ log_full_errno(q == -EEXIST ? LOG_NOTICE : LOG_WARNING, q, "Failed to populate /etc with preset unit settings, ignoring: %m");
60+ else
61+ log_info("Populated /etc with preset unit settings.");
62+ }
63+
64 lookup_paths_reduce(&m->lookup_paths);
65 manager_build_unit_path_cache(m);
66
67--
682.10.2
69
diff --git a/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch b/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch
new file mode 100644
index 0000000000..a033b04b23
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch
@@ -0,0 +1,163 @@
1From dea374e898a749a0474b72b2015cca9009b1432b Mon Sep 17 00:00:00 2001
2From: Lennart Poettering <lennart@poettering.net>
3Date: Wed, 13 Sep 2017 10:31:40 +0200
4Subject: [PATCH] main: skip many initialization steps when running in --test
5 mode
6
7Most importantly, don't collect open socket activation fds when in
8--test mode. This specifically created a problem because we invoke
9pager_open() beforehand (which these days makes copies of the original
10stdout/stderr in order to be able to restore them when the pager goes
11away) and we might mistakenly the fd copies it creates as socket
12activation fds.
13
14Fixes: #6383
15
16Upstream-Status: Backport
17
18Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
19---
20 src/core/main.c | 108 +++++++++++++++++++++++++++++---------------------------
21 1 file changed, 56 insertions(+), 52 deletions(-)
22
23diff --git a/src/core/main.c b/src/core/main.c
24index 11ac9cf..d1a53a5 100644
25--- a/src/core/main.c
26+++ b/src/core/main.c
27@@ -1679,20 +1679,22 @@ int main(int argc, char *argv[]) {
28 log_close();
29
30 /* Remember open file descriptors for later deserialization */
31- r = fdset_new_fill(&fds);
32- if (r < 0) {
33- log_emergency_errno(r, "Failed to allocate fd set: %m");
34- error_message = "Failed to allocate fd set";
35- goto finish;
36- } else
37- fdset_cloexec(fds, true);
38+ if (arg_action == ACTION_RUN) {
39+ r = fdset_new_fill(&fds);
40+ if (r < 0) {
41+ log_emergency_errno(r, "Failed to allocate fd set: %m");
42+ error_message = "Failed to allocate fd set";
43+ goto finish;
44+ } else
45+ fdset_cloexec(fds, true);
46
47- if (arg_serialization)
48- assert_se(fdset_remove(fds, fileno(arg_serialization)) >= 0);
49+ if (arg_serialization)
50+ assert_se(fdset_remove(fds, fileno(arg_serialization)) >= 0);
51
52- if (arg_system)
53- /* Become a session leader if we aren't one yet. */
54- setsid();
55+ if (arg_system)
56+ /* Become a session leader if we aren't one yet. */
57+ setsid();
58+ }
59
60 /* Move out of the way, so that we won't block unmounts */
61 assert_se(chdir("/") == 0);
62@@ -1762,56 +1764,58 @@ int main(int argc, char *argv[]) {
63 arg_action == ACTION_TEST ? " test" : "", getuid(), t);
64 }
65
66- if (arg_system && !skip_setup) {
67- if (arg_show_status > 0)
68- status_welcome();
69+ if (arg_action == ACTION_RUN) {
70+ if (arg_system && !skip_setup) {
71+ if (arg_show_status > 0)
72+ status_welcome();
73
74- hostname_setup();
75- machine_id_setup(NULL, arg_machine_id, NULL);
76- loopback_setup();
77- bump_unix_max_dgram_qlen();
78+ hostname_setup();
79+ machine_id_setup(NULL, arg_machine_id, NULL);
80+ loopback_setup();
81+ bump_unix_max_dgram_qlen();
82
83- test_usr();
84- }
85+ test_usr();
86+ }
87
88- if (arg_system && arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY)
89- watchdog_set_timeout(&arg_runtime_watchdog);
90+ if (arg_system && arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY)
91+ watchdog_set_timeout(&arg_runtime_watchdog);
92
93- if (arg_timer_slack_nsec != NSEC_INFINITY)
94- if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0)
95- log_error_errno(errno, "Failed to adjust timer slack: %m");
96+ if (arg_timer_slack_nsec != NSEC_INFINITY)
97+ if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0)
98+ log_error_errno(errno, "Failed to adjust timer slack: %m");
99
100- if (arg_system && !cap_test_all(arg_capability_bounding_set)) {
101- r = capability_bounding_set_drop_usermode(arg_capability_bounding_set);
102- if (r < 0) {
103- log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m");
104- error_message = "Failed to drop capability bounding set of usermode helpers";
105- goto finish;
106- }
107- r = capability_bounding_set_drop(arg_capability_bounding_set, true);
108- if (r < 0) {
109- log_emergency_errno(r, "Failed to drop capability bounding set: %m");
110- error_message = "Failed to drop capability bounding set";
111- goto finish;
112+ if (arg_system && !cap_test_all(arg_capability_bounding_set)) {
113+ r = capability_bounding_set_drop_usermode(arg_capability_bounding_set);
114+ if (r < 0) {
115+ log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m");
116+ error_message = "Failed to drop capability bounding set of usermode helpers";
117+ goto finish;
118+ }
119+ r = capability_bounding_set_drop(arg_capability_bounding_set, true);
120+ if (r < 0) {
121+ log_emergency_errno(r, "Failed to drop capability bounding set: %m");
122+ error_message = "Failed to drop capability bounding set";
123+ goto finish;
124+ }
125 }
126- }
127
128- if (arg_syscall_archs) {
129- r = enforce_syscall_archs(arg_syscall_archs);
130- if (r < 0) {
131- error_message = "Failed to set syscall architectures";
132- goto finish;
133+ if (arg_syscall_archs) {
134+ r = enforce_syscall_archs(arg_syscall_archs);
135+ if (r < 0) {
136+ error_message = "Failed to set syscall architectures";
137+ goto finish;
138+ }
139 }
140- }
141
142- if (!arg_system)
143- /* Become reaper of our children */
144- if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0)
145- log_warning_errno(errno, "Failed to make us a subreaper: %m");
146+ if (!arg_system)
147+ /* Become reaper of our children */
148+ if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0)
149+ log_warning_errno(errno, "Failed to make us a subreaper: %m");
150
151- if (arg_system)
152- /* Bump up RLIMIT_NOFILE for systemd itself */
153- (void) bump_rlimit_nofile(&saved_rlimit_nofile);
154+ if (arg_system)
155+ /* Bump up RLIMIT_NOFILE for systemd itself */
156+ (void) bump_rlimit_nofile(&saved_rlimit_nofile);
157+ }
158
159 r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m);
160 if (r < 0) {
161--
1622.10.2
163
diff --git a/meta/recipes-core/systemd/systemd_234.bb b/meta/recipes-core/systemd/systemd_234.bb
index 765daf2084..778b8681a9 100644
--- a/meta/recipes-core/systemd/systemd_234.bb
+++ b/meta/recipes-core/systemd/systemd_234.bb
@@ -42,6 +42,8 @@ SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \
42 file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ 42 file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \
43 file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ 43 file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \
44 file://0001-Use-uintmax_t-for-handling-rlim_t.patch \ 44 file://0001-Use-uintmax_t-for-handling-rlim_t.patch \
45 file://0001-core-evaluate-presets-after-generators-have-run-6526.patch \
46 file://0001-main-skip-many-initialization-steps-when-running-in-.patch \
45 " 47 "
46SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" 48SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
47 49