From f94b49098eb4ecd39e68f4e060fa0430e0749de37f498f30320be22df604dbf2 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 14 Jul 2014 14:10:23 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=714 --- ...pull-in-sd-event.h-from-event-util.h.patch | 24 +++++++++ 0002-util-fix-has-cc-check-and-add-test.patch | 25 +++++++++ ...call-epoll_ctl-on-mask-updates-if-ed.patch | 46 ++++++++++++++++ ...te-more-shell-characters-in-envfiles.patch | 54 +++++++++++++++++++ systemd-mini.changes | 9 ++++ systemd-mini.spec | 12 +++++ systemd.changes | 9 ++++ systemd.spec | 12 +++++ 8 files changed, 191 insertions(+) create mode 100644 0001-event-pull-in-sd-event.h-from-event-util.h.patch create mode 100644 0002-util-fix-has-cc-check-and-add-test.patch create mode 100644 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch create mode 100644 0004-fileio-quote-more-shell-characters-in-envfiles.patch diff --git a/0001-event-pull-in-sd-event.h-from-event-util.h.patch b/0001-event-pull-in-sd-event.h-from-event-util.h.patch new file mode 100644 index 00000000..e9fc98ce --- /dev/null +++ b/0001-event-pull-in-sd-event.h-from-event-util.h.patch @@ -0,0 +1,24 @@ +From 138992534878483de28417dfc61c546bba5cb8ad Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 10 Jul 2014 18:25:08 +0200 +Subject: [PATCH] event: pull in sd-event.h from event-util.h + +--- + src/libsystemd/sd-event/event-util.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git src/libsystemd/sd-event/event-util.h src/libsystemd/sd-event/event-util.h +index e58020d..e7cad9b 100644 +--- src/libsystemd/sd-event/event-util.h ++++ src/libsystemd/sd-event/event-util.h +@@ -22,6 +22,7 @@ + ***/ + + #include "util.h" ++#include "sd-event.h" + + DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event*, sd_event_unref); + DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event_source*, sd_event_source_unref); +-- +1.7.9.2 + diff --git a/0002-util-fix-has-cc-check-and-add-test.patch b/0002-util-fix-has-cc-check-and-add-test.patch new file mode 100644 index 00000000..f39ad16c --- /dev/null +++ b/0002-util-fix-has-cc-check-and-add-test.patch @@ -0,0 +1,25 @@ +Based on 1cb1767a29458b3d16d6b161b4ee34dd496ff60d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 11 Jul 2014 09:21:15 -0400 +Subject: [PATCH] util: fix has cc check and add test + +--- + src/shared/util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git src/shared/util.c src/shared/util.c +index 3342798..75dc58b 100644 +--- src/shared/util.c ++++ src/shared/util.c +@@ -5419,7 +5419,7 @@ bool string_has_cc(const char *p, const char *ok) { + + for (t = p; *t; t++) { + if (ok && strchr(ok, *t)) +- return false; ++ continue; + + if (*t > 0 && *t < ' ') + return true; +-- +1.7.9.2 + diff --git a/0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch b/0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch new file mode 100644 index 00000000..f401411e --- /dev/null +++ b/0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch @@ -0,0 +1,46 @@ +From b63c8d4f0364457b0ead8793504012bb7113974f Mon Sep 17 00:00:00 2001 +From: David Herrmann +Date: Thu, 10 Jul 2014 00:47:23 +0200 +Subject: [PATCH] sd-event: always call epoll_ctl() on mask-updates if + edge-triggered + +A call to sd_event_source_set_io_events() skipps calling into the kernel +if the new event-mask matches the old one. This is safe for +level-triggered sources as the kernel moves them onto the ready-list +automatically if events change. However, edge-triggered sources might not +be on the ready-list even though events are present. + +A call to sd_event_source_set_io_events() with EPOLLET set might thus be +used to just move the io-source onto the ready-list so the next poll +will return it again. This is very useful to avoid starvation in +priority-based event queues. + +Imagine a read() loop on an edge-triggered fd. If we cannot read data fast +enough to drain the receive queue, we might decide to skip reading for now +and schedule it for later. On edge-triggered io-sources we have to make +sure it's put on the ready-list so the next dispatch-round will return it +again if it's still the highest priority task. We could make sd-event +handle edge-triggered sources directly and allow marking them ready again. +However, it's much simpler to let the kernel do that for now via +EPOLL_CTL_MOD. +--- + src/libsystemd/sd-event/sd-event.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c +index 53f1904..a21f7db 100644 +--- src/libsystemd/sd-event/sd-event.c ++++ src/libsystemd/sd-event/sd-event.c +@@ -1282,7 +1282,8 @@ _public_ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events) + assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE); + assert_return(!event_pid_changed(s->event), -ECHILD); + +- if (s->io.events == events) ++ /* edge-triggered updates are never skipped, so we can reset edges */ ++ if (s->io.events == events && !(events & EPOLLET)) + return 0; + + if (s->enabled != SD_EVENT_OFF) { +-- +1.7.9.2 + diff --git a/0004-fileio-quote-more-shell-characters-in-envfiles.patch b/0004-fileio-quote-more-shell-characters-in-envfiles.patch new file mode 100644 index 00000000..b4cd3e96 --- /dev/null +++ b/0004-fileio-quote-more-shell-characters-in-envfiles.patch @@ -0,0 +1,54 @@ +From 0ce5a80601597fe4d1a715a8f70ce8d5ccaa2d86 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= +Date: Sun, 13 Jul 2014 18:49:00 +0300 +Subject: [PATCH] fileio: quote more shell characters in envfiles + +Turns out, making strings shell-proof is harder than expected: + + # machinectl set-hostname "foo|poweroff" && . /etc/machine-info + +(This could be simplified by quoting *and* escaping all characters, +which is harmless in shell but unnecessary.) +--- + src/shared/fileio.c | 4 ++-- + src/shared/util.h | 6 ++++++ + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git src/shared/fileio.c src/shared/fileio.c +index b0ab780..cbb40c2 100644 +--- src/shared/fileio.c ++++ src/shared/fileio.c +@@ -738,11 +738,11 @@ static void write_env_var(FILE *f, const char *v) { + p++; + fwrite(v, 1, p-v, f); + +- if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE "\'\"\\`$")) { ++ if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE SHELL_NEED_QUOTES)) { + fputc('\"', f); + + for (; *p; p++) { +- if (strchr("\'\"\\`$", *p)) ++ if (strchr(SHELL_NEED_ESCAPE, *p)) + fputc('\\', f); + + fputc(*p, f); +diff --git src/shared/util.h src/shared/util.h +index c5eadc9..b3187a9 100644 +--- src/shared/util.h ++++ src/shared/util.h +@@ -93,6 +93,12 @@ + #define COMMENTS "#;" + #define GLOB_CHARS "*?[" + ++/* What characters are special in the shell? */ ++/* must be escaped outside and inside double-quotes */ ++#define SHELL_NEED_ESCAPE "\"\\`$" ++/* can be escaped or double-quoted */ ++#define SHELL_NEED_QUOTES SHELL_NEED_ESCAPE GLOB_CHARS "'()<>|&;" ++ + #define FORMAT_BYTES_MAX 8 + + #define ANSI_HIGHLIGHT_ON "\x1B[1;39m" +-- +1.7.9.2 + diff --git a/systemd-mini.changes b/systemd-mini.changes index 0630b47a..ad2309f9 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jul 14 11:43:12 UTC 2014 - werner@suse.de + +- Add upstream patch + 0001-event-pull-in-sd-event.h-from-event-util.h.patch + 0002-util-fix-has-cc-check-and-add-test.patch + 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch + 0004-fileio-quote-more-shell-characters-in-envfiles.patch + ------------------------------------------------------------------- Fri Jul 11 12:21:06 UTC 2014 - werner@suse.de diff --git a/systemd-mini.spec b/systemd-mini.spec index d8caa48e..1744da66 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -683,6 +683,14 @@ Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch # PATCH-FIX-UPSTREAM added at 2014/07/10 Patch333: 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch334: 0001-event-pull-in-sd-event.h-from-event-util.h.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch335: 0002-util-fix-has-cc-check-and-add-test.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch336: 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch337: 0004-fileio-quote-more-shell-characters-in-envfiles.patch # UDEV PATCHES # ============ @@ -1279,6 +1287,10 @@ cp %{SOURCE7} m4/ %patch331 -p0 %patch332 -p0 %patch333 -p0 +%patch334 -p0 +%patch335 -p0 +%patch336 -p0 +%patch337 -p0 # udev patches %patch1001 -p1 diff --git a/systemd.changes b/systemd.changes index 0630b47a..ad2309f9 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jul 14 11:43:12 UTC 2014 - werner@suse.de + +- Add upstream patch + 0001-event-pull-in-sd-event.h-from-event-util.h.patch + 0002-util-fix-has-cc-check-and-add-test.patch + 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch + 0004-fileio-quote-more-shell-characters-in-envfiles.patch + ------------------------------------------------------------------- Fri Jul 11 12:21:06 UTC 2014 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index f605c34b..2a5de634 100644 --- a/systemd.spec +++ b/systemd.spec @@ -678,6 +678,14 @@ Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch # PATCH-FIX-UPSTREAM added at 2014/07/10 Patch333: 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch334: 0001-event-pull-in-sd-event.h-from-event-util.h.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch335: 0002-util-fix-has-cc-check-and-add-test.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch336: 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch +# PATCH-FIX-UPSTREAM added at 2014/07/14 +Patch337: 0004-fileio-quote-more-shell-characters-in-envfiles.patch # UDEV PATCHES # ============ @@ -1274,6 +1282,10 @@ cp %{SOURCE7} m4/ %patch331 -p0 %patch332 -p0 %patch333 -p0 +%patch334 -p0 +%patch335 -p0 +%patch336 -p0 +%patch337 -p0 # udev patches %patch1001 -p1