[systemd/f21] Backport a few patches

Zbigniew Jędrzejewski-Szmek zbyszek at fedoraproject.org
Thu Jan 22 16:09:11 UTC 2015


commit e1b4cbef8aaca5e7c2cf80dc882aa262d0ec5d6a
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Jan 22 11:03:08 2015 -0500

    Backport a few patches

 0194-hwdb-restore-comments-about-MSI-devices.patch |   39 +++++++++++
 ...yncd-consider-too-long-packets-as-invalid.patch |   30 ++++++++
 ...ion-Do-not-interpret-escape-sequences-in-.patch |   29 ++++++++
 ...x-syslog-forwarding-without-CAP_SYS_ADMIN.patch |   41 +++++++++++
 ...tor-Handle-.sh-suffixes-when-translating-.patch |   73 ++++++++++++++++++++
 ...til-Add-some-missing-hidden_file-suffixes.patch |   28 ++++++++
 ...ke-sure-not-to-concatenate-non-absolute-p.patch |   42 +++++++++++
 ...tor-only-allow-regular-files-in-enumerate.patch |   33 +++++++++
 0202-logind-fix-sd_eviocrevoke-ioctl-call.patch    |   28 ++++++++
 systemd.spec                                       |   14 ++++-
 10 files changed, 356 insertions(+), 1 deletions(-)
