diff --git a/0472-socket-check-return-from-exec_spawn.patch b/0472-socket-check-return-from-exec_spawn.patch new file mode 100644 index 0000000..fdf9597 --- /dev/null +++ b/0472-socket-check-return-from-exec_spawn.patch @@ -0,0 +1,24 @@ +From 220939a361041e707d29870f76621343e4eda67b Mon Sep 17 00:00:00 2001 +From: Thomas Hindoe Paaboel Andersen +Date: Wed, 18 Jun 2014 20:34:52 +0200 +Subject: [PATCH] socket: check return from exec_spawn + +(cherry picked from commit cee288adf88844acd880e4c0da5ed550c85cdd1a) +(cherry picked from commit ca5fd86c375e44194154c3204ae0f42fd49a2b2f) +--- + src/core/socket.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/core/socket.c b/src/core/socket.c +index b811a61..8e02c03 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -1208,6 +1208,8 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { + UNIT(s)->id, + NULL, + &pid); ++ if (r < 0) ++ goto fail; + + strv_free(argv); + if (r < 0) diff --git a/0473-getty-generator-properly-escape-instance-names.patch b/0473-getty-generator-properly-escape-instance-names.patch new file mode 100644 index 0000000..a114fac --- /dev/null +++ b/0473-getty-generator-properly-escape-instance-names.patch @@ -0,0 +1,33 @@ +From 1376386fc63a246772c7c4ea04f76ce28b2306fe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 19 Jun 2014 22:02:55 -0400 +Subject: [PATCH] getty-generator: properly escape instance names + +Otherwise the add_symlink() function tries to make directories for +each slash even for the slash after the @ symbol in the final link +name, failing for /dev/3270/tty1. + +Based on a patch by Werner Fink . + +(cherry picked from commit a2ae516a25dafe41e0cd296ab7b5d022fa62b95f) +(cherry picked from commit 98023e096875cde4662a62e862279f8685d166fd) + +Conflicts: + src/getty-generator/getty-generator.c +--- + src/getty-generator/getty-generator.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c +index 625a87e..2f790b8 100644 +--- a/src/getty-generator/getty-generator.c ++++ b/src/getty-generator/getty-generator.c +@@ -77,7 +77,7 @@ static int add_serial_getty(const char *tty) { + + log_debug("Automatically adding serial getty for /dev/%s.", tty); + +- n = unit_name_replace_instance("serial-getty@.service", tty); ++ n = unit_name_from_path_instance("serial-getty", tty, ".service"); + if (!n) + return log_oom(); + diff --git a/0474-conf-files-include-root-in-returned-file-paths.patch b/0474-conf-files-include-root-in-returned-file-paths.patch new file mode 100644 index 0000000..f5f9538 --- /dev/null +++ b/0474-conf-files-include-root-in-returned-file-paths.patch @@ -0,0 +1,89 @@ +From 806e59a1e136764e1deb676eaa2666eee603af9f Mon Sep 17 00:00:00 2001 +From: Michael Marineau +Date: Thu, 19 Jun 2014 19:07:04 -0700 +Subject: [PATCH] conf-files: include root in returned file paths + +This restores the original root handling logic that was present prior to +112cfb18 when path expansion moved to path_strv_canonicalize_absolute. +That behavior partially went away in 12ed81d9. + +Alternatively all users of conf_files_list* could be updated to +concatenate the paths themselves as unit_file_query_preset did but since +no user needs the un-concatenated form that is pointless duplication. + +(cherry picked from commit cba2ef02722114da2b730d57f1e3bb43013d8921) + +Conflicts: + src/shared/install.c + +(cherry picked from commit 084c41bc148e0a7b0eeee614d9e0acc9aaae6b0d) +--- + src/shared/conf-files.c | 16 ++++++---------- + src/shared/install.c | 6 +++--- + 2 files changed, 9 insertions(+), 13 deletions(-) + +diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c +index 4ec8bed..fc5f1fe 100644 +--- a/src/shared/conf-files.c ++++ b/src/shared/conf-files.c +@@ -37,20 +37,16 @@ + #include "hashmap.h" + #include "conf-files.h" + +-static int files_add(Hashmap *h, const char *dirpath, const char *suffix, const char *root) { ++static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) { + _cleanup_closedir_ DIR *dir = NULL; ++ char *dirpath; + +- assert(dirpath); ++ assert(path); + assert(suffix); + +- if (isempty(root)) +- dir = opendir(dirpath); +- else { +- const char *p; ++ dirpath = strappenda(root ? root : "", path); + +- p = strappenda3(root, "/", dirpath); +- dir = opendir(p); +- } ++ dir = opendir(dirpath); + if (!dir) { + if (errno == ENOENT) + return 0; +@@ -118,7 +114,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const + return -ENOMEM; + + STRV_FOREACH(p, dirs) { +- r = files_add(fh, *p, suffix, root); ++ r = files_add(fh, root, *p, suffix); + if (r == -ENOMEM) { + hashmap_free_free(fh); + return r; +diff --git a/src/shared/install.c b/src/shared/install.c +index 86a05a4..f40be79 100644 +--- a/src/shared/install.c ++++ b/src/shared/install.c +@@ -1763,7 +1763,7 @@ UnitFileState unit_file_get_state( + + int unit_file_query_preset(UnitFileScope scope, const char *name) { + _cleanup_strv_free_ char **files = NULL; +- char **i; ++ char **p; + int r; + + assert(scope >= 0); +@@ -1791,10 +1791,10 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { + if (r < 0) + return r; + +- STRV_FOREACH(i, files) { ++ STRV_FOREACH(p, files) { + _cleanup_fclose_ FILE *f; + +- f = fopen(*i, "re"); ++ f = fopen(*p, "re"); + if (!f) { + if (errno == ENOENT) + continue; diff --git a/0475-shared-add-root-argument-to-search_and_fopen.patch b/0475-shared-add-root-argument-to-search_and_fopen.patch new file mode 100644 index 0000000..f0123a2 --- /dev/null +++ b/0475-shared-add-root-argument-to-search_and_fopen.patch @@ -0,0 +1,143 @@ +From a2d2b499ee2f7cdca44b1ab5bf13010cd4228d3e Mon Sep 17 00:00:00 2001 +From: Michael Marineau +Date: Thu, 13 Mar 2014 21:32:12 -0700 +Subject: [PATCH] shared: add root argument to search_and_fopen + +This adds the same root argument to search_and_fopen that +conf_files_list already has. Tools that use those two functions as a +pair can now be easily modified to load configuration files from an +alternate root filesystem tree. + +(cherry picked from commit 4cf7ea556aa1e74f9b34d4467f36d46a1bb25da3) +(cherry picked from commit 8d4847827db40b7148973558940f90495f5accba) + +Conflicts: + src/shared/util.h +--- + src/binfmt/binfmt.c | 2 +- + src/modules-load/modules-load.c | 2 +- + src/shared/util.c | 12 ++++++------ + src/shared/util.h | 4 ++-- + src/sysctl/sysctl.c | 2 +- + src/tmpfiles/tmpfiles.c | 2 +- + 6 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c +index 7ed1ae7..e3a3d4f 100644 +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -85,7 +85,7 @@ static int apply_file(const char *path, bool ignore_enoent) { + + assert(path); + +- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); ++ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); + if (r < 0) { + if (ignore_enoent && r == -ENOENT) + return 0; +diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c +index ba7d417..bfb6e7e 100644 +--- a/src/modules-load/modules-load.c ++++ b/src/modules-load/modules-load.c +@@ -181,7 +181,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent + assert(ctx); + assert(path); + +- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); ++ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); + if (r < 0) { + if (ignore_enoent && r == -ENOENT) + return 0; +diff --git a/src/shared/util.c b/src/shared/util.c +index f034134..65a09d9 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -5687,14 +5687,14 @@ int on_ac_power(void) { + return found_online || !found_offline; + } + +-static int search_and_fopen_internal(const char *path, const char *mode, char **search, FILE **_f) { ++static int search_and_fopen_internal(const char *path, const char *mode, const char *root, char **search, FILE **_f) { + char **i; + + assert(path); + assert(mode); + assert(_f); + +- if (!path_strv_canonicalize_absolute_uniq(search, NULL)) ++ if (!path_strv_canonicalize_absolute_uniq(search, root)) + return -ENOMEM; + + STRV_FOREACH(i, search) { +@@ -5718,7 +5718,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, char ** + return -ENOENT; + } + +-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f) { ++int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f) { + _cleanup_strv_free_ char **copy = NULL; + + assert(path); +@@ -5741,10 +5741,10 @@ int search_and_fopen(const char *path, const char *mode, const char **search, FI + if (!copy) + return -ENOMEM; + +- return search_and_fopen_internal(path, mode, copy, _f); ++ return search_and_fopen_internal(path, mode, root, copy, _f); + } + +-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f) { ++int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f) { + _cleanup_strv_free_ char **s = NULL; + + if (path_is_absolute(path)) { +@@ -5763,7 +5763,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *sear + if (!s) + return -ENOMEM; + +- return search_and_fopen_internal(path, mode, s, _f); ++ return search_and_fopen_internal(path, mode, root, s, _f); + } + + int create_tmp_dir(char template[], char** dir_name) { +diff --git a/src/shared/util.h b/src/shared/util.h +index f358362..b00395c 100644 +--- a/src/shared/util.h ++++ b/src/shared/util.h +@@ -629,8 +629,8 @@ char *strip_tab_ansi(char **p, size_t *l); + + int on_ac_power(void); + +-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f); +-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f); ++int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f); ++int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f); + int create_tmp_dir(char template[], char** dir_name); + + #define FOREACH_LINE(line, f, on_error) \ +diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c +index 70c4d89..1b7b482 100644 +--- a/src/sysctl/sysctl.c ++++ b/src/sysctl/sysctl.c +@@ -137,7 +137,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno + + assert(path); + +- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); ++ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); + if (r < 0) { + if (ignore_enoent && r == -ENOENT) + return 0; +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 6b0dfaf..ca99bb4 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -1364,7 +1364,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) { + + assert(fn); + +- r = search_and_fopen_nulstr(fn, "re", conf_file_dirs, &f); ++ r = search_and_fopen_nulstr(fn, "re", NULL, conf_file_dirs, &f); + if (r < 0) { + if (ignore_enoent && r == -ENOENT) + return 0; diff --git a/0476-shared-fix-search_and_fopen-with-alternate-roots.patch b/0476-shared-fix-search_and_fopen-with-alternate-roots.patch new file mode 100644 index 0000000..4f5b964 --- /dev/null +++ b/0476-shared-fix-search_and_fopen-with-alternate-roots.patch @@ -0,0 +1,30 @@ +From ff96d0f2ca97d7e94cb6252714e3b4c46136a462 Mon Sep 17 00:00:00 2001 +From: Michael Marineau +Date: Thu, 19 Jun 2014 19:07:06 -0700 +Subject: [PATCH] shared: fix search_and_fopen with alternate roots + +Update for the current behavior of path_strv_resolve which now returns +paths relative to the given root, not the full absolute paths. + +(cherry picked from commit 375eadd911a9f83f89f1e7de5e05f44cc81e3642) +(cherry picked from commit 686e842aecfc9f89547f9d9021afb9e1a21067ec) +--- + src/shared/util.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/shared/util.c b/src/shared/util.c +index 65a09d9..7aa3d02 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -5701,7 +5701,10 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c + _cleanup_free_ char *p = NULL; + FILE *f; + +- p = strjoin(*i, "/", path, NULL); ++ if (root) ++ p = strjoin(root, *i, "/", path, NULL); ++ else ++ p = strjoin(*i, "/", path, NULL); + if (!p) + return -ENOMEM; + diff --git a/0477-Reset-signal-mask-on-re-exec-to-init.patch b/0477-Reset-signal-mask-on-re-exec-to-init.patch new file mode 100644 index 0000000..a88d728 --- /dev/null +++ b/0477-Reset-signal-mask-on-re-exec-to-init.patch @@ -0,0 +1,51 @@ +From 2c4d473560b29aa6a3ee48faa07c3fe9e90dae7e Mon Sep 17 00:00:00 2001 +From: Ruediger Oertel +Date: Fri, 13 Jun 2014 16:41:06 +0200 +Subject: [PATCH] Reset signal-mask on re-exec to init=.. + +Process 1 (aka init) needs to be started with an empty signal mask. +That includes the process 1 that's started after the initrd is finished. +When the initrd is using systemd (as it does with dracut based initrds) +then it is systemd that calls the real init. Normally this is systemd +again, except when the user uses for instance "init=/bin/bash" on the +kernel command line. + +(cherry picked from commit 5a85ca1cb622fda4a39c8a6f00dccea7f8a1e82a) +(cherry picked from commit 3eb31d88fd664d55251102d8504d05426a97d0b3) +--- + src/core/main.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/core/main.c b/src/core/main.c +index 2a294c6..2f45485 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1748,6 +1748,7 @@ finish: + if (reexecute) { + const char **args; + unsigned i, args_size; ++ sigset_t ss, o_ss; + + /* Close and disarm the watchdog, so that the new + * instance can reinitialize it, but doesn't get +@@ -1831,6 +1832,11 @@ finish: + args[i++] = NULL; + assert(i <= args_size); + ++ /* reenable any blocked signals, especially important ++ * if we switch from initial ramdisk to init=... */ ++ sigemptyset(&ss); ++ sigprocmask(SIG_SETMASK, &ss, &o_ss); ++ + if (switch_root_init) { + args[0] = switch_root_init; + execv(args[0], (char* const*) args); +@@ -1849,6 +1855,8 @@ finish: + log_error("Failed to execute /bin/sh, giving up: %m"); + } else + log_warning("Failed to execute /sbin/init, giving up: %m"); ++ ++ sigprocmask(SIG_SETMASK, &o_ss, NULL); + } + + if (serialization) diff --git a/0478-core-clean-up-signal-reset-logic-when-reexec.patch b/0478-core-clean-up-signal-reset-logic-when-reexec.patch new file mode 100644 index 0000000..c57d57d --- /dev/null +++ b/0478-core-clean-up-signal-reset-logic-when-reexec.patch @@ -0,0 +1,50 @@ +From df2be2b86c8a1bd3e64bcdfb0e6a8160ec3e1bec Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 20 Jun 2014 16:58:21 +0200 +Subject: [PATCH] core: clean-up signal reset logic when reexec + +There's no need to save the old sigmask, if we are going to die. Let's +simplify this. Also, reset all the signal handlers, so that we don't +leave SIG_IGN set for some of them across reexec. + +(cherry picked from commit 9bfcda9528636914aef3e0ab91191bb81654c83d) +(cherry picked from commit 92254f72bbea94b8e640b829e2a0aef2a1aa4a36) +--- + src/core/main.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index 2f45485..8c994a8 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1748,7 +1748,7 @@ finish: + if (reexecute) { + const char **args; + unsigned i, args_size; +- sigset_t ss, o_ss; ++ sigset_t ss; + + /* Close and disarm the watchdog, so that the new + * instance can reinitialize it, but doesn't get +@@ -1834,8 +1834,10 @@ finish: + + /* reenable any blocked signals, especially important + * if we switch from initial ramdisk to init=... */ +- sigemptyset(&ss); +- sigprocmask(SIG_SETMASK, &ss, &o_ss); ++ reset_all_signal_handlers(); ++ ++ assert_se(sigemptyset(&ss) == 0); ++ assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0); + + if (switch_root_init) { + args[0] = switch_root_init; +@@ -1855,8 +1857,6 @@ finish: + log_error("Failed to execute /bin/sh, giving up: %m"); + } else + log_warning("Failed to execute /sbin/init, giving up: %m"); +- +- sigprocmask(SIG_SETMASK, &o_ss, NULL); + } + + if (serialization) diff --git a/0479-util-treat-fuse.sshfs-as-a-network-filesystem.patch b/0479-util-treat-fuse.sshfs-as-a-network-filesystem.patch new file mode 100644 index 0000000..b14bf20 --- /dev/null +++ b/0479-util-treat-fuse.sshfs-as-a-network-filesystem.patch @@ -0,0 +1,24 @@ +From 722b7000a9973c9f3460fd5c41dfd613041a0976 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 20 Jun 2014 22:43:49 -0400 +Subject: [PATCH] util: treat fuse.sshfs as a network filesystem + +https://bugs.freedesktop.org/show_bug.cgi?id=73727 +(cherry picked from commit da92ca5eb506d513033e0c7a85daf25a7e1c9d0e) +(cherry picked from commit e4798529d9ca623d360d6b012770bb0f9d8a5ea2) +--- + src/shared/util.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/shared/util.c b/src/shared/util.c +index 7aa3d02..e78e4e4 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -1629,6 +1629,7 @@ bool fstype_is_network(const char *fstype) { + static const char table[] = + "cifs\0" + "smbfs\0" ++ "sshfs\0" + "ncpfs\0" + "ncp\0" + "nfs\0" diff --git a/systemd.spec b/systemd.spec index 22d6f5d..60b5841 100644 --- a/systemd.spec +++ b/systemd.spec @@ -510,6 +510,14 @@ Patch468: 0468-cryptsetup-introduce-new-cryptsetup-pre.traget-unit-.patch Patch469: 0469-rules-add-loop-control-and-btrfs-control-to-disk-gro.patch Patch470: 0470-hwdb-Update-database-of-Bluetooth-company-identifier.patch Patch471: 0471-Fix-instance-argument-for-systemd-backlight-.service.patch +Patch472: 0472-socket-check-return-from-exec_spawn.patch +Patch473: 0473-getty-generator-properly-escape-instance-names.patch +Patch474: 0474-conf-files-include-root-in-returned-file-paths.patch +Patch475: 0475-shared-add-root-argument-to-search_and_fopen.patch +Patch476: 0476-shared-fix-search_and_fopen-with-alternate-roots.patch +Patch477: 0477-Reset-signal-mask-on-re-exec-to-init.patch +Patch478: 0478-core-clean-up-signal-reset-logic-when-reexec.patch +Patch479: 0479-util-treat-fuse.sshfs-as-a-network-filesystem.patch # kernel-install patch for grubby, drop if grubby is obsolete @@ -1160,6 +1168,7 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g %changelog * Fri Jun 20 2014 Zbigniew Jędrzejewski-Szmek - 208-19 - Fix patch +- Some more --root support and other assorted fixes * Tue Jun 17 2014 Zbigniew Jędrzejewski-Szmek - 208-18 - Fix permissions on new journal files (#1047729)