dracut-207-2

- add some upstream fixes for 207
- fixed swap activation
Resolves: rhbz#1008604
This commit is contained in:
Harald Hoyer 2013-09-16 17:11:41 -05:00
parent b9cb57759c
commit d4ee253068
26 changed files with 1540 additions and 1 deletions

View File

@ -0,0 +1,24 @@
From 2e987a0ac284a1cd1ab4f8e335abcae91c976f15 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 15 Feb 2013 09:07:57 +0100
Subject: [PATCH] RHEL: units: add [Install] section to tmp.mount
Related: #908253
---
units/tmp.mount | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/units/tmp.mount b/units/tmp.mount
index 99a3ba3..79e1c76 100644
--- a/units/tmp.mount
+++ b/units/tmp.mount
@@ -18,3 +18,9 @@ What=tmpfs
Where=/tmp
Type=tmpfs
Options=mode=1777,strictatime
+
+# tmp.mount is statically enabled in upstream. In RHEL tmp-on-tmpfs is not used
+# by default, but there are cases where it is necessary (anaconda, live images,
+# read-only root). Make 'systemctl enable tmp.mount' work:
+[Install]
+WantedBy=local-fs.target

View File

@ -0,0 +1,42 @@
From b81d902a8ec4e81c6ddda0208307ee77d4e0858b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 13 Mar 2013 07:57:53 +0100
Subject: [PATCH] kernel-install: add fedora specific callouts to
new-kernel-pkg
---
src/kernel-install/kernel-install | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index fb2ee57..f491947 100644
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -19,6 +19,27 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+if [[ -x /sbin/new-kernel-pkg ]]; then
+ [[ "$2" == *\+* ]] && flavor=-"${2##*+}"
+ case "$1" in
+ add)
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$2" || exit $?
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$2" || exit $?
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$2" || exit $?
+ ;;
+ remove)
+ /sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$2" || exit $?
+ ;;
+ *)
+ ;;
+ esac
+
+ # exit, if we can't find a boot loader spec conforming setup
+ if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then
+ exit 0
+ fi
+fi
+
usage()
{
echo "Usage:" >&2

View File

@ -0,0 +1,23 @@
From 89ad78921a404dc82f22862f2354707199ea1616 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 13 Sep 2013 14:31:17 +0200
Subject: [PATCH] core/cgroup: first print then free
---
src/core/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 3eeb475..513450a 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -395,8 +395,8 @@ static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) {
is_in_hash = true;
if (r < 0) {
- free(path);
log_error("cgroup %s exists already: %s", path, strerror(-r));
+ free(path);
return r;
}

View File

@ -0,0 +1,27 @@
From 0f84fab56d31f53b2970bdee64e254c4518618a7 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 13 Sep 2013 14:46:18 +0200
Subject: [PATCH] swap: fix reverse dependencies
Make sure swap.target correctly requires/wants the swap units.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=69291.
Reported-by: Hussam Al-Tayeb
---
src/core/swap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/swap.c b/src/core/swap.c
index 57d15eb..3950860 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -220,7 +220,7 @@ static int swap_add_default_dependencies(Swap *s) {
}
if (!noauto) {
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, (nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY),
+ r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
SPECIAL_SWAP_TARGET, NULL, true);
if (r < 0)
return r;

22
0005-update-TODO.patch Normal file
View File

@ -0,0 +1,22 @@
From d0746c1d17407a17c18f26876d9ca0f6f20b29b0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 13 Sep 2013 04:13:47 +0200
Subject: [PATCH] update TODO
---
TODO | 2 ++
1 file changed, 2 insertions(+)
diff --git a/TODO b/TODO
index 08d4914..5354692 100644
--- a/TODO
+++ b/TODO
@@ -58,6 +58,8 @@ CGroup Rework Completion:
Features:
+* Move backlight and random-seed into /var/lib/systemd
+
* When a Type=forking service fails and needed another service that
service is not cleaned up again when it has StopWhenUnneeded=yes
http://lists.freedesktop.org/archives/systemd-devel/2013-July/012141.html

View File

@ -0,0 +1,50 @@
From d12ed80037b482f7da136abbd7abce9c9219ef8e Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Thu, 15 Aug 2013 08:47:59 +0800
Subject: [PATCH] cryptsetup-generator: don't create tmp+swap units
---
src/cryptsetup/cryptsetup-generator.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 81b7708..967c5e6 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -72,13 +72,20 @@ static int create_disk(
_cleanup_free_ char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL;
_cleanup_fclose_ FILE *f = NULL;
- bool noauto, nofail;
+ bool noauto, nofail, tmp, swap;
assert(name);
assert(device);
noauto = has_option(options, "noauto");
nofail = has_option(options, "nofail");
+ tmp = has_option(options, "tmp");
+ swap = has_option(options, "swap");
+
+ if (tmp && swap) {
+ log_error("Device '%s' cannot be both 'tmp' and 'swap'. Ignoring.", name);
+ return -EINVAL;
+ }
n = unit_name_from_path_instance("systemd-cryptsetup", name, ".service");
if (!n)
@@ -151,12 +158,12 @@ static int create_disk(
name, u, strempty(password), strempty(options),
name);
- if (has_option(options, "tmp"))
+ if (tmp)
fprintf(f,
"ExecStartPost=/sbin/mke2fs '/dev/mapper/%s'\n",
name);
- if (has_option(options, "swap"))
+ if (swap)
fprintf(f,
"ExecStartPost=/sbin/mkswap '/dev/mapper/%s'\n",
name);

View File

@ -0,0 +1,185 @@
From 61ca2800f3a1666478bdc01fc796d36c917a5032 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sun, 18 Aug 2013 14:59:00 +0800
Subject: [PATCH] cryptsetup-generator: allow specifying options in
/proc/cmdline
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The main usecase for this is to make it possible to use cryptsetup in
the initrd without it having to include a host-specific /etc/crypttab.
Tested-by: Thomas Bächler <thomas@archlinux.org>
---
man/systemd-cryptsetup-generator.xml | 23 ++++++++++
src/cryptsetup/cryptsetup-generator.c | 79 +++++++++++++++++++++++++++++++++--
2 files changed, 98 insertions(+), 4 deletions(-)
diff --git a/man/systemd-cryptsetup-generator.xml b/man/systemd-cryptsetup-generator.xml
index 215ac2d..d6b7e49 100644
--- a/man/systemd-cryptsetup-generator.xml
+++ b/man/systemd-cryptsetup-generator.xml
@@ -137,6 +137,29 @@
will be activated in the initrd or the real root.</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>luks.options=</varname></term>
+ <term><varname>rd.luks.options=</varname></term>
+
+ <listitem><para>Takes a LUKS super
+ block UUID followed by an '=' and a string
+ of options separated by commas as argument.
+ This will override the options for the given
+ UUID.</para>
+ <para>If only a list of options, without an
+ UUID, is specified, they apply to any UUIDs not
+ specified elsewhere, and without an entry in
+ /etc/crypttab.</para><para>
+ <varname>rd.luks.options=</varname>
+ is honored only by initial RAM disk
+ (initrd) while
+ <varname>luks.options=</varname> is
+ honored by both the main system and
+ the initrd.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><varname>luks.key=</varname></term>
<term><varname>rd.luks.key=</varname></term>
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 967c5e6..ba6efa6 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -240,7 +240,7 @@ static int create_disk(
return 0;
}
-static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cmdline_keyfile) {
+static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char ***arg_proc_cmdline_options, char **arg_proc_cmdline_keyfile) {
_cleanup_free_ char *line = NULL;
char *w = NULL, *state = NULL;
int r;
@@ -307,7 +307,20 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
return log_oom();
}
+ } else if (startswith(word, "luks.options=")) {
+ if (strv_extend(arg_proc_cmdline_options, word + 13) < 0)
+ return log_oom();
+
+ } else if (startswith(word, "rd.luks.options=")) {
+
+ if (in_initrd()) {
+ if (strv_extend(arg_proc_cmdline_options, word + 16) < 0)
+ return log_oom();
+ }
+
} else if (startswith(word, "luks.key=")) {
+ if (*arg_proc_cmdline_keyfile)
+ free(*arg_proc_cmdline_keyfile);
*arg_proc_cmdline_keyfile = strdup(word + 9);
if (!*arg_proc_cmdline_keyfile)
return log_oom();
@@ -337,6 +350,7 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
int main(int argc, char *argv[]) {
_cleanup_strv_free_ char **arg_proc_cmdline_disks_done = NULL;
_cleanup_strv_free_ char **arg_proc_cmdline_disks = NULL;
+ _cleanup_strv_free_ char **arg_proc_cmdline_options = NULL;
_cleanup_free_ char *arg_proc_cmdline_keyfile = NULL;
_cleanup_fclose_ FILE *f = NULL;
unsigned n = 0;
@@ -357,7 +371,7 @@ int main(int argc, char *argv[]) {
umask(0022);
- if (parse_proc_cmdline(&arg_proc_cmdline_disks, &arg_proc_cmdline_keyfile) < 0)
+ if (parse_proc_cmdline(&arg_proc_cmdline_disks, &arg_proc_cmdline_options, &arg_proc_cmdline_keyfile) < 0)
return EXIT_FAILURE;
if (!arg_enabled)
@@ -412,6 +426,26 @@ int main(int argc, char *argv[]) {
continue;
}
+ if (arg_proc_cmdline_options) {
+ /*
+ If options are specified on the kernel commandline, let them override
+ the ones from crypttab.
+ */
+ STRV_FOREACH(i, arg_proc_cmdline_options) {
+ _cleanup_free_ char *proc_uuid = NULL, *proc_options = NULL;
+ const char *p = *i;
+
+ k = sscanf(p, "%m[0-9a-fA-F-]=%ms", &proc_uuid, &proc_options);
+ if (k == 2 && streq(proc_uuid, device + 5)) {
+ if (options)
+ free(options);
+ options = strdup(p);
+ if (!proc_options)
+ return log_oom();
+ }
+ }
+ }
+
if (arg_proc_cmdline_disks) {
/*
If luks UUIDs are specified on the kernel command line, use them as a filter
@@ -452,7 +486,7 @@ next:
on the kernel command line and not yet written.
*/
- _cleanup_free_ char *name = NULL, *device = NULL;
+ _cleanup_free_ char *name = NULL, *device = NULL, *options = NULL;
const char *p = *i;
if (startswith(p, "luks-"))
@@ -467,7 +501,44 @@ next:
if (!name || !device)
return log_oom();
- if (create_disk(name, device, arg_proc_cmdline_keyfile, "timeout=0") < 0)
+ if (arg_proc_cmdline_options) {
+ /*
+ If options are specified on the kernel commandline, use them.
+ */
+ char **j;
+
+ STRV_FOREACH(j, arg_proc_cmdline_options) {
+ _cleanup_free_ char *proc_uuid = NULL, *proc_options = NULL;
+ const char *s = *j;
+ int k;
+
+ k = sscanf(s, "%m[0-9a-fA-F-]=%ms", &proc_uuid, &proc_options);
+ if (k == 2) {
+ if (streq(proc_uuid, device + 5)) {
+ if (options)
+ free(options);
+ options = strdup(proc_options);
+ if (!options)
+ return log_oom();
+ }
+ } else if (!options) {
+ /*
+ Fall back to options without a specified UUID
+ */
+ options = strdup(s);
+ if (!options)
+ return log_oom();
+ }
+ }
+ }
+
+ if (!options) {
+ options = strdup("timeout=0");
+ if (!options)
+ return log_oom();
+ }
+
+ if (create_disk(name, device, arg_proc_cmdline_keyfile, options) < 0)
r = EXIT_FAILURE;
}

View File

@ -0,0 +1,41 @@
From 091169fa11a366ab42fb6f71c22e8ed95868f804 Mon Sep 17 00:00:00 2001
From: David Mackey <tdmackey@booleanhaiku.com>
Date: Thu, 12 Sep 2013 19:45:49 -0700
Subject: [PATCH] automount: rename repeat_unmont to repeat_unmount
Trivial cleanup of repeat_unmount() spelling.
---
src/core/automount.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/automount.c b/src/core/automount.c
index a20d534..6762392 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -66,7 +66,7 @@ static void automount_init(Unit *u) {
UNIT(a)->ignore_on_isolate = true;
}
-static void repeat_unmout(const char *path) {
+static void repeat_unmount(const char *path) {
assert(path);
for (;;) {
@@ -100,7 +100,7 @@ static void unmount_autofs(Automount *a) {
if (a->where &&
(UNIT(a)->manager->exit_code != MANAGER_RELOAD &&
UNIT(a)->manager->exit_code != MANAGER_REEXECUTE))
- repeat_unmout(a->where);
+ repeat_unmount(a->where);
}
static void automount_done(Unit *u) {
@@ -575,7 +575,7 @@ fail:
close_nointr_nofail(ioctl_fd);
if (mounted)
- repeat_unmout(a->where);
+ repeat_unmount(a->where);
log_error_unit(UNIT(a)->id,
"Failed to initialize automounter: %s", strerror(-r));

View File

@ -0,0 +1,24 @@
From 8799f0a37ef24fe2709b6e7fdb4ca2c1c9586718 Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Fri, 13 Sep 2013 11:17:05 +0800
Subject: [PATCH] cgroup: add the missing setting of variable's value
set the value of variable "r" to the return value
of cg_set_attribute.
---
src/core/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 513450a..9804227 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -264,7 +264,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
log_error("Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
sprintf(buf, "%" PRIu64 "\n", c->memory_soft_limit);
- cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", buf);
+ r = cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", buf);
if (r < 0)
log_error("Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
}

View File

@ -0,0 +1,23 @@
From 9b69c0d07b0db38c181e35e52bcea0eb0dd21818 Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Fri, 13 Sep 2013 11:17:06 +0800
Subject: [PATCH] cgroup: correct the log information
it should be memory.soft_limit_in_bytes.
---
src/core/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 9804227..08cb64b 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -266,7 +266,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
sprintf(buf, "%" PRIu64 "\n", c->memory_soft_limit);
r = cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", buf);
if (r < 0)
- log_error("Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
+ log_error("Failed to set memory.soft_limit_in_bytes on %s: %s", path, strerror(-r));
}
if (mask & CGROUP_DEVICE) {

View File

@ -0,0 +1,43 @@
From c7e5130d5b3983986bfe95918c75e083fa90dd47 Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Fri, 13 Sep 2013 14:43:04 +0800
Subject: [PATCH] cgroup: fix incorrectly setting memory cgroup
If the memory_limit of unit is -1, we should write "-1"
to the file memory.limit_in_bytes. not the (unit64_t) -1.
otherwise the memory.limit_in_bytes will be set to zero.
---
src/core/cgroup.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 08cb64b..1f41efc 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -257,14 +257,21 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
if (mask & CGROUP_MEMORY) {
char buf[DECIMAL_STR_MAX(uint64_t) + 1];
+ if (c->memory_limit != (uint64_t) -1) {
+ sprintf(buf, "%" PRIu64 "\n", c->memory_limit);
+ r = cg_set_attribute("memory", path, "memory.limit_in_bytes", buf);
+ } else
+ r = cg_set_attribute("memory", path, "memory.limit_in_bytes", "-1");
- sprintf(buf, "%" PRIu64 "\n", c->memory_limit);
- r = cg_set_attribute("memory", path, "memory.limit_in_bytes", buf);
if (r < 0)
log_error("Failed to set memory.limit_in_bytes on %s: %s", path, strerror(-r));
- sprintf(buf, "%" PRIu64 "\n", c->memory_soft_limit);
- r = cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", buf);
+ if (c->memory_soft_limit != (uint64_t) -1) {
+ sprintf(buf, "%" PRIu64 "\n", c->memory_soft_limit);
+ r = cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", buf);
+ } else
+ r = cg_set_attribute("memory", path, "memory.soft_limit_in_bytes", "-1");
+
if (r < 0)
log_error("Failed to set memory.soft_limit_in_bytes on %s: %s", path, strerror(-r));
}

View File

@ -0,0 +1,22 @@
From 198884f22dc432a98e3d4423434b9e97d67f2da8 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 13 Sep 2013 14:12:55 +0200
Subject: [PATCH] random-seed: we should return errno of failed loop_write
---
src/random-seed/random-seed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index 4776c07..afbd500 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
r = loop_write(seed_fd, buf, (size_t) k, false);
if (r <= 0) {
log_error("Failed to write new random seed file: %s", r < 0 ? strerror(-r) : "short write");
- r = k == 0 ? -EIO : (int) k;
+ r = r == 0 ? -EIO : r;
}
}

24
0013-update-TODO.patch Normal file
View File

@ -0,0 +1,24 @@
From f11f72532fd9a05149714229cb7559b8e3fa802a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 13 Sep 2013 14:28:17 +0200
Subject: [PATCH] update TODO
---
TODO | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/TODO b/TODO
index 5354692..9943b3e 100644
--- a/TODO
+++ b/TODO
@@ -60,6 +60,10 @@ Features:
* Move backlight and random-seed into /var/lib/systemd
+* If we try to find a unit via a danglign symlink generate a clean
+ error. Currently we just ignore it and read the unit from the search
+ path anyway.
+
* When a Type=forking service fails and needed another service that
service is not cleaned up again when it has StopWhenUnneeded=yes
http://lists.freedesktop.org/archives/systemd-devel/2013-July/012141.html

View File

@ -0,0 +1,24 @@
From 3b93bf5a35b0bb7111754fbae75e7654b775506d Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 13 Sep 2013 14:12:54 +0200
Subject: [PATCH] libudev: fix move_later comparison
At the beginning move_later is set to -1, but it is set to different
value only if expression !move_later is true.
---
src/libudev/libudev-enumerate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index bc1e37d..8146f27 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -300,7 +300,7 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
/* skip to be delayed devices, and move the to
* the point where the prefix changes. We can
* only move one item at a time. */
- if (!move_later) {
+ if (move_later == -1) {
move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath);
if (move_later_prefix > 0) {

View File

@ -0,0 +1,23 @@
From 583f4eb5d443bc09502d6973f08755173db43fd8 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 13 Sep 2013 21:03:55 +0200
Subject: [PATCH] man: document luks.options kernel commandline
This should have been part of commit 7ab064a6d
---
man/kernel-command-line.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index a4b7d13..cc267a3 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -250,6 +250,8 @@
<term><varname>rd.luks.crypttab=</varname></term>
<term><varname>luks.uuid=</varname></term>
<term><varname>rd.luks.uuid=</varname></term>
+ <term><varname>luks.options=</varname></term>
+ <term><varname>rd.luks.options=</varname></term>
<term><varname>luks.key=</varname></term>
<term><varname>rd.luks.key=</varname></term>

View File

@ -0,0 +1,33 @@
From f559cb147ae336f62a9020fa909b70ea90e43886 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 28 Aug 2013 17:23:59 -0400
Subject: [PATCH] keymap: remove some commented out lines
---
hwdb/60-keyboard.hwdb | 6 ------
1 file changed, 6 deletions(-)
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index eca3f55..53e83ad 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -894,11 +894,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*200E[45]*:pvr*
# Series 5
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
-#KEYBOARD_KEY_89=!brightnessdown # Fn+F2
-#KEYBOARD_KEY_88=!brightnessup # Fn+F3
-#KEYBOARD_KEY_82=!switchvideomode # Fn+F4 video output
-#KEYBOARD_KEY_f9=!f23 # Fn+F5 touchpad turn OFF
-#KEYBOARD_KEY_f7=!f22 # Fn+F5 touchpad turn ON
KEYBOARD_KEY_a0=!mute # Fn+F6 mute
KEYBOARD_KEY_ae=!volumedown # Fn+F7
KEYBOARD_KEY_b0=!volumeup # Fn+F8
@@ -906,7 +901,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up
KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer
KEYBOARD_KEY_d5=!wlan # Fn+F12 wlan/airplane switch
-# KEYBOARD_KEY_ba=!ejectcd # Fn+DEL eject cd
# Series 9
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*90X3A*:pvr*

View File

@ -0,0 +1,259 @@
From 3559039a97e1d3e28dd9b38202d3499652a58036 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 13 Sep 2013 19:41:52 -0400
Subject: [PATCH] Advertise hibernation only if there's enough free swap
Condition that is checked is taken from upower:
active(anon) < free swap * 0.98
This is really stupid, because the kernel knows the situation better,
e.g. there could be two swap files, and then hibernation would be
impossible despite passing this check, or the kernel could start
supporting compressed swap and/or compressed hibernation images, and
then this this check would be too stringent. Nevertheless, until
we have something better, this should at least return a true negative
if there's no swap.
Logging of capabilities in the journal is changed to not strip leading
zeros. I consider this more readable anyway.
http://cgit.freedesktop.org/upower/tree/src/up-daemon.c#n613
https://bugzilla.redhat.com/show_bug.cgi?id=1007059
---
src/shared/fileio.c | 34 ++++++++++++++++++++++++++++++++++
src/shared/fileio.h | 2 ++
src/shared/logs-show.c | 2 +-
src/shared/sleep-config.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
src/shared/util.c | 23 +----------------------
src/test/test-fileio.c | 20 ++++++++++++++++++++
src/test/test-sleep.c | 16 ++++++++--------
7 files changed, 110 insertions(+), 32 deletions(-)
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 77fd059..4e2b444 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -648,3 +648,37 @@ int executable_is_script(const char *path, char **interpreter) {
*interpreter = ans;
return 1;
}
+
+/**
+ * Retrieve one field from a file like /proc/self/status.
+ * pattern should start with '\n' and end with ':'. Whitespace
+ * after ':' will be skipped. field must be freed afterwards.
+ */
+int get_status_field(const char *filename, const char *pattern, char **field) {
+ _cleanup_free_ char *status = NULL;
+ char *t;
+ size_t len;
+ int r;
+
+ assert(filename);
+ assert(field);
+
+ r = read_full_file(filename, &status, NULL);
+ if (r < 0)
+ return r;
+
+ t = strstr(status, pattern);
+ if (!t)
+ return -ENOENT;
+
+ t += strlen(pattern);
+ t += strspn(t, WHITESPACE);
+
+ len = strcspn(t, WHITESPACE);
+
+ *field = strndup(t, len);
+ if (!*field)
+ return -ENOMEM;
+
+ return 0;
+}
diff --git a/src/shared/fileio.h b/src/shared/fileio.h
index a0aae28..59e4150 100644
--- a/src/shared/fileio.h
+++ b/src/shared/fileio.h
@@ -37,3 +37,5 @@ int load_env_file(const char *fname, const char *separator, char ***l);
int write_env_file(const char *fname, char **l);
int executable_is_script(const char *path, char **interpreter);
+
+int get_status_field(const char *filename, const char *pattern, char **field);
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 87633e7..f50777c 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -201,7 +201,7 @@ static int output_short(
assert(j);
/* Set the threshold to one bigger than the actual print
- * treshold, so that if the line is actually longer than what
+ * threshold, so that if the line is actually longer than what
* we're willing to print, ellipsization will occur. This way
* we won't output a misleading line without any indication of
* truncation.
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index cd3238b..5ec7cce 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -163,6 +163,46 @@ int can_sleep_disk(char **types) {
return false;
}
+#define HIBERNATION_SWAP_THRESHOLD 0.98
+
+static bool enough_memory_for_hibernation(void) {
+ _cleanup_free_ char *active = NULL, *swapfree = NULL;
+ unsigned long long act, swap;
+ int r;
+
+ r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
+ if (r < 0) {
+ log_error("Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
+ return false;
+ }
+
+ r = safe_atollu(swapfree, &swap);
+ if (r < 0) {
+ log_error("Failed to parse SwapFree from /proc/meminfo: %s: %s",
+ swapfree, strerror(-r));
+ return false;
+ }
+
+ r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
+ if (r < 0) {
+ log_error("Failed to retrieve Active(anon) from /proc/meminfo: %s", strerror(-r));
+ return false;
+ }
+
+ r = safe_atollu(active, &act);
+ if (r < 0) {
+ log_error("Failed to parse Active(anon) from /proc/meminfo: %s: %s",
+ active, strerror(-r));
+ return false;
+ }
+
+ r = act <= swap * HIBERNATION_SWAP_THRESHOLD;
+ log_debug("Hibernation is %spossible, Active(anon)=%llu kB, SwapFree=%llu kB, threshold=%.2g%%",
+ r ? "" : "im", act, swap, 100*HIBERNATION_SWAP_THRESHOLD);
+
+ return r;
+}
+
int can_sleep(const char *verb) {
_cleanup_strv_free_ char **modes = NULL, **states = NULL;
int r;
@@ -175,5 +215,8 @@ int can_sleep(const char *verb) {
if (r < 0)
return false;
- return can_sleep_state(states) && can_sleep_disk(modes);
+ if (!can_sleep_state(states) || !can_sleep_disk(modes))
+ return false;
+
+ return streq(verb, "suspend") || enough_memory_for_hibernation();
}
diff --git a/src/shared/util.c b/src/shared/util.c
index 9a075fa..f6f3b18 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -694,9 +694,6 @@ int is_kernel_thread(pid_t pid) {
int get_process_capeff(pid_t pid, char **capeff) {
const char *p;
- _cleanup_free_ char *status = NULL;
- char *t = NULL;
- int r;
assert(capeff);
assert(pid >= 0);
@@ -706,25 +703,7 @@ int get_process_capeff(pid_t pid, char **capeff) {
else
p = procfs_file_alloca(pid, "status");
- r = read_full_file(p, &status, NULL);
- if (r < 0)
- return r;
-
- t = strstr(status, "\nCapEff:\t");
- if (!t)
- return -ENOENT;
-
- for (t += strlen("\nCapEff:\t"); t[0] == '0'; t++)
- continue;
-
- if (t[0] == '\n')
- t--;
-
- *capeff = strndup(t, strchr(t, '\n') - t);
- if (!*capeff)
- return -ENOMEM;
-
- return 0;
+ return get_status_field(p, "\nCapEff:", capeff);
}
int get_process_exe(pid_t pid, char **name) {
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 1184e7e..4a4ed79 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -229,9 +229,29 @@ static void test_executable_is_script(void) {
unlink(t);
}
+static void test_status_field(void) {
+ _cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
+ unsigned long long total, buffers;
+
+ assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
+ puts(t);
+ assert_se(streq(t, "1"));
+
+ assert_se(get_status_field("/proc/meminfo", "MemTotal:", &p) == 0);
+ puts(p);
+ assert_se(safe_atollu(p, &total) == 0);
+
+ assert_se(get_status_field("/proc/meminfo", "\nBuffers:", &s) == 0);
+ puts(s);
+ assert_se(safe_atollu(s, &buffers) == 0);
+
+ assert(buffers < total);
+}
+
int main(int argc, char *argv[]) {
test_parse_env_file();
test_parse_multiline_env_file();
test_executable_is_script();
+ test_status_field();
return 0;
}
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index c3cb9c5..545dfab 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -40,14 +40,14 @@ int main(int argc, char* argv[]) {
**shutdown = strv_new("shutdown", NULL),
**freez = strv_new("freeze", NULL);
- log_info("Can Standby: %s", yes_no(can_sleep_state(standby) > 0));
- log_info("Can Suspend: %s", yes_no(can_sleep_state(mem) > 0));
- log_info("Can Hibernate: %s", yes_no(can_sleep_state(disk) > 0));
- log_info("Can Hibernate+Suspend (Hybrid-Sleep): %s", yes_no(can_sleep_disk(suspend) > 0));
- log_info("Can Hibernate+Reboot: %s", yes_no(can_sleep_disk(reboot) > 0));
- log_info("Can Hibernate+Platform: %s", yes_no(can_sleep_disk(platform) > 0));
- log_info("Can Hibernate+Shutdown: %s", yes_no(can_sleep_disk(shutdown) > 0));
- log_info("Can Freeze: %s", yes_no(can_sleep_disk(freez) > 0));
+ log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0));
+ log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0));
+ log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0));
+ log_info("Hibernate+Suspend (Hybrid-Sleep) configured: %s", yes_no(can_sleep_disk(suspend) > 0));
+ log_info("Hibernate+Reboot configured: %s", yes_no(can_sleep_disk(reboot) > 0));
+ log_info("Hibernate+Platform configured: %s", yes_no(can_sleep_disk(platform) > 0));
+ log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0));
+ log_info("Freeze configured: %s", yes_no(can_sleep_state(freez) > 0));
log_info("Suspend configured and possible: %s", yes_no(can_sleep("suspend") > 0));
log_info("Hibernation configured and possible: %s", yes_no(can_sleep("hibernate") > 0));

View File

@ -0,0 +1,24 @@
From 64a94f1e45890eaeb5880dbd2044265e17023067 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sun, 15 Sep 2013 07:29:25 +0200
Subject: [PATCH] README: add SCSI BSG option
---
README | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README b/README
index a16f342..b39cd37 100644
--- a/README
+++ b/README
@@ -64,6 +64,10 @@ REQUIREMENTS:
Mount and bind mount handling might require it:
CONFIG_FHANDLE
+ Support for some SCSI devices serial number retrieval, to
+ create additional symlinks in /dev/disk/ and /dev/tape:
+ CONFIG_BLK_DEV_BSG
+
Optional but strongly recommended:
CONFIG_IPV6
CONFIG_AUTOFS4_FS

View File

@ -0,0 +1,87 @@
From c1f9c15f319f7dfb96bcbf2c3cf879f2b4457350 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 16 Sep 2013 01:08:32 +0200
Subject: [PATCH] swap: create .wants symlink to 'auto' swap devices
As we load unit files lazily, we need to make sure something pulls in swap
units that should be started automatically, otherwise the default dependencies
will never be applied.
This partially reinstates code removed in
commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4.
Also don't order swap devices after swap.target when they are 'nofail'.
---
src/core/swap.c | 8 ++++++--
src/fstab-generator/fstab-generator.c | 18 ++++++++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/core/swap.c b/src/core/swap.c
index 3950860..76c7d45 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -220,8 +220,12 @@ static int swap_add_default_dependencies(Swap *s) {
}
if (!noauto) {
- r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
- SPECIAL_SWAP_TARGET, NULL, true);
+ if (nofail)
+ r = unit_add_dependency_by_name_inverse(UNIT(s),
+ UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true);
+ else
+ r = unit_add_two_dependencies_by_name_inverse(UNIT(s),
+ UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true);
if (r < 0)
return r;
}
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 6ebe8aa..b73dfa4 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -66,6 +66,7 @@ static int mount_find_pri(struct mntent *me, int *ret) {
static int add_swap(const char *what, struct mntent *me) {
_cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
_cleanup_fclose_ FILE *f = NULL;
+ bool noauto;
int r, pri = -1;
assert(what);
@@ -77,6 +78,8 @@ static int add_swap(const char *what, struct mntent *me) {
return pri;
}
+ noauto = !!hasmntopt(me, "noauto");
+
name = unit_name_from_path(what, ".swap");
if (!name)
return log_oom();
@@ -97,8 +100,7 @@ static int add_swap(const char *what, struct mntent *me) {
fprintf(f,
"# Automatically generated by systemd-fstab-generator\n\n"
"[Unit]\n"
- "SourcePath=/etc/fstab\n"
- "\n"
+ "SourcePath=/etc/fstab\n\n"
"[Swap]\n"
"What=%s\n",
what);
@@ -114,6 +116,18 @@ static int add_swap(const char *what, struct mntent *me) {
return -errno;
}
+ if (!noauto) {
+ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
+ if (!lnk)
+ return log_oom();
+
+ mkdir_parents_label(lnk, 0755);
+ if (symlink(unit, lnk) < 0) {
+ log_error("Failed to create symlink %s: %m", lnk);
+ return -errno;
+ }
+ }
+
return 0;
}

View File

@ -0,0 +1,22 @@
From f93999bbdbc9e16322d77bda2a4e44c20040808d Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Mon, 16 Sep 2013 09:57:33 +0800
Subject: [PATCH] cgroup: add missing equals for BlockIOWeight
---
src/core/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 1f41efc..9277dd6 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -92,7 +92,7 @@ void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix) {
"%sBlockIOAccounting=%s\n"
"%sMemoryAccounting=%s\n"
"%sCPUShares=%lu\n"
- "%sBlockIOWeight%lu\n"
+ "%sBlockIOWeight=%lu\n"
"%sMemoryLimit=%" PRIu64 "\n"
"%sMemorySoftLimit=%" PRIu64 "\n"
"%sDevicePolicy=%s\n",

View File

@ -0,0 +1,50 @@
From 0fdb6640bb9de89ca739676bbbb43d3a05a42f50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 15 Sep 2013 08:40:16 -0400
Subject: [PATCH] Assume that /proc/meminfo can be missing
Travis tests are failing, probably because /proc/meminfo is not available
in the test environment. The same might be true in some virtualized systems,
so just treat missing /proc/meminfo as a sign that hibernation is not
possible.
---
src/shared/sleep-config.c | 3 ++-
src/test/test-fileio.c | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 5ec7cce..148c4dc 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -172,7 +172,8 @@ static bool enough_memory_for_hibernation(void) {
r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
if (r < 0) {
- log_error("Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
+ log_full(r == -ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
return false;
}
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 4a4ed79..3511f3a 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -232,12 +232,16 @@ static void test_executable_is_script(void) {
static void test_status_field(void) {
_cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
unsigned long long total, buffers;
+ int r;
assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
puts(t);
assert_se(streq(t, "1"));
- assert_se(get_status_field("/proc/meminfo", "MemTotal:", &p) == 0);
+ r = get_status_field("/proc/meminfo", "MemTotal:", &p);
+ if (r == -ENOENT)
+ return;
+ assert(r == 0);
puts(p);
assert_se(safe_atollu(p, &total) == 0);

View File

@ -0,0 +1,63 @@
From a38c3d5d4e94c7e11db1ca22126bb11c6b029886 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 15 Sep 2013 12:15:38 -0400
Subject: [PATCH] transaction.c: do not point users to logs when unit not found
The logs are unlikely to contain any useful information in this case.
Also, change "walked on cycle path" to "found dependency on", which
is less technical and indicates the direction. With the old message,
I was never sure if prior units depended on later ones, or vice versa.
https://bugzilla.redhat.com/show_bug.cgi?id=996133
https://bugzilla.redhat.com/show_bug.cgi?id=997082
---
src/core/transaction.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 27efef7..203070f 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -344,7 +344,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
assert(!j->transaction_prev);
/* Does a recursive sweep through the ordering graph, looking
- * for a cycle. If we find cycle we try to break it. */
+ * for a cycle. If we find a cycle we try to break it. */
/* Have we seen this before? */
if (j->generation == generation) {
@@ -371,7 +371,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
/* logging for j not k here here to provide consistent narrative */
log_info_unit(j->unit->id,
- "Walked on cycle path to %s/%s",
+ "Found dependency on %s/%s",
k->unit->id, job_type_to_string(k->type));
if (!delete &&
@@ -860,7 +860,7 @@ int transaction_add_job_and_dependencies(
return -EINVAL;
}
- if (type != JOB_STOP && (unit->load_state == UNIT_ERROR || unit->load_state == UNIT_NOT_FOUND)) {
+ if (type != JOB_STOP && unit->load_state == UNIT_ERROR) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
"Unit %s failed to load: %s. "
"See system logs and 'systemctl status %s' for details.",
@@ -870,6 +870,14 @@ int transaction_add_job_and_dependencies(
return -EINVAL;
}
+ if (type != JOB_STOP && unit->load_state == UNIT_NOT_FOUND) {
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
+ "Unit %s failed to load: %s.",
+ unit->id,
+ strerror(-unit->load_error));
+ return -EINVAL;
+ }
+
if (type != JOB_STOP && unit->load_state == UNIT_MASKED) {
dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id);
return -EADDRNOTAVAIL;

View File

@ -0,0 +1,283 @@
From 45f0d8e103c57e9e5e9d92bba1dc2d50b49806de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 15 Sep 2013 22:26:56 -0400
Subject: [PATCH] Verify validity of session name when received from outside
Only ASCII letters and digits are allowed.
---
Makefile.am | 14 +++++++++++---
TODO | 3 ---
src/login/login-shared.c | 8 ++++++++
src/login/login-shared.h | 3 +++
src/login/logind-dbus.c | 1 +
src/login/logind-session.c | 1 +
src/login/logind-session.h | 1 +
src/login/logind.c | 6 ++++++
src/login/sd-login.c | 12 +++++++-----
src/shared/cgroup-util.c | 4 +---
src/shared/def.h | 5 +++++
src/shared/env-util.c | 5 ++---
src/shared/replace-var.c | 3 ++-
src/shared/unit-name.c | 5 ++---
14 files changed, 50 insertions(+), 21 deletions(-)
create mode 100644 src/login/login-shared.c
create mode 100644 src/login/login-shared.h
diff --git a/Makefile.am b/Makefile.am
index 7b7539a..6014521 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2324,7 +2324,10 @@ if HAVE_ACL
libudev_core_la_SOURCES += \
src/udev/udev-builtin-uaccess.c \
src/login/logind-acl.c \
- src/login/sd-login.c
+ src/login/sd-login.c \
+ src/systemd/sd-login.h \
+ src/login/login-shared.c \
+ src/login/login-shared.h
libudev_core_la_LIBADD += \
libsystemd-acl.la
@@ -3759,7 +3762,9 @@ libsystemd_logind_core_la_SOURCES = \
src/login/logind-session-dbus.c \
src/login/logind-seat-dbus.c \
src/login/logind-user-dbus.c \
- src/login/logind-acl.h
+ src/login/logind-acl.h \
+ src/login/login-shared.c \
+ src/login/login-shared.h
libsystemd_logind_core_la_CFLAGS = \
$(AM_CFLAGS) \
@@ -3860,7 +3865,10 @@ tests += \
test-login-tables
libsystemd_login_la_SOURCES = \
- src/login/sd-login.c
+ src/login/sd-login.c \
+ src/systemd/sd-login.h \
+ src/login/login-shared.c \
+ src/login/login-shared.h
libsystemd_login_la_CFLAGS = \
$(AM_CFLAGS) \
diff --git a/TODO b/TODO
index 9943b3e..bfeaa81 100644
--- a/TODO
+++ b/TODO
@@ -142,9 +142,6 @@ Features:
* journald: make sure ratelimit is actually really per-service with the new cgroup changes
-* libsystemd-logind: sd_session_is_active() and friends: verify
- validity of session name before appending it to a path
-
* gparted needs to disable auto-activation of mount units somehow, or
maybe we should stop doing auto-activation of this after boot
entirely. https://bugzilla.gnome.org/show_bug.cgi?id=701676
diff --git a/src/login/login-shared.c b/src/login/login-shared.c
new file mode 100644
index 0000000..ff13c28
--- /dev/null
+++ b/src/login/login-shared.c
@@ -0,0 +1,8 @@
+#include "login-shared.h"
+#include "def.h"
+
+bool session_id_valid(const char *id) {
+ assert(id);
+
+ return id + strspn(id, LETTERS DIGITS) == '\0';
+}
diff --git a/src/login/login-shared.h b/src/login/login-shared.h
new file mode 100644
index 0000000..728ef00
--- /dev/null
+++ b/src/login/login-shared.h
@@ -0,0 +1,3 @@
+#include <stdbool.h>
+
+bool session_id_valid(const char *id);
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 345df9f..d052e74 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -554,6 +554,7 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message) {
* the audit data and let's better register a new
* ID */
if (hashmap_get(m->sessions, id)) {
+ log_warning("Existing logind session ID %s used by new audit session, ignoring", id);
audit_id = 0;
free(id);
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index a726fb1..2d22a68 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -41,6 +41,7 @@ Session* session_new(Manager *m, const char *id) {
assert(m);
assert(id);
+ assert(session_id_valid(id));
s = new0(Session, 1);
if (!s)
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index edaae8d..9cf6485 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -29,6 +29,7 @@ typedef enum KillWho KillWho;
#include "logind.h"
#include "logind-seat.h"
#include "logind-user.h"
+#include "login-shared.h"
typedef enum SessionState {
SESSION_OPENING, /* Session scope is being created */
diff --git a/src/login/logind.c b/src/login/logind.c
index 9094567..4ef92b8 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -684,6 +684,12 @@ int manager_enumerate_sessions(Manager *m) {
if (!dirent_is_file(de))
continue;
+ if (!session_id_valid(de->d_name)) {
+ log_warning("Invalid session file name '%s', ignoring.", de->d_name);
+ r = -EINVAL;
+ continue;
+ }
+
k = manager_add_session(m, de->d_name, &s);
if (k < 0) {
log_error("Failed to add session by file name %s: %s", de->d_name, strerror(-k));
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index 8a7838d..71d8c29 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -31,6 +31,7 @@
#include "sd-login.h"
#include "strv.h"
#include "fileio.h"
+#include "login-shared.h"
_public_ int sd_pid_get_session(pid_t pid, char **session) {
if (pid < 0)
@@ -226,17 +227,19 @@ static int file_of_session(const char *session, char **_p) {
assert(_p);
- if (session)
+ if (session) {
+ if (!session_id_valid(session))
+ return -EINVAL;
+
p = strappend("/run/systemd/sessions/", session);
- else {
- char *buf;
+ } else {
+ _cleanup_free_ char *buf = NULL;
r = sd_pid_get_session(0, &buf);
if (r < 0)
return r;
p = strappend("/run/systemd/sessions/", buf);
- free(buf);
}
if (!p)
@@ -255,7 +258,6 @@ _public_ int sd_session_is_active(const char *session) {
return r;
r = parse_env_file(p, NEWLINE, "ACTIVE", &s, NULL);
-
if (r < 0)
return r;
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 1d545e0..0bffebd 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1511,9 +1511,7 @@ char *cg_unescape(const char *p) {
}
#define CONTROLLER_VALID \
- "0123456789" \
- "abcdefghijklmnopqrstuvwxyz" \
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
+ DIGITS LETTERS \
"_"
bool cg_controller_is_valid(const char *p, bool allow_named) {
diff --git a/src/shared/def.h b/src/shared/def.h
index 5abb544..edd0bcf 100644
--- a/src/shared/def.h
+++ b/src/shared/def.h
@@ -33,3 +33,8 @@
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE
+
+#define DIGITS "0123456789"
+#define LOWERCASE_LETTERS "abcdefghijklmnopqrstuvwxyz"
+#define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 6a52fb9..5e29629 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -27,11 +27,10 @@
#include "utf8.h"
#include "util.h"
#include "env-util.h"
+#include "def.h"
#define VALID_CHARS_ENV_NAME \
- "0123456789" \
- "abcdefghijklmnopqrstuvwxyz" \
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
+ DIGITS LETTERS \
"_"
#ifndef ARG_MAX
diff --git a/src/shared/replace-var.c b/src/shared/replace-var.c
index e11c57a..478fc43 100644
--- a/src/shared/replace-var.c
+++ b/src/shared/replace-var.c
@@ -24,6 +24,7 @@
#include "macro.h"
#include "util.h"
#include "replace-var.h"
+#include "def.h"
/*
* Generic infrastructure for replacing @FOO@ style variables in
@@ -40,7 +41,7 @@ static int get_variable(const char *b, char **r) {
if (*b != '@')
return 0;
- k = strspn(b + 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ_");
+ k = strspn(b + 1, UPPERCASE_LETTERS "_");
if (k <= 0 || b[k+1] != '@')
return 0;
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index 1baa6eb..8f6c28e 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -26,11 +26,10 @@
#include "path-util.h"
#include "util.h"
#include "unit-name.h"
+#include "def.h"
#define VALID_CHARS \
- "0123456789" \
- "abcdefghijklmnopqrstuvwxyz" \
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
+ DIGITS LETTERS \
":-_.\\"
static const char* const unit_type_table[_UNIT_TYPE_MAX] = {

View File

@ -0,0 +1,27 @@
From c4f1b97f45f1685c0a4bcba8c6724ce17bb6af19 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Mon, 16 Sep 2013 11:22:35 -0400
Subject: [PATCH] udev-rules: avoid erroring on trailing whitespace
https://bugs.archlinux.org/task/36950
---
src/udev/udev-rules.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index f14158b..6f8b127 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1068,6 +1068,12 @@ static int add_rule(struct udev_rules *rules, char *line,
enum operation_type op;
if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) {
+ /* Avoid erroring on trailing whitespace. This is probably rare
+ * so save the work for the error case instead of always trying
+ * to strip the trailing whitespace with strstrip(). */
+ while (isblank(*linepos))
+ linepos++;
+
/* If we aren't at the end of the line, this is a parsing error.
* Make a best effort to describe where the problem is. */
if (*linepos != '\n') {

View File

@ -0,0 +1,65 @@
From 3d2b4b62bfc73a38dce90be5cebdc924db42f63c Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Mon, 16 Sep 2013 14:25:44 -0500
Subject: [PATCH] keymap: Add Samsung Series 5 [Ultra]
Also consolidate the wlan key into the "all Samsung" rule to avoid repetition.
Thanks to Mauro Carvalho Chehab!
https://bugzilla.redhat.com/show_bug.cgi?id=989103
---
hwdb/60-keyboard.hwdb | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index 53e83ad..3862b4c 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -882,6 +882,8 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*
KEYBOARD_KEY_b1=!prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice)
KEYBOARD_KEY_b3=!prog3 # Fn+F8 switch power mode (battery/dynamic/performance)
KEYBOARD_KEY_b4=!wlan # Fn+F9 (X60P)
+ KEYBOARD_KEY_c5=!prog3 # Fn+F8 switch power mode (battery/dynamic/performance)
+ KEYBOARD_KEY_d5=!wlan # Fn+F12 wlan/airplane switch
KEYBOARD_KEY_f7=!f22 # Fn+F10 Touchpad on
KEYBOARD_KEY_f9=!f23 # Fn+F10 Touchpad off
@@ -889,9 +891,18 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*300E[457]*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*200E[45]*:pvr*
KEYBOARD_KEY_ce=! # Fn+F1 launch control setting
- KEYBOARD_KEY_d5=! # Fn+F12 Wi-Fi toggle
# Series 5
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*530U*:pvr*
+ KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
+ KEYBOARD_KEY_a8=! # Fn Lock - Function lock on
+ KEYBOARD_KEY_a9=! # Fn Lock - Function lock off
+
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*550P*:pvr*
+ KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
+ KEYBOARD_KEY_a8=! # Fn Lock - Function lock on
+ KEYBOARD_KEY_a9=! # Fn Lock - Function lock off
+
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
KEYBOARD_KEY_a0=!mute # Fn+F6 mute
@@ -900,7 +911,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
KEYBOARD_KEY_97=!kbdillumdown # Fn+F9 keyboard backlight down
KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up
KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer
- KEYBOARD_KEY_d5=!wlan # Fn+F12 wlan/airplane switch
# Series 9
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*90X3A*:pvr*
@@ -936,9 +946,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700T*:pvr*
KEYBOARD_KEY_ad=leftmeta
-keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn535U*:pvr*
- KEYBOARD_KEY_d5=!wlan
-
###########################################################
# SONY
###########################################################

View File

@ -16,7 +16,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 207
Release: 1%{?gitcommit:.git%{gitcommit}}%{?dist}
Release: 2%{?gitcommit:.git%{gitcommit}}%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager
@ -36,6 +36,30 @@ Source4: listen.conf
# Prevent accidental removal of the systemd package
Source6: yum-protect-systemd.conf
Patch0003: 0003-core-cgroup-first-print-then-free.patch
Patch0004: 0004-swap-fix-reverse-dependencies.patch
Patch0005: 0005-update-TODO.patch
Patch0006: 0006-cryptsetup-generator-don-t-create-tmp-swap-units.patch
Patch0007: 0007-cryptsetup-generator-allow-specifying-options-in-pro.patch
Patch0008: 0008-automount-rename-repeat_unmont-to-repeat_unmount.patch
Patch0009: 0009-cgroup-add-the-missing-setting-of-variable-s-value.patch
Patch0010: 0010-cgroup-correct-the-log-information.patch
Patch0011: 0011-cgroup-fix-incorrectly-setting-memory-cgroup.patch
Patch0012: 0012-random-seed-we-should-return-errno-of-failed-loop_wr.patch
Patch0013: 0013-update-TODO.patch
Patch0014: 0014-libudev-fix-move_later-comparison.patch
Patch0015: 0015-man-document-luks.options-kernel-commandline.patch
Patch0016: 0016-keymap-remove-some-commented-out-lines.patch
Patch0017: 0017-Advertise-hibernation-only-if-there-s-enough-free-sw.patch
Patch0018: 0018-README-add-SCSI-BSG-option.patch
Patch0019: 0019-swap-create-.wants-symlink-to-auto-swap-devices.patch
Patch0020: 0020-cgroup-add-missing-equals-for-BlockIOWeight.patch
Patch0021: 0021-Assume-that-proc-meminfo-can-be-missing.patch
Patch0022: 0022-transaction.c-do-not-point-users-to-logs-when-unit-n.patch
Patch0023: 0023-Verify-validity-of-session-name-when-received-from-o.patch
Patch0024: 0024-udev-rules-avoid-erroring-on-trailing-whitespace.patch
Patch0025: 0025-keymap-Add-Samsung-Series-5-Ultra.patch
# kernel-install patch for grubby, drop if grubby is obsolete
Patch1000: kernel-install-grubby.patch
@ -666,6 +690,11 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g
%{_datadir}/systemd/gatewayd
%changelog
* Mon Sep 16 2013 Harald Hoyer <harald@redhat.com> 207-2
- add some upstream fixes for 207
- fixed swap activation
Resolves: rhbz#1008604
* Fri Sep 13 2013 Lennart Poettering <lpoetter@redhat.com> - 207-1
- New upstream release