SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-03-28 12:59:18 +00:00 committed by Git OBS Bridge
parent f18e3e5777
commit c48f3b3292
14 changed files with 983 additions and 1 deletions

View File

@ -0,0 +1,80 @@
From a641dcd9bf05418d6a6c165e1c0cff615b4a0f47 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 18 Mar 2014 04:06:36 +0100
Subject: [PATCH] cgroup: it's not OK to invoke alloca() in loops
---
src/core/mount-setup.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git src/core/mount-setup.c src/core/mount-setup.c
index 387030a..c6d3f4b 100644
--- src/core/mount-setup.c
+++ src/core/mount-setup.c
@@ -216,10 +216,10 @@ int mount_setup_early(void) {
}
int mount_cgroup_controllers(char ***join_controllers) {
- int r;
- char buf[LINE_MAX];
_cleanup_set_free_free_ Set *controllers = NULL;
_cleanup_fclose_ FILE *f;
+ char buf[LINE_MAX];
+ int r;
/* Mount all available cgroup controllers that are built into the kernel. */
@@ -262,6 +262,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
}
for (;;) {
+ _cleanup_free_ char *options = NULL, *controller = NULL, *where = NULL;
MountPoint p = {
.what = "cgroup",
.type = "cgroup",
@@ -269,7 +270,6 @@ int mount_cgroup_controllers(char ***join_controllers) {
.mode = MNT_IN_CONTAINER,
};
char ***k = NULL;
- _cleanup_free_ char *options = NULL, *controller;
controller = set_steal_first(controllers);
if (!controller)
@@ -286,7 +286,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
for (i = *k, j = *k; *i; i++) {
if (!streq(*i, controller)) {
- char _cleanup_free_ *t;
+ _cleanup_free_ char *t;
t = set_remove(controllers, *i);
if (!t) {
@@ -308,7 +308,11 @@ int mount_cgroup_controllers(char ***join_controllers) {
controller = NULL;
}
- p.where = strappenda("/sys/fs/cgroup/", options);
+ where = strappend("/sys/fs/cgroup/", options);
+ if (!where)
+ return log_oom();
+
+ p.where = where;
p.options = options;
r = mount_one(&p, true);
@@ -319,7 +323,11 @@ int mount_cgroup_controllers(char ***join_controllers) {
char **i;
for (i = *k; *i; i++) {
- char *t = strappenda("/sys/fs/cgroup/", *i);
+ _cleanup_free_ char *t = NULL;
+
+ t = strappend("/sys/fs/cgroup/", *i);
+ if (!t)
+ return log_oom();
r = symlink(options, t);
if (r < 0 && errno != EEXIST) {
--
1.7.9.2

View File

@ -0,0 +1,70 @@
From de58a50e24a0d55e3bbcc77f8f6170a7322acf52 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 18 Mar 2014 04:43:08 +0100
Subject: [PATCH] machined: fix Kill() bus call on machine objects when "what"
is specified as "leader"
---
src/machine/machine.c | 10 +++++++++-
src/machine/machined-dbus.c | 4 ++--
src/machine/machined.h | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git src/machine/machine.c src/machine/machine.c
index 4596a80..9a5cc9a 100644
--- src/machine/machine.c
+++ src/machine/machine.c
@@ -410,7 +410,15 @@ int machine_kill(Machine *m, KillWho who, int signo) {
if (!m->unit)
return -ESRCH;
- return manager_kill_unit(m->manager, m->unit, who, signo, NULL);
+ if (who == KILL_LEADER) {
+ /* If we shall simply kill the leader, do so directly */
+
+ if (kill(m->leader, signo) < 0)
+ return -errno;
+ }
+
+ /* Otherwise make PID 1 do it for us, for the entire cgroup */
+ return manager_kill_unit(m->manager, m->unit, signo, NULL);
}
static const char* const machine_class_table[_MACHINE_CLASS_MAX] = {
diff --git src/machine/machined-dbus.c src/machine/machined-dbus.c
index 09d28bb..9473105 100644
--- src/machine/machined-dbus.c
+++ src/machine/machined-dbus.c
@@ -655,7 +655,7 @@ int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, c
return 1;
}
-int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error) {
+int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error) {
assert(manager);
assert(unit);
@@ -667,7 +667,7 @@ int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo
"KillUnit",
error,
NULL,
- "ssi", unit, who == KILL_LEADER ? "main" : "all", signo);
+ "ssi", unit, "all", signo);
}
int manager_unit_is_active(Manager *manager, const char *unit) {
diff --git src/machine/machined.h src/machine/machined.h
index d4b581b..2dba303 100644
--- src/machine/machined.h
+++ src/machine/machined.h
@@ -67,6 +67,6 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, sd_bus_message *more_properties, sd_bus_error *error, char **job);
int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job);
-int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error);
+int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error);
int manager_unit_is_active(Manager *manager, const char *unit);
int manager_job_is_active(Manager *manager, const char *path);
--
1.7.9.2

View File

@ -0,0 +1,498 @@
From a3d59cd1b0a2738d06893948492113f2c35be0af Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 19 Mar 2014 21:41:21 +0100
Subject: [PATCH] sd-bus: don't use assert_return() to check for disconnected
bus connections
A terminated connection is a runtime error and not a developer mistake,
hence don't use assert_return() to check for it.
---
src/libsystemd/sd-bus/bus-control.c | 20 +++++++++++++-----
src/libsystemd/sd-bus/bus-convenience.c | 58 +++++++++++++++++++++++++++++++++++++++++-------------
src/libsystemd/sd-bus/bus-objects.c | 23 +++++++++++++++------
src/libsystemd/sd-bus/sd-bus.c | 49 +++++++++++++++++++++++++++++++++------------
4 files changed, 113 insertions(+), 37 deletions(-)
--- src/libsystemd/sd-bus/bus-control.c
+++ src/libsystemd/sd-bus/bus-control.c 2014-03-28 00:00:00.000000000 +0000
@@ -128,12 +128,14 @@ _public_ int sd_bus_request_name(sd_bus
assert_return(bus, -EINVAL);
assert_return(name, -EINVAL);
assert_return(bus->bus_client, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL);
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(name[0] != ':', -EINVAL);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (bus->is_kernel)
return bus_request_name_kernel(bus, name, flags);
else
@@ -201,11 +203,13 @@ _public_ int sd_bus_release_name(sd_bus
assert_return(bus, -EINVAL);
assert_return(name, -EINVAL);
assert_return(bus->bus_client, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(name[0] != ':', -EINVAL);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (bus->is_kernel)
return bus_release_name_kernel(bus, name);
else
@@ -344,9 +348,11 @@ static int bus_list_names_dbus1(sd_bus *
_public_ int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable) {
assert_return(bus, -EINVAL);
assert_return(acquired || activatable, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (bus->is_kernel)
return bus_list_names_kernel(bus, acquired, activatable);
else
@@ -737,11 +743,13 @@ _public_ int sd_bus_get_owner(
assert_return(name, -EINVAL);
assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
assert_return(mask == 0 || creds, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
assert_return(service_name_is_valid(name), -EINVAL);
assert_return(bus->bus_client, -ENODATA);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (bus->is_kernel)
return bus_get_owner_kdbus(bus, name, mask, creds);
else
@@ -1198,10 +1206,12 @@ _public_ int sd_bus_get_owner_machine_id
assert_return(bus, -EINVAL);
assert_return(name, -EINVAL);
assert_return(machine, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
assert_return(service_name_is_valid(name), -EINVAL);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (streq_ptr(name, bus->unique_name))
return sd_id128_get_machine(machine);
--- src/libsystemd/sd-bus/bus-convenience.c
+++ src/libsystemd/sd-bus/bus-convenience.c 2014-03-28 00:00:00.000000000 +0000
@@ -36,9 +36,11 @@ _public_ int sd_bus_emit_signal(
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_message_new_signal(bus, &m, path, interface, member);
if (r < 0)
return r;
@@ -70,9 +72,11 @@ _public_ int sd_bus_call_method(
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member);
if (r < 0)
return r;
@@ -100,9 +104,12 @@ _public_ int sd_bus_reply_method_return(
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
@@ -134,9 +141,12 @@ _public_ int sd_bus_reply_method_error(
assert_return(call->sealed, -EPERM);
assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
assert_return(sd_bus_error_is_set(e), -EINVAL);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
@@ -159,9 +169,12 @@ _public_ int sd_bus_reply_method_errorf(
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
@@ -182,9 +195,12 @@ _public_ int sd_bus_reply_method_errno(
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
@@ -208,9 +224,12 @@ _public_ int sd_bus_reply_method_errnof(
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
return 0;
@@ -239,9 +258,11 @@ _public_ int sd_bus_get_property(
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(reply, -EINVAL);
assert_return(signature_is_single(type, false), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
if (r < 0)
return r;
@@ -273,9 +294,11 @@ _public_ int sd_bus_get_property_trivial
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(bus_type_is_trivial(type), -EINVAL);
assert_return(ptr, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
@@ -309,9 +332,11 @@ _public_ int sd_bus_get_property_string(
assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(ret, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
@@ -348,9 +373,11 @@ _public_ int sd_bus_get_property_strv(
assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(ret, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
@@ -383,9 +410,11 @@ _public_ int sd_bus_set_property(
assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(signature_is_single(type, false), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set");
if (r < 0)
return r;
@@ -416,9 +445,12 @@ _public_ int sd_bus_query_sender_creds(s
assert_return(call, -EINVAL);
assert_return(call->sealed, -EPERM);
- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
+ assert_return(call->bus, -EINVAL);
assert_return(!bus_pid_changed(call->bus), -ECHILD);
+ if (!BUS_IS_OPEN(call->bus->state))
+ return -ENOTCONN;
+
c = sd_bus_message_get_creds(call);
/* All data we need? */
--- src/libsystemd/sd-bus/bus-objects.c
+++ src/libsystemd/sd-bus/bus-objects.c 2014-03-28 00:00:00.000000000 +0000
@@ -2196,9 +2196,10 @@ _public_ int sd_bus_emit_properties_chan
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
assert_return(interface_name_is_valid(interface), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
/* A non-NULL but empty names list means nothing needs to be
generated. A NULL list OTOH indicates that all properties
@@ -2241,9 +2242,11 @@ _public_ int sd_bus_emit_properties_chan
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
assert_return(interface_name_is_valid(interface), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (!name)
return 0;
@@ -2361,9 +2364,11 @@ _public_ int sd_bus_emit_interfaces_adde
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (strv_isempty(interfaces))
return 0;
@@ -2421,9 +2426,11 @@ _public_ int sd_bus_emit_interfaces_adde
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
interfaces = strv_from_stdarg_alloca(interface);
return sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
@@ -2435,9 +2442,11 @@ _public_ int sd_bus_emit_interfaces_remo
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (strv_isempty(interfaces))
return 0;
@@ -2461,9 +2470,11 @@ _public_ int sd_bus_emit_interfaces_remo
assert_return(bus, -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
interfaces = strv_from_stdarg_alloca(interface);
return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
--- src/libsystemd/sd-bus/sd-bus.c
+++ src/libsystemd/sd-bus/sd-bus.c 2014-03-28 12:19:27.146736146 +0000
@@ -1592,10 +1592,12 @@ static int bus_send_internal(sd_bus *bus
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (m->n_fds > 0) {
r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD);
if (r < 0)
@@ -1671,10 +1673,12 @@ _public_ int sd_bus_send_to(sd_bus *bus,
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
if (!streq_ptr(m->destination, destination)) {
if (!destination)
@@ -1726,13 +1730,15 @@ _public_ int sd_bus_call_async(
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
assert_return(callback, -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = hashmap_ensure_allocated(&bus->reply_callbacks, uint64_hash_func, uint64_compare_func);
if (r < 0)
return r;
@@ -1839,13 +1845,15 @@ _public_ int sd_bus_call(
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
assert_return(!bus_error_is_dirty(error), -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
+
r = bus_ensure_running(bus);
if (r < 0)
return r;
@@ -1971,9 +1979,11 @@ _public_ int sd_bus_get_events(sd_bus *b
int flags = 0;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
+ return -ENOTCONN;
+
if (bus->state == BUS_OPENING)
flags |= POLLOUT;
else if (bus->state == BUS_AUTHENTICATING) {
@@ -1998,9 +2008,11 @@ _public_ int sd_bus_get_timeout(sd_bus *
assert_return(bus, -EINVAL);
assert_return(timeout_usec, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
+ return -ENOTCONN;
+
if (bus->state == BUS_CLOSING) {
*timeout_usec = 0;
return 1;
@@ -2510,7 +2522,8 @@ static int bus_poll(sd_bus *bus, bool ne
if (bus->state == BUS_CLOSING)
return 1;
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
e = sd_bus_get_events(bus);
if (e < 0)
@@ -2565,7 +2578,8 @@ _public_ int sd_bus_wait(sd_bus *bus, ui
if (bus->state == BUS_CLOSING)
return 0;
- assert_return(BUS_IS_OPEN(bus->state) , -ENOTCONN);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
if (bus->rqueue_size > 0)
return 0;
@@ -2582,7 +2596,8 @@ _public_ int sd_bus_flush(sd_bus *bus) {
if (bus->state == BUS_CLOSING)
return 0;
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
r = bus_ensure_running(bus);
if (r < 0)
@@ -3058,9 +3073,13 @@ _public_ int sd_bus_get_peer_creds(sd_bu
assert_return(bus, -EINVAL);
assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
assert_return(ret, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- assert_return(!bus->is_kernel, -ENOTSUP);
+
+ if (!bus->is_kernel)
+ return -ENOTSUP;
+
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
if (!bus->ucred_valid && !isempty(bus->label))
return -ENODATA;
@@ -3099,9 +3118,13 @@ _public_ int sd_bus_try_close(sd_bus *bu
int r;
assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- assert_return(bus->is_kernel, -ENOTSUP);
+
+ if (!bus->is_kernel)
+ return -ENOTSUP;
+
+ if (!BUS_IS_OPEN(bus->state))
+ return -ENOTCONN;
if (bus->rqueue_size > 0)
return -EBUSY;

View File

@ -0,0 +1,29 @@
From c4bfd1691f4d3e26d6d7f34dbca941e119956e8a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 24 Mar 2014 21:04:02 +0100
Subject: [PATCH] core: don't try to relabel mounts before we loaded the
policy
---
src/core/mount-setup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git src/core/mount-setup.c src/core/mount-setup.c
index 147333a..0a45b24 100644
--- src/core/mount-setup.c
+++ src/core/mount-setup.c
@@ -172,7 +172,10 @@ static int mount_one(const MountPoint *p, bool relabel) {
/* The access mode here doesn't really matter too much, since
* the mounted file system will take precedence anyway. */
- mkdir_p_label(p->where, 0755);
+ if (relabel)
+ mkdir_p_label(p->where, 0755);
+ else
+ mkdir_p(p->where, 0755);
log_debug("Mounting %s to %s of type %s with options %s.",
p->what,
--
1.7.9.2

View File

@ -0,0 +1,25 @@
From 56dc9aec21ab23f76fadf45585adf88e71aa8078 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 24 Mar 2014 23:54:14 +0100
Subject: [PATCH] sd-daemon: fix incorrect variable access
---
src/libsystemd/sd-daemon/sd-daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/libsystemd/sd-daemon/sd-daemon.c src/libsystemd/sd-daemon/sd-daemon.c
index 21fb346..b013438 100644
--- src/libsystemd/sd-daemon/sd-daemon.c
+++ src/libsystemd/sd-daemon/sd-daemon.c
@@ -517,7 +517,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {
r = -errno;
goto finish;
}
- if (!p || p == e || *p || l <= 0) {
+ if (!p || p == e || *p || ll <= 0) {
r = -EINVAL;
goto finish;
}
--
1.7.9.2

View File

@ -0,0 +1,75 @@
From 52444dc478fe38b5b69a771923ab429a41927aa5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 24 Mar 2014 23:54:21 +0100
Subject: [PATCH] sd-event: initialization perturbation value right before we
use it
That way, we don't forget to initialize it when the watchdog is
initialized before all event sources.
---
src/libsystemd/sd-event/sd-event.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c 2014-03-28 12:44:05.652327044 +0000
@@ -648,13 +648,31 @@ _public_ int sd_event_add_io(
return 0;
}
+static void initialize_perturb(sd_event *e) {
+ sd_id128_t bootid = {};
+
+ /* When we sleep for longer, we try to realign the wakeup to
+ the same time wihtin each minute/second/250ms, so that
+ events all across the system can be coalesced into a single
+ CPU wakeup. However, let's take some system-specific
+ randomness for this value, so that in a network of systems
+ with synced clocks timer events are distributed a
+ bit. Here, we calculate a perturbation usec offset from the
+ boot ID. */
+
+ if (_likely_(e->perturb != (usec_t) -1))
+ return;
+
+ if (sd_id128_get_boot(&bootid) >= 0)
+ e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
+}
+
static int event_setup_timer_fd(
sd_event *e,
EventSourceType type,
int *timer_fd,
clockid_t id) {
- sd_id128_t bootid = {};
struct epoll_event ev = {};
int r, fd;
@@ -677,18 +695,6 @@ static int event_setup_timer_fd(
return -errno;
}
- /* When we sleep for longer, we try to realign the wakeup to
- the same time wihtin each minute/second/250ms, so that
- events all across the system can be coalesced into a single
- CPU wakeup. However, let's take some system-specific
- randomness for this value, so that in a network of systems
- with synced clocks timer events are distributed a
- bit. Here, we calculate a perturbation usec offset from the
- boot ID. */
-
- if (sd_id128_get_boot(&bootid) >= 0)
- e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
-
*timer_fd = fd;
return 0;
}
@@ -1506,6 +1512,8 @@ static usec_t sleep_between(sd_event *e,
if (b <= a + 1)
return a;
+ initialize_perturb(e);
+
/*
Find a good time to wake up again between times a and b. We
have two goals here:

View File

@ -0,0 +1,29 @@
From 75145780813957ecbe6835f2c8bc20113a3605d2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 25 Mar 2014 00:01:51 +0100
Subject: [PATCH] sd-event: don't accidentally turn of watchdog timer event if
we determine 0
---
src/libsystemd/sd-event/sd-event.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c
index d6a3d1c..4aabec1 100644
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c
@@ -2087,6 +2087,11 @@ static int arm_watchdog(sd_event *e) {
timespec_store(&its.it_value, t);
+ /* Make sure we never set the watchdog to 0, which tells the
+ * kernel to disable it. */
+ if (its.it_value.tv_sec == 0 && its.it_value.tv_nsec == 0)
+ its.it_value.tv_nsec = 1;
+
r = timerfd_settime(e->watchdog_fd, TFD_TIMER_ABSTIME, &its, NULL);
if (r < 0)
return -errno;
--
1.7.9.2

View File

@ -0,0 +1,53 @@
From 0088d63151e088d62104d88f866e9eb049091c22 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 25 Mar 2014 00:31:48 +0100
Subject: [PATCH] systemctl: --kill-mode is long long gone, don't mention it
in the man page
---
man/systemctl.xml | 5 ++---
shell-completion/bash/systemctl | 5 +----
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git man/systemctl.xml man/systemctl.xml
index 77447dd..b4727d9 100644
--- man/systemctl.xml
+++ man/systemctl.xml
@@ -664,9 +664,8 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
<listitem>
<para>Send a signal to one or more processes of the
unit. Use <option>--kill-who=</option> to select which
- process to kill. Use <option>--kill-mode=</option> to select
- the kill mode and <option>--signal=</option> to select the
- signal to send.</para>
+ process to kill. Use <option>--signal=</option> to select
+ the signal to send.</para>
</listitem>
</varlistentry>
<varlistentry>
diff --git shell-completion/bash/systemctl shell-completion/bash/systemctl
index dc7ef66..0dfc868 100644
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -74,7 +74,7 @@ _systemctl () {
[STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
--quiet -q --privileged -P --system --user --version --runtime'
- [ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --state --root'
+ [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
@@ -99,9 +99,6 @@ _systemctl () {
--kill-who)
comps='all control main'
;;
- --kill-mode)
- comps='control-group process'
- ;;
--root)
comps=$(compgen -A directory -- "$cur" )
compopt -o filenames
--
1.7.9.2

View File

@ -0,0 +1,33 @@
From 036eeac5a1799fa2c0ae11a14d8c667b5d303189 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 25 Mar 2014 01:27:05 +0100
Subject: [PATCH] ask-password: when the user types a overly long password,
beep and refuse
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on a similar patch from David Härdeman.
---
src/shared/ask-password-api.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/shared/ask-password-api.c src/shared/ask-password-api.c
index 117f0c6..96f16cc 100644
--- src/shared/ask-password-api.c
+++ src/shared/ask-password-api.c
@@ -207,6 +207,11 @@ int ask_password_tty(
if (ttyfd >= 0)
loop_write(ttyfd, "(no echo) ", 10, false);
} else {
+ if (p >= sizeof(passphrase)-1) {
+ loop_write(ttyfd, "\a", 1, false);
+ continue;
+ }
+
passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0)
--
1.7.9.2

View File

@ -108,7 +108,7 @@
--- systemd-208/shell-completion/bash/systemctl
+++ systemd-208/shell-completion/bash/systemctl 2014-01-17 14:35:26.506235666 +0000
@@ -77,6 +77,10 @@ _systemctl () {
[ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --state --root'
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Fri Mar 28 12:53:21 UTC 2014 - werner@suse.de
- Add or port upstram bugfix patches:
0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch
0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch
0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch
0005-sd-daemon-fix-incorrect-variable-access.patch
0006-sd-event-initialization-perturbation-value-right-bef.patch
0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch
0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
0009-ask-password-when-the-user-types-a-overly-long-passw.patch
- Modify patch
1019-make-completion-smart-to-be-able-to-redirect.patch
to work together with
0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
-------------------------------------------------------------------
Fri Mar 28 08:10:13 UTC 2014 - werner@suse.de

View File

@ -311,6 +311,24 @@ Patch160: 0009-sd-bus-don-t-choke-if-somebody-sends-us-a-message-wi.patch
Patch161: 0012-journald-remove-stray-reset-of-error-return-value.patch
# PATCH-FIX-USTREAM added at 2014/03/18
Patch162: 0013-core-libsystemd-systemd-timedate-udev-spelling-fixes.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch163: 0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch164: 0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch165: 0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch166: 0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch167: 0005-sd-daemon-fix-incorrect-variable-access.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch168: 0006-sd-event-initialization-perturbation-value-right-bef.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch169: 0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch170: 0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch171: 0009-ask-password-when-the-user-types-a-overly-long-passw.patch
# PATCH-FIX-OPENSUSE 1009-make-xsltproc-use-correct-ROFF-links.patch -- Make ROFF links working again in manual pages (bnc#842844)
Patch1009: 1009-make-xsltproc-use-correct-ROFF-links.patch
# PATCH-FIX-OPENSUSE 1010-do-not-install-sulogin-unit-with-poweroff.patch -- Avoid installing console-shell.service (bnc#849071)
@ -662,6 +680,15 @@ cp %{SOURCE7} m4/
%patch160 -p0
%patch161 -p0
%patch162 -p0
%patch163 -p0
%patch164 -p0
%patch165 -p0
%patch166 -p0
%patch167 -p0
%patch168 -p0
%patch169 -p0
%patch170 -p0
%patch171 -p0
%patch1009 -p1
%patch1010 -p1
%patch1012 -p1

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Fri Mar 28 12:53:21 UTC 2014 - werner@suse.de
- Add or port upstram bugfix patches:
0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch
0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch
0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch
0005-sd-daemon-fix-incorrect-variable-access.patch
0006-sd-event-initialization-perturbation-value-right-bef.patch
0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch
0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
0009-ask-password-when-the-user-types-a-overly-long-passw.patch
- Modify patch
1019-make-completion-smart-to-be-able-to-redirect.patch
to work together with
0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
-------------------------------------------------------------------
Fri Mar 28 08:10:13 UTC 2014 - werner@suse.de

View File

@ -306,6 +306,24 @@ Patch160: 0009-sd-bus-don-t-choke-if-somebody-sends-us-a-message-wi.patch
Patch161: 0012-journald-remove-stray-reset-of-error-return-value.patch
# PATCH-FIX-USTREAM added at 2014/03/18
Patch162: 0013-core-libsystemd-systemd-timedate-udev-spelling-fixes.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch163: 0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch164: 0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch165: 0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch166: 0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch167: 0005-sd-daemon-fix-incorrect-variable-access.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch168: 0006-sd-event-initialization-perturbation-value-right-bef.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch169: 0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch170: 0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch
# PATCH-FIX-USTREAM added at 2014/03/28
Patch171: 0009-ask-password-when-the-user-types-a-overly-long-passw.patch
# PATCH-FIX-OPENSUSE 1009-make-xsltproc-use-correct-ROFF-links.patch -- Make ROFF links working again in manual pages (bnc#842844)
Patch1009: 1009-make-xsltproc-use-correct-ROFF-links.patch
# PATCH-FIX-OPENSUSE 1010-do-not-install-sulogin-unit-with-poweroff.patch -- Avoid installing console-shell.service (bnc#849071)
@ -657,6 +675,15 @@ cp %{SOURCE7} m4/
%patch160 -p0
%patch161 -p0
%patch162 -p0
%patch163 -p0
%patch164 -p0
%patch165 -p0
%patch166 -p0
%patch167 -p0
%patch168 -p0
%patch169 -p0
%patch170 -p0
%patch171 -p0
%patch1009 -p1
%patch1010 -p1
%patch1012 -p1