---
diff --git a/0194-hwdb-restore-comments-about-MSI-devices.patch b/0194-hwdb-restore-comments-about-MSI-devices.patch
new file mode 100644
index 0000000..be268e6
--- /dev/null
+++ b/0194-hwdb-restore-comments-about-MSI-devices.patch
@@ -0,0 +1,39 @@
+From 413b5781796351af0f66cf53f99f2e226d23b629 Mon Sep 17 00:00:00 2001
+From: Maxim Mikityanskiy <maxtram95 at gmail.com>
+Date: Sat, 17 Jan 2015 11:27:12 -0500
+Subject: [PATCH] hwdb: restore comments about MSI devices
+
+Some time ago 95-keymap.rules was replaced by
+60-keyboard.hwdb. Original comments for MSI laptops (that were in
+95-keymap.rules) were removed, but I think they are important for
+understanding what's going on.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=88412
+(cherry picked from commit 288026bda90245ae6523441ce308d58ad1caefc8)
+---
+ hwdb/60-keyboard.hwdb | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
+index f27eb7e81b..c6c07e8ed5 100644
+--- a/hwdb/60-keyboard.hwdb
++++ b/hwdb/60-keyboard.hwdb
+@@ -800,14 +800,16 @@ keyboard:dmi:bvn*:bvr*:bd*:svnMICRO-STAR*:pnGE70*:pvr*
+ keyboard:dmi:bvn*:bvr*:bd*:svnMicro-Star*:pn*:pvr*
+  KEYBOARD_KEY_c2=ejectcd
+ 
+-#
++# some MSI models generate ACPI/input events on the LNXVIDEO input devices,
++# plus some extra synthesized ones on atkbd as an echo of actually changing the
++# brightness; so ignore those atkbd ones, to avoid loops
+ keyboard:dmi:bvn*:bvr*:bd*:svnMICRO-STAR*:pn*U-100*:pvr*
+ keyboard:dmi:bvn*:bvr*:bd*:svnMICRO-STAR*:pn*U100*:pvr*
+ keyboard:dmi:bvn*:bvr*:bd*:svnMICRO-STAR*:pn*N033:*
+  KEYBOARD_KEY_f7=reserved
+  KEYBOARD_KEY_f8=reserved
+ 
+-#
++# MSI Wind U90/U100 generates separate touchpad on/off keycodes so ignore touchpad toggle keycode
+ keyboard:dmi:bvn*:bvr*:bd*:svnMICRO-STAR*:pnU90/U100:*
+  KEYBOARD_KEY_e4=reserved
+ 
diff --git a/0195-timesyncd-consider-too-long-packets-as-invalid.patch b/0195-timesyncd-consider-too-long-packets-as-invalid.patch
new file mode 100644
index 0000000..d5eec70
--- /dev/null
+++ b/0195-timesyncd-consider-too-long-packets-as-invalid.patch
@@ -0,0 +1,30 @@
+From 26ba2d214376ba0ebcf8b1b0dedca2fb5fb5733a Mon Sep 17 00:00:00 2001
+From: Topi Miettinen <toiwoton at gmail.com>
+Date: Sun, 18 Jan 2015 16:01:25 +0200
+Subject: [PATCH] timesyncd: consider too long packets as invalid
+
+If the received NTP message from server didn't fit to our buffer, either
+it is doing something nasty or we don't know the protocol. Consider the
+packet as invalid.
+
+(David: add parantheses around conditional)
+
+(cherry picked from commit 43fcd650e5cb0836cfc9f667ed74b3bc0283a81c)
+---
+ src/timesync/timesyncd-manager.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
+index 3ae01eb8fc..7c5632b776 100644
+--- a/src/timesync/timesyncd-manager.c
++++ b/src/timesync/timesyncd-manager.c
+@@ -534,7 +534,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
+                 return manager_connect(m);
+         }
+ 
+-        if (iov.iov_len < sizeof(struct ntp_msg)) {
++        /* Too short or too long packet? */
++        if (iov.iov_len < sizeof(struct ntp_msg) || (msghdr.msg_flags & MSG_TRUNC)) {
+                 log_warning("Invalid response from server. Disconnecting.");
+                 return manager_connect(m);
+         }
diff --git a/0196-zsh-completion-Do-not-interpret-escape-sequences-in-.patch b/0196-zsh-completion-Do-not-interpret-escape-sequences-in-.patch
new file mode 100644
index 0000000..e4183f4
--- /dev/null
+++ b/0196-zsh-completion-Do-not-interpret-escape-sequences-in-.patch
@@ -0,0 +1,29 @@
+From ca6494000fc1f396853baeeaaf880f8bf9b7d48f Mon Sep 17 00:00:00 2001
+From: Wieland Hoffmann <themineo at gmail.com>
+Date: Sat, 17 Jan 2015 02:10:42 +0100
+Subject: [PATCH] zsh-completion: Do not interpret escape sequences in
+ _filter_units_by_property
+
+This makes all functions that rely on _filter_units_by_property() (like
+_systemctl_{stop,kill,try_restart}) work with unit names that contain backslash
+escaped sequences (like automount units with spaces that are escaped to
+"\x20").
+
+(cherry picked from commit e37b56c7355a9b84ac1e1893ab828b19aa1dc217)
+---
+ shell-completion/zsh/_systemctl.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
+index 0ee4856fa3..acc0bb7e1a 100644
+--- a/shell-completion/zsh/_systemctl.in
++++ b/shell-completion/zsh/_systemctl.in
+@@ -136,7 +136,7 @@ _filter_units_by_property() {
+     unit=${units[i]}
+     prop=${(f)"$(_call_program units "$service show --no-pager --property="$property" ${unit} 2>/dev/null")"}
+     if [[ "${prop}" = "$property=$value" ]]; then
+-      echo " ${unit}"
++      echo -E - " ${unit}"
+     fi
+   done
+ }
diff --git a/0197-journal-Fix-syslog-forwarding-without-CAP_SYS_ADMIN.patch b/0197-journal-Fix-syslog-forwarding-without-CAP_SYS_ADMIN.patch
new file mode 100644
index 0000000..93349ed
--- /dev/null
+++ b/0197-journal-Fix-syslog-forwarding-without-CAP_SYS_ADMIN.patch
@@ -0,0 +1,41 @@
+From 260a413d76d67aeb7c20108ac1f40e677f26811d Mon Sep 17 00:00:00 2001
+From: Christian Seiler <christian at iwakd.de>
+Date: Tue, 13 Jan 2015 11:53:25 +0100
+Subject: [PATCH] journal: Fix syslog forwarding without CAP_SYS_ADMIN
+
+In case CAP_SYS_ADMIN is missing (like in containers), one cannot fake pid in
+struct ucred (uid/gid are fine if CAP_SETUID/CAP_SETGID are present).
+
+Ensure that journald will try again to forward the messages to syslog without
+faking the SCM_CREDENTIALS pid (which isn't guaranteed to succeed anyway, since
+it also does the same thing if the process has already exited).
+
+With this patch, journald will no longer silently discard messages
+that are supposed to be sent to syslog in these situations.
+
+https://bugs.debian.org/775067
+(cherry picked from commit ccf23ad5faf228d450d263d7291156a948b61af2)
+---
+ src/journal/journald-syslog.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
+index 79c07fffa1..7ca0147a82 100644
+--- a/src/journal/journald-syslog.c
++++ b/src/journal/journald-syslog.c
+@@ -85,12 +85,12 @@ static void forward_syslog_iovec(Server *s, const struct iovec *iovec, unsigned
+                 return;
+         }
+ 
+-        if (ucred && errno == ESRCH) {
++        if (ucred && (errno == ESRCH || errno == EPERM)) {
+                 struct ucred u;
+ 
+                 /* Hmm, presumably the sender process vanished
+-                 * by now, so let's fix it as good as we
+-                 * can, and retry */
++                 * by now, or we don't have CAP_SYS_AMDIN, so
++                 * let's fix it as good as we can, and retry */
+ 
+                 u = *ucred;
+                 u.pid = getpid();
diff --git a/0198-sysv-generator-Handle-.sh-suffixes-when-translating-.patch b/0198-sysv-generator-Handle-.sh-suffixes-when-translating-.patch
new file mode 100644
index 0000000..2c3b7f5
--- /dev/null
+++ b/0198-sysv-generator-Handle-.sh-suffixes-when-translating-.patch
@@ -0,0 +1,73 @@
+From cd1694328b8e947875bdd7a7356fbf798a52e18f Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Tue, 20 Jan 2015 16:41:31 +0100
+Subject: [PATCH] sysv-generator: Handle .sh suffixes when translating
+ Provides:
+
+When deciding whether the provided name equals the file name in
+sysv_translate_facility(), also consider them equal if the file name has a
+".sh" suffix.
+
+This was uncovered by commit b7e7184 which then created a symlink
+"<name>.service" to itself for ".sh" suffixed init.d scripts.
+
+For additional robustness, refuse to create symlinks to itself in add_alias().
+
+Add test case which reproduces the bug.
+
+https://bugs.debian.org/775889
+(cherry picked from commit 29e0e6d8c1f7f648b7c998880d034eaa3e58c53a)
+
+Conflicts:
+	test/sysv-generator-test.py
+---
+ src/sysv-generator/sysv-generator.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
+index bf49b24195..6bb9ca0eb4 100644
+--- a/src/sysv-generator/sysv-generator.c
++++ b/src/sysv-generator/sysv-generator.c
+@@ -119,6 +119,11 @@ static int add_alias(const char *service, const char *alias) {
+         assert(service);
+         assert(alias);
+ 
++        if (streq(service, alias)) {
++                log_error("Ignoring creation of an alias %s for itself", service);
++                return 0;
++        }
++
+         link = strjoin(arg_dest, "/", alias, NULL);
+         if (!link)
+                 return log_oom();
+@@ -268,6 +273,7 @@ static int sysv_translate_facility(const char *name, const char *filename, char
+         unsigned i;
+         char *r;
+         const char *n;
++        _cleanup_free_ char *filename_no_sh = NULL;
+ 
+         assert(name);
+         assert(_r);
+@@ -289,6 +295,13 @@ static int sysv_translate_facility(const char *name, const char *filename, char
+                 goto finish;
+         }
+ 
++        /* strip ".sh" suffix from file name for comparison */
++        filename_no_sh = strdup(filename);
++        if (!filename_no_sh)
++                return -ENOMEM;
++        if (endswith(filename, ".sh"))
++                filename_no_sh[strlen(filename)-3] = '\0';
++
+         /* If we don't know this name, fallback heuristics to figure
+          * out whether something is a target or a service alias. */
+ 
+@@ -298,7 +311,7 @@ static int sysv_translate_facility(const char *name, const char *filename, char
+ 
+                 /* Facilities starting with $ are most likely targets */
+                 r = unit_name_build(n, NULL, ".target");
+-        } else if (filename && streq(name, filename))
++        } else if (filename && streq(name, filename_no_sh))
+                 /* Names equaling the file name of the services are redundant */
+                 return 0;
+         else
diff --git a/0199-util-Add-some-missing-hidden_file-suffixes.patch b/0199-util-Add-some-missing-hidden_file-suffixes.patch
new file mode 100644
index 0000000..aac976f
--- /dev/null
+++ b/0199-util-Add-some-missing-hidden_file-suffixes.patch
@@ -0,0 +1,28 @@
+From 1fe702291728a81388305a797329e5ac4956b8c4 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Wed, 21 Jan 2015 15:26:13 +0100
+Subject: [PATCH] util: Add some missing hidden_file() suffixes
+
+dpkg itself also uses *.dpkg-dist, while .dpkg-{bak,backup,remove} are being
+used by dpkg-maintscript-helper.
+
+(cherry picked from commit c7088e4999f2e5dd33259948c806f4e2706e77ce)
+---
+ src/shared/util.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/shared/util.c b/src/shared/util.c
+index 688aa8bc13..6f22f2b04e 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -1441,6 +1441,10 @@ _pure_ static bool ignore_file_allow_backup(const char *filename) {
+                 endswith(filename, ".dpkg-old") ||
+                 endswith(filename, ".dpkg-new") ||
+                 endswith(filename, ".dpkg-tmp") ||
++                endswith(filename, ".dpkg-dist") ||
++                endswith(filename, ".dpkg-bak") ||
++                endswith(filename, ".dpkg-backup") ||
++                endswith(filename, ".dpkg-remove") ||
+                 endswith(filename, ".swp");
+ }
+ 
diff --git a/0200-tmpfiles-make-sure-not-to-concatenate-non-absolute-p.patch b/0200-tmpfiles-make-sure-not-to-concatenate-non-absolute-p.patch
new file mode 100644
index 0000000..266f867
--- /dev/null
+++ b/0200-tmpfiles-make-sure-not-to-concatenate-non-absolute-p.patch
@@ -0,0 +1,42 @@
+From 02df84807928361cc5dc546cbf85c0b1d6049c85 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek at in.waw.pl>
+Date: Fri, 9 Jan 2015 01:27:31 -0500
+Subject: [PATCH] tmpfiles: make sure not to concatenate non-absolute path
+
+If the path is absolute was only checked later.
+Also do not check if path if absolute if we just
+specified it starting with a slash.
+
+(cherry picked from commit 222c47f47615a275b9a9862a45f9b91b01eb8be5)
+---
+ src/tmpfiles/tmpfiles.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 29041388d3..2f63722446 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -1259,7 +1259,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
+ 
+         case CREATE_SYMLINK:
+                 if (!i->argument) {
+-                        i->argument = strappend("/usr/share/factory", i->path);
++                        i->argument = strappend("/usr/share/factory/", i->path);
+                         if (!i->argument)
+                                 return log_oom();
+                 }
+@@ -1274,12 +1274,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
+ 
+         case COPY_FILES:
+                 if (!i->argument) {
+-                        i->argument = strappend("/usr/share/factory", i->path);
++                        i->argument = strappend("/usr/share/factory/", i->path);
+                         if (!i->argument)
+                                 return log_oom();
+-                }
+-
+-                if (!path_is_absolute(i->argument)) {
++                } else if (!path_is_absolute(i->argument)) {
+                         log_error("[%s:%u] Source path is not absolute.", fname, line);
+                         return -EBADMSG;
+                 }
diff --git a/0201-sysv-generator-only-allow-regular-files-in-enumerate.patch b/0201-sysv-generator-only-allow-regular-files-in-enumerate.patch
new file mode 100644
index 0000000..f3b9c31
--- /dev/null
+++ b/0201-sysv-generator-only-allow-regular-files-in-enumerate.patch
@@ -0,0 +1,33 @@
+From 8874d83156b00e483e5d5d4a264a536355efaf07 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez at opensuse.org>
+Date: Wed, 14 Jan 2015 02:51:41 -0300
+Subject: [PATCH] sysv-generator: only allow regular files in enumerate_sysv()
+
+Otherwise, if the directory contains other directories we fail
+at fopen in load_sysv() with EISDIR.
+
+(cherry picked from commit 0814f65ec6feba5efcf0f5b14c054f3c40e4cd8f)
+
+Conflicts:
+	src/sysv-generator/sysv-generator.c
+---
+ src/sysv-generator/sysv-generator.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
+index 6bb9ca0eb4..c97db797df 100644
+--- a/src/sysv-generator/sysv-generator.c
++++ b/src/sysv-generator/sysv-generator.c
+@@ -745,8 +745,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
+                         struct stat st;
+                         int r;
+ 
+-                        if (ignore_file(de->d_name))
+-                                continue;
++                        dirent_ensure_type(d, de);
++
++                        if (!dirent_is_file(de))
++                            continue;
+ 
+                         if (fstatat(dirfd(d), de->d_name, &st, 0) < 0) {
+                                 log_warning("stat() failed on %s/%s: %s",
diff --git a/0202-logind-fix-sd_eviocrevoke-ioctl-call.patch b/0202-logind-fix-sd_eviocrevoke-ioctl-call.patch
new file mode 100644
index 0000000..0a71dc7
--- /dev/null
+++ b/0202-logind-fix-sd_eviocrevoke-ioctl-call.patch
@@ -0,0 +1,28 @@
+From 2b5a60aca874ab526d33912391ea491c267d246f Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 22 Jan 2015 11:36:02 +1000
+Subject: [PATCH] logind: fix sd_eviocrevoke ioctl call
+
+If the third argument is non-null, the kernel will always error out with
+EINVAL and devices won't get revoked.
+
+Reported-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+(cherry picked from commit 8dbce34b0373923c7aa7d795024bbedb0a85c7ea)
+---
+ src/login/logind-session-device.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
+index 932abb82f9..c2de862250 100644
+--- a/src/login/logind-session-device.c
++++ b/src/login/logind-session-device.c
+@@ -107,7 +107,7 @@ static int sd_eviocrevoke(int fd) {
+ 
+         assert(fd >= 0);
+ 
+-        r = ioctl(fd, EVIOCREVOKE, 1);
++        r = ioctl(fd, EVIOCREVOKE, NULL);
+         if (r < 0) {
+                 r = -errno;
+                 if (r == -EINVAL && !warned) {
diff --git a/systemd.spec b/systemd.spec
index 34fe879..d3c7012 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -16,7 +16,7 @@
 Name:           systemd
 Url:            http://www.freedesktop.org/wiki/Software/systemd
 Version:        216
-Release:        16%{?gitcommit:.git%{gitcommit}}%{?dist}
+Release:        17%{?gitcommit:.git%{gitcommit}}%{?dist}
 # For a breakdown of the licensing, see README
 License:        LGPLv2+ and MIT and GPLv2+
 Summary:        A System and Service Manager
@@ -234,6 +234,15 @@ Patch0190:      0190-fix-zsh-completion-typo.patch
 Patch0191:      0191-udev-fix-NULL-ptr-deref.patch
 Patch0192:      0192-manager-print-fatal-errors-on-the-console-too.patch
 Patch0193:      0193-login-rerun-vconsole-setup-when-switching-from-vgaco.patch
+Patch0194:      0194-hwdb-restore-comments-about-MSI-devices.patch
+Patch0195:      0195-timesyncd-consider-too-long-packets-as-invalid.patch
+Patch0196:      0196-zsh-completion-Do-not-interpret-escape-sequences-in-.patch
+Patch0197:      0197-journal-Fix-syslog-forwarding-without-CAP_SYS_ADMIN.patch
+Patch0198:      0198-sysv-generator-Handle-.sh-suffixes-when-translating-.patch
+Patch0199:      0199-util-Add-some-missing-hidden_file-suffixes.patch
+Patch0200:      0200-tmpfiles-make-sure-not-to-concatenate-non-absolute-p.patch
+Patch0201:      0201-sysv-generator-only-allow-regular-files-in-enumerate.patch
+Patch0202:      0202-logind-fix-sd_eviocrevoke-ioctl-call.patch
 
 
 Patch0997:      units-remove-dev-log-to-always-create-symlink.patch
@@ -1023,6 +1032,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
 %{_datadir}/systemd/gatewayd
 
 %changelog
+* Thu Jan 22 2015 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> - 216-17
+- Fix syslog forwarding in containers, make sysv generator more robust, fix logind revoke call
+
 * Fri Jan 16 2015 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> - 216-16
 - Fix patch
 


More information about the scm-commits mailing list