Compare commits

...

18 Commits
master ... f15

Author SHA1 Message Date
Michal Schmidt 356933198d CVE-2012-1174 (#803358) 2012-03-16 18:44:58 +01:00
Michal Schmidt 8a7253b862 Backport the detection of root storage daemons
http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
2012-02-27 09:33:29 +01:00
Michal Schmidt 14aacafb2e Backport PassCredentials to avoid #757628 when F15 kernel is rebased to 3.2. 2012-01-31 23:56:40 +01:00
Michal Schmidt a431a3277f fix quota (update spec) 2012-01-31 14:42:35 +01:00
Michal Schmidt 365e939f72 Fix quota (#773431) 2012-01-31 14:38:02 +01:00
Michal Schmidt 68bdd43edd Slowing down in F15. Only a few fixes for bugs reported against F15
StopWhenUnneeded
wtmp
gc of units with load error
2012-01-17 13:51:04 +01:00
Michal Schmidt 0fce2c35fc Fix remote-fs-pre.target and its ordering
Fixes: BZ#749940
2011-11-02 00:29:34 +01:00
Michal Schmidt 9c3104662b Fix a crash in isolating.
Fixes: BZ#717325
2011-10-19 12:56:13 +02:00
Michal Schmidt ee602f0dd7 Pick a few fixes from upstream v37.
Including the change to disable main PID guessing for SysV services.
Loop over %{patches} in the spec.
Fixes: BZ#718464, fdo#41336
2011-10-12 02:54:33 +02:00
Michal Schmidt a1c89c5e78 Pick lots of fixes from upstream up to v36.
A few features added too:
- support more types of virtual serial consoles in getty-generator
- log control via RT signals
- support for LANGUAGE in environment
- show fsck progress on the console
Fixes: BZ#735013, BZ#722803, BZ#736360, BZ#698198, BZ#710487
Fixes: fdo39957, fdo39818, fdo40510
2011-09-26 00:57:32 +02:00
Lennart Poettering 98aaf48a8b Fix release 2011-08-23 17:28:32 +02:00
Lennart Poettering ddff91d67f Fix a couple of bugs (#723892, #726976) 2011-08-23 17:27:37 +02:00
Michal Schmidt e2a0b4f786 Drop the pidfile patch for now. It exposes a bug in sendmail (BZ#719884) 2011-07-08 23:31:48 +02:00
Michal Schmidt bbe85fc4d8 cgroup trimming fix; "pidfile:" in SysV implies a daemon
Add more fixes from upstream:
don't trim cgroups on reexec (BZ#678555)
treat SysV services with "pidfile:" header as real daemons (BZ#702621)
2011-07-06 11:13:31 +02:00
Michal Schmidt bbf564a0ee Cherry-picked a bunch of upstream patches
Fixes: BZ#633774, BZ#708886, BZ#712710, BZ#716663
Partially fixes: BZ#624149
other small fixes
2011-07-04 21:42:11 +02:00
Michal Schmidt 5e991dc3d0 Temporary workaround to detect LVM VGs on encrypted PVs. (BZ#708684) 2011-06-20 10:02:20 +02:00
Michal Schmidt 09be98a9f6 Bugfixes from v29 development
systemctl: fix 'is-enabled' for native units under /lib (BZ#699027)
dbus: fix name of capability property
pam-module: add debug= parameter (BZ#705427)
2011-06-15 22:47:49 +02:00
Michal Schmidt 7c34a4c5e4 Pick bugfixes from upstream
systemctl: fix double unref of a dbus message (BZ#709909)
cryptsetup-generator: fix /etc/cryptsetup options (BZ#710839)
readahead-common: fix total memory size detection (BZ#712341)
2011-06-12 16:20:40 +02:00
92 changed files with 5368 additions and 5 deletions

View File

@ -0,0 +1,34 @@
From 25bafad67f6f161921c498a7b77f118920bec971 Mon Sep 17 00:00:00 2001
From: Michael Biebl <biebl@debian.org>
Date: Fri, 1 Jul 2011 05:55:57 +0200
Subject: [PATCH] Don't show a warning message in non-enforcing mode.
If we fail to load the SELinux policy only log an error message in
enforcing mode.
---
src/selinux-setup.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/selinux-setup.c b/src/selinux-setup.c
index 620c49e..bc36e76 100644
--- a/src/selinux-setup.c
+++ b/src/selinux-setup.c
@@ -72,12 +72,13 @@ int selinux_setup(char *const argv[]) {
return -errno;
} else {
- log_full(enforce > 0 ? LOG_ERR : LOG_WARNING, "Failed to load SELinux policy.");
unlink("/dev/.systemd-relabel-run-dev");
- if (enforce > 0)
+ if (enforce > 0) {
+ log_full(LOG_ERR, "Failed to load SELinux policy.");
return -EIO;
+ }
}
#endif
--
1.7.4.4

View File

@ -0,0 +1,27 @@
From 38a285d776cc0bf4440efe79fc7691032bcf3d67 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 6 Jul 2011 00:14:26 +0200
Subject: [PATCH] cgroup: don't trim a cgroup we create, we might just take it
over from somebody else
---
src/cgroup.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/src/cgroup.c b/src/cgroup.c
index d16b5f8..4aa01f1 100644
--- a/src/cgroup.c
+++ b/src/cgroup.c
@@ -46,9 +46,6 @@ int cgroup_bonding_realize(CGroupBonding *b) {
b->realized = true;
- if (b->ours)
- cg_trim(b->controller, b->path, false);
-
return 0;
}
--
1.7.4.4

View File

@ -0,0 +1,26 @@
From 1f8fef5a44e6ce711808665bca6eb43d604fe279 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 23 Sep 2011 02:10:00 +0200
Subject: [PATCH] condition: fix reversed tests if path does not exist at all
CONDITION_PATH_IS_DIRECTORY, CONDITION_PATH_IS_SYMBOLIC_LINK and
CONDITION_FILE_IS_EXECUTABLE gave reversed results when the path
did not exist at all.
[ in F15 there's only CONDITION_PATH_IS_DIRECTORY -- michich ]
---
Index: systemd-26/src/condition.c
===================================================================
--- systemd-26.orig/src/condition.c
+++ systemd-26/src/condition.c
@@ -152,7 +152,7 @@ bool condition_test(Condition *c) {
struct stat st;
if (lstat(c->parameter, &st) < 0)
- return !c->negate;
+ return c->negate;
return S_ISDIR(st.st_mode) == !c->negate;
}

View File

@ -0,0 +1,26 @@
From a373b0e7bc24b8fffe0ba69e8b92eebf2740332e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 19 Sep 2011 23:51:15 +0200
Subject: [PATCH] condition: opt out of /proc/cmdline parsing only when
running in a container, not in a VM
---
src/condition.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/condition.c b/src/condition.c
index f9202f6..8c08be4 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -75,7 +75,7 @@ static bool test_kernel_command_line(const char *parameter) {
assert(parameter);
- if (detect_virtualization(NULL) > 0)
+ if (detect_container(NULL) > 0)
return false;
if ((r = read_one_line_file("/proc/cmdline", &line)) < 0) {
--
1.7.4.4

View File

@ -0,0 +1,108 @@
From 8ea913b2eaadbd92e069ea6b71cc5f5df409decf Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 23 Sep 2011 01:43:28 +0200
Subject: [PATCH] coverity: fix a couple of bugs found by coverity
---
[ removed hunks for code which does not exist in F15 -- michich ]
Index: systemd-26/src/binfmt.c
===================================================================
--- systemd-26.orig/src/binfmt.c
+++ systemd-26/src/binfmt.c
@@ -33,7 +33,7 @@
#include "util.h"
static int delete_rule(const char *rule) {
- char *x, *fn, *e;
+ char *x, *fn = NULL, *e;
int r;
assert(rule[0]);
Index: systemd-26/src/conf-parser.c
===================================================================
--- systemd-26.orig/src/conf-parser.c
+++ systemd-26/src/conf-parser.c
@@ -194,9 +194,12 @@ int config_parse(const char *filename, F
if (c)
continuation = c;
- else if (!(continuation = strdup(l))) {
- r = -ENOMEM;
- goto finish;
+ else {
+ continuation = strdup(l);
+ if (!continuation) {
+ r = -ENOMEM;
+ goto finish;
+ }
}
continue;
Index: systemd-26/src/load-fragment.c
===================================================================
--- systemd-26.orig/src/load-fragment.c
+++ systemd-26/src/load-fragment.c
@@ -498,6 +498,7 @@ static int config_parse_exec(
if (!n[0]) {
log_error("[%s:%u] Invalid command line, ignoring: %s", filename, line, rvalue);
strv_free(n);
+ free(path);
return 0;
}
Index: systemd-26/src/modules-load.c
===================================================================
--- systemd-26.orig/src/modules-load.c
+++ systemd-26/src/modules-load.c
@@ -73,7 +73,6 @@ int main(int argc, char *argv[]) {
continue;
log_error("Failed to open %s: %m", *fn);
- free(fn);
r = EXIT_FAILURE;
continue;
}
Index: systemd-26/src/path.c
===================================================================
--- systemd-26.orig/src/path.c
+++ systemd-26/src/path.c
@@ -558,7 +558,7 @@ static void path_fd_event(Unit *u, int f
assert(l > 0);
if (!(buf = malloc(l))) {
- log_error("Failed to allocate buffer: %s", strerror(-ENOMEM));
+ log_error("Failed to allocate buffer: %s", strerror(ENOMEM));
goto fail;
}
Index: systemd-26/src/strv.c
===================================================================
--- systemd-26.orig/src/strv.c
+++ systemd-26/src/strv.c
@@ -202,12 +202,19 @@ char **strv_merge_concat(char **a, char
if (!(r = new(char*, strv_length(a)+strv_length(b)+1)))
return NULL;
- for (k = r; *a; k++, a++)
- if (!(*k = strdup(*a)))
- goto fail;
- for (; *b; k++, b++)
- if (!(*k = strappend(*b, suffix)))
+ k = r;
+ if (a)
+ for (; *a; k++, a++) {
+ *k = strdup(*a);
+ if (!*k)
+ goto fail;
+ }
+
+ for (; *b; k++, b++) {
+ *k = strappend(*b, suffix);
+ if (!*k)
goto fail;
+ }
*k = NULL;
return r;

View File

@ -0,0 +1,25 @@
From 41e6f28acc906960f21658c94ac79652705ded0c Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 4 Aug 2011 16:04:43 +0200
Subject: [PATCH] cryptsetup: accept "none" option
---
src/cryptsetup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/cryptsetup.c b/src/cryptsetup.c
index cf288de..ac7b6d6 100644
--- a/src/cryptsetup.c
+++ b/src/cryptsetup.c
@@ -110,7 +110,7 @@ static int parse_one_option(const char *option) {
return 0;
}
- } else
+ } else if (!streq(option, "none"))
log_error("Encountered unknown /etc/crypttab option '%s', ignoring.", option);
return 0;
--
1.7.4.4

View File

@ -0,0 +1,28 @@
From 1c5224b33630a1f95952796b2cb582be052e0c27 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 4 Aug 2011 16:46:33 +0200
Subject: [PATCH] cryptsetup-generator: block boot when querying passphrase.
Ensure we wait for passphrase before starting tty1 or graphical display.
Needed when not using plymouth.
---
src/cryptsetup-generator.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/cryptsetup-generator.c b/src/cryptsetup-generator.c
index a340218..6f3aa78 100644
--- a/src/cryptsetup-generator.c
+++ b/src/cryptsetup-generator.c
@@ -112,7 +112,8 @@ static int create_disk(
"DefaultDependencies=no\n"
"BindTo=%s dev-mapper-%%i.device\n"
"After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
- "Before=umount.target\n",
+ "Before=umount.target\n"
+ "Before=local-fs.target\n",
d, d);
if (!nofail)
--
1.7.4.4

View File

@ -0,0 +1,34 @@
From aae5220d961a419a1e160de90ee5c393c7c13607 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Mon, 6 Jun 2011 22:59:19 +0200
Subject: [PATCH] cryptsetup-generator: fix /etc/cryptsetup options
cryptsetup-generator parses the options in /etc/cryptsetup incorrectly.
It fails to find the 'swap' option in
swap,foo
and instead it matches on
swaplalala,foo
The condition for the comma separator is reversed.
https://bugzilla.redhat.com/show_bug.cgi?id=710839
---
src/cryptsetup-generator.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/cryptsetup-generator.c b/src/cryptsetup-generator.c
index 696f44a..db8ebdf 100644
--- a/src/cryptsetup-generator.c
+++ b/src/cryptsetup-generator.c
@@ -47,7 +47,7 @@ static bool has_option(const char *haystack, const char *needle) {
continue;
}
- if (f[l] != 0 && f[l] == ',') {
+ if (f[l] != 0 && f[l] != ',') {
f++;
continue;
}
--
1.7.4.4

View File

@ -0,0 +1,39 @@
From 7c3d67eff3e165b50084bf9c3269ec582d90c403 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 15 Jun 2011 10:16:49 +0200
Subject: [PATCH] dbus: fix name of capability property
---
src/dbus-execute.c | 2 +-
src/dbus-execute.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index 3f8fafe..6ceffc5 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -235,7 +235,7 @@ int bus_execute_append_capability_bs(DBusMessageIter *i, const char *property, v
assert(property);
assert(c);
- /* We store this negated internally, to match the kernel, bu
+ /* We store this negated internally, to match the kernel, but
* we expose it normalized. */
normal = *(uint64_t*) data;
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index 42df5aa..56c5bcd 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -77,7 +77,7 @@
" <property name=\"SyslogLevelPrefix\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"Capabilities\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"SecureBits\" type=\"i\" access=\"read\"/>\n" \
- " <property name=\"CapabilityBoundingSetDrop\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"CapabilityBoundingSet\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"User\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Group\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>\n" \
--
1.7.4.4

View File

@ -0,0 +1,59 @@
From f917c3e5e189ea062adbad8432c16ea2408d3368 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 03:55:38 +0200
Subject: [PATCH] dropin: don't fail if random files are stored in .wants
directories
https://bugs.freedesktop.org/show_bug.cgi?id=39957
---
[rediffed with quilt to unfuzz -- michich]
Index: systemd-26/src/load-dropin.c
===================================================================
--- systemd-26.orig/src/load-dropin.c
+++ systemd-26/src/load-dropin.c
@@ -36,7 +36,8 @@ static int iterate_dir(Unit *u, const ch
assert(u);
assert(path);
- if (!(d = opendir(path))) {
+ d = opendir(path);
+ if (!d) {
if (errno == ENOENT)
return 0;
@@ -59,7 +60,7 @@ static int iterate_dir(Unit *u, const ch
free(f);
if (r < 0)
- goto finish;
+ log_error("Cannot add dependency %s to %s, ignoring: %s", de->d_name, u->meta.id, strerror(-r));
}
r = 0;
@@ -95,7 +96,8 @@ static int process_dir(Unit *u, const ch
char *template;
/* Also try the template dir */
- if (!(template = unit_name_template(name)))
+ template = unit_name_template(name);
+ if (!template)
return -ENOMEM;
r = asprintf(&path, "%s/%s%s", unit_path, template, suffix);
@@ -132,10 +134,12 @@ int unit_load_dropin(Unit *u) {
STRV_FOREACH(p, u->meta.manager->lookup_paths.unit_path) {
int r;
- if ((r = process_dir(u, *p, t, ".wants", UNIT_WANTS)) < 0)
+ r = process_dir(u, *p, t, ".wants", UNIT_WANTS);
+ if (r < 0)
return r;
- if ((r = process_dir(u, *p, t, ".requires", UNIT_REQUIRES)) < 0)
+ r = process_dir(u, *p, t, ".requires", UNIT_REQUIRES);
+ if (r < 0)
return r;
}
}

View File

@ -0,0 +1,72 @@
From ae556c210942cb6986c6d77b58505b5daa66bbe2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 28 Jun 2011 13:33:56 +0200
Subject: [PATCH] execute: don't choke when systemd was compiled with a
different CAP_LAST_CAP then what it is run with
---
src/execute.c | 12 ++++++++----
src/nspawn.c | 4 ++--
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/execute.c b/src/execute.c
index a62f9db..b00ccde 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -957,9 +957,12 @@ static int do_capability_bounding_set_drop(uint64_t drop) {
}
}
- for (i = 0; i <= CAP_LAST_CAP; i++)
+ for (i = 0; i <= MAX(63LU, (unsigned long) CAP_LAST_CAP); i++)
if (drop & ((uint64_t) 1ULL << (uint64_t) i)) {
if (prctl(PR_CAPBSET_DROP, i) < 0) {
+ if (errno == EINVAL)
+ break;
+
r = -errno;
goto finish;
}
@@ -1754,13 +1757,14 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
(c->secure_bits & SECURE_NOROOT_LOCKED) ? "noroot-locked" : "");
if (c->capability_bounding_set_drop) {
+ unsigned long l;
fprintf(f, "%sCapabilityBoundingSet:", prefix);
- for (i = 0; i <= CAP_LAST_CAP; i++)
- if (!(c->capability_bounding_set_drop & ((uint64_t) 1ULL << (uint64_t) i))) {
+ for (l = 0; l <= (unsigned long) CAP_LAST_CAP; l++)
+ if (!(c->capability_bounding_set_drop & ((uint64_t) 1ULL << (uint64_t) l))) {
char *t;
- if ((t = cap_to_name(i))) {
+ if ((t = cap_to_name(l))) {
fprintf(f, " %s", t);
cap_free(t);
}
diff --git a/src/nspawn.c b/src/nspawn.c
index b5908d6..1ade6e2 100644
--- a/src/nspawn.c
+++ b/src/nspawn.c
@@ -332,7 +332,7 @@ static int drop_capabilities(void) {
unsigned long l;
- for (l = 0; l <= MAX(63LU, (unsigned long) CAP_LAST_CAP); l ++) {
+ for (l = 0; l <= MAX(63LU, (unsigned long) CAP_LAST_CAP); l++) {
unsigned i;
for (i = 0; i < ELEMENTSOF(retain); i++)
@@ -347,7 +347,7 @@ static int drop_capabilities(void) {
/* If this capability is not known, EINVAL
* will be returned, let's ignore this. */
if (errno == EINVAL)
- continue;
+ break;
log_error("PR_CAPBSET_DROP failed: %m");
return -errno;
--
1.7.4.4

View File

@ -0,0 +1,25 @@
From 7fbf31dfe3cb2f9619df28258208eba36922e9d3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 30 Jun 2011 04:15:53 +0200
Subject: [PATCH] execute: fix PAM error checking
---
src/execute.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/execute.c b/src/execute.c
index c69442d..d297e0a 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1269,7 +1269,7 @@ int exec_spawn(ExecCommand *command,
#ifdef HAVE_PAM
if (context->pam_name && username) {
- if (setup_pam(context->pam_name, username, context->tty_path, &pam_env, fds, n_fds) < 0) {
+ if (setup_pam(context->pam_name, username, context->tty_path, &pam_env, fds, n_fds) != 0) {
r = EXIT_PAM;
goto fail_child;
}
--
1.7.4.4

View File

@ -0,0 +1,44 @@
From 7daa9e6e29b546275566084512ea4e547bc79b91 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 29 Aug 2011 19:44:52 +0200
Subject: [PATCH] execute: fix bus serialization for commands
---
src/dbus-execute.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index 6ceffc5..201f6b5 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -308,13 +308,14 @@ int bus_execute_append_command(DBusMessageIter *i, const char *property, void *d
assert(i);
assert(property);
- if (!dbus_message_iter_open_container(i, DBUS_TYPE_ARRAY, "(sasbttuii)", &sub))
+ if (!dbus_message_iter_open_container(i, DBUS_TYPE_ARRAY, "(sasbttttuii)", &sub))
return -ENOMEM;
LIST_FOREACH(command, c, c) {
char **l;
uint32_t pid;
int32_t code, status;
+ dbus_bool_t b;
if (!c->path)
continue;
@@ -332,8 +333,10 @@ int bus_execute_append_command(DBusMessageIter *i, const char *property, void *d
code = (int32_t) c->exec_status.code;
status = (int32_t) c->exec_status.status;
+ b = !!c->ignore;
+
if (!dbus_message_iter_close_container(&sub2, &sub3) ||
- !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_BOOLEAN, &c->ignore) ||
+ !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_BOOLEAN, &b) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.start_timestamp.realtime) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.start_timestamp.monotonic) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &c->exec_status.exit_timestamp.realtime) ||
--
1.7.4.4

View File

@ -0,0 +1,25 @@
From fa8f36ac15f6c3985f053cdd3698655958442f7f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 1 Aug 2011 21:34:42 +0200
Subject: [PATCH] execute: properly enforce group
https://bugzilla.redhat.com/show_bug.cgi?id=723892
---
src/execute.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/execute.c b/src/execute.c
index f07d018..668bf9d 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1193,7 +1193,7 @@ int exec_spawn(ExecCommand *command,
#endif
if (apply_permissions)
- if (enforce_groups(context, username, uid) < 0) {
+ if (enforce_groups(context, username, gid) < 0) {
r = EXIT_GROUP;
goto fail_child;
}
--
1.7.6

View File

@ -0,0 +1,333 @@
From 27d340c772fb1b251085dba7bd5420484f7c5892 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 1 Sep 2011 21:05:06 +0200
Subject: [PATCH] fsck: show progress while fscking at boot
---
[fixed up a small reject -- michich]
Index: systemd-26/src/fsck.c
===================================================================
--- systemd-26.orig/src/fsck.c
+++ systemd-26/src/fsck.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/file.h>
#include <libudev.h>
#include <dbus/dbus.h>
@@ -36,6 +37,7 @@
static bool arg_skip = false;
static bool arg_force = false;
+static bool arg_show_progress = false;
static void start_target(const char *target, bool isolate) {
DBusMessage *m = NULL, *reply = NULL;
@@ -142,10 +144,103 @@ static void test_files(void) {
if (access("/forcefsck", F_OK) >= 0)
arg_force = true;
+
+ if (access("/run/systemd/show-status", F_OK) >= 0 || plymouth_running())
+ arg_show_progress = true;
+}
+
+static double percent(int pass, unsigned long cur, unsigned long max) {
+ /* Values stolen from e2fsck */
+
+ static const int pass_table[] = {
+ 0, 70, 90, 92, 95, 100
+ };
+
+ if (pass <= 0)
+ return 0.0;
+
+ if ((unsigned) pass >= ELEMENTSOF(pass_table) || max == 0)
+ return 100.0;
+
+ return (double) pass_table[pass-1] +
+ ((double) pass_table[pass] - (double) pass_table[pass-1]) *
+ (double) cur / (double) max;
+}
+
+static int process_progress(int fd) {
+ FILE *f, *console;
+ usec_t last = 0;
+ bool locked = false;
+ int clear = 0;
+
+ f = fdopen(fd, "r");
+ if (!f) {
+ close_nointr_nofail(fd);
+ return -errno;
+ }
+
+ console = fopen("/dev/console", "w");
+ if (!console) {
+ fclose(f);
+ return -ENOMEM;
+ }
+
+ while (!feof(f)) {
+ int pass, m;
+ unsigned long cur, max;
+ char *device;
+ double p;
+ usec_t t;
+
+ if (fscanf(f, "%i %lu %lu %ms", &pass, &cur, &max, &device) != 4)
+ break;
+
+ /* Only show one progress counter at max */
+ if (!locked) {
+ if (flock(fileno(console), LOCK_EX|LOCK_NB) < 0) {
+ free(device);
+ continue;
+ }
+
+ locked = true;
+ }
+
+ /* Only update once every 50ms */
+ t = now(CLOCK_MONOTONIC);
+ if (last + 50 * USEC_PER_MSEC > t) {
+ free(device);
+ continue;
+ }
+
+ last = t;
+
+ p = percent(pass, cur, max);
+ fprintf(console, "\r%s: fsck %3.1f%% complete...\r%n", device, p, &m);
+ fflush(console);
+
+ free(device);
+
+ if (m > clear)
+ clear = m;
+ }
+
+ if (clear > 0) {
+ unsigned j;
+
+ fputc('\r', console);
+ for (j = 0; j < (unsigned) clear; j++)
+ fputc(' ', console);
+ fputc('\r', console);
+ fflush(console);
+ }
+
+ fclose(f);
+ fclose(console);
+ return 0;
}
int main(int argc, char *argv[]) {
- const char *cmdline[8];
+ const char *cmdline[9];
int i = 0, r = EXIT_FAILURE, q;
pid_t pid;
siginfo_t status;
@@ -153,13 +248,15 @@ int main(int argc, char *argv[]) {
struct udev_device *udev_device = NULL;
const char *device;
bool root_directory;
+ int progress_pipe[2] = { -1, -1 };
+ char dash_c[2+10+1];
if (argc > 2) {
log_error("This program expects one or no arguments.");
return EXIT_FAILURE;
}
- log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
@@ -213,6 +310,12 @@ int main(int argc, char *argv[]) {
root_directory = true;
}
+ if (arg_show_progress)
+ if (pipe(progress_pipe) < 0) {
+ log_error("pipe(): %m");
+ goto finish;
+ }
+
cmdline[i++] = "/sbin/fsck";
cmdline[i++] = "-a";
cmdline[i++] = "-T";
@@ -224,19 +327,39 @@ int main(int argc, char *argv[]) {
if (arg_force)
cmdline[i++] = "-f";
+ if (progress_pipe[1] >= 0) {
+ snprintf(dash_c, sizeof(dash_c), "-C%i", progress_pipe[1]);
+ char_array_0(dash_c);
+ cmdline[i++] = dash_c;
+ }
+
cmdline[i++] = device;
cmdline[i++] = NULL;
- if ((pid = fork()) < 0) {
+ pid = fork();
+ if (pid < 0) {
log_error("fork(): %m");
goto finish;
} else if (pid == 0) {
/* Child */
+ if (progress_pipe[0] >= 0)
+ close_nointr_nofail(progress_pipe[0]);
execv(cmdline[0], (char**) cmdline);
_exit(8); /* Operational error */
}
- if ((q = wait_for_terminate(pid, &status)) < 0) {
+ if (progress_pipe[1] >= 0) {
+ close_nointr_nofail(progress_pipe[1]);
+ progress_pipe[1] = -1;
+ }
+
+ if (progress_pipe[0] >= 0) {
+ process_progress(progress_pipe[0]);
+ progress_pipe[0] = -1;
+ }
+
+ q = wait_for_terminate(pid, &status);
+ if (q < 0) {
log_error("waitid(): %s", strerror(-q));
goto finish;
}
@@ -274,5 +397,7 @@ finish:
if (udev)
udev_unref(udev);
+ close_pipe(progress_pipe);
+
return r;
}
Index: systemd-26/src/main.c
===================================================================
--- systemd-26.orig/src/main.c
+++ systemd-26/src/main.c
@@ -1194,7 +1194,6 @@ int main(int argc, char *argv[]) {
}
m->confirm_spawn = arg_confirm_spawn;
- m->show_status = arg_show_status;
#ifdef HAVE_SYSV_COMPAT
m->sysv_console = arg_sysv_console;
#endif
@@ -1209,6 +1208,8 @@ int main(int argc, char *argv[]) {
if (arg_default_controllers)
manager_set_default_controllers(m, arg_default_controllers);
+ manager_set_show_status(m, arg_show_status);
+
if ((r = manager_startup(m, serialization, fds)) < 0)
log_error("Failed to fully start up daemon: %s", strerror(-r));
Index: systemd-26/src/manager.c
===================================================================
--- systemd-26.orig/src/manager.c
+++ systemd-26/src/manager.c
@@ -2241,12 +2241,12 @@ static int manager_process_signal_fd(Man
case 20:
log_debug("Enabling showing of status.");
- m->show_status = true;
+ manager_set_show_status(m, true);
break;
case 21:
log_debug("Disabling showing of status.");
- m->show_status = false;
+ manager_set_show_status(m, false);
break;
case 22:
@@ -2897,7 +2897,8 @@ bool manager_is_booting_or_shutting_down
return true;
/* Is there a job for the shutdown target? */
- if (((u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET))))
+ u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET);
+ if (u)
return !!u->meta.job;
return false;
@@ -3114,6 +3115,35 @@ void manager_recheck_syslog(Manager *m)
log_open();
}
+void manager_set_show_status(Manager *m, bool b) {
+ assert(m);
+
+ if (m->running_as != MANAGER_SYSTEM)
+ return;
+
+ m->show_status = b;
+
+ if (b)
+ touch("/run/systemd/show-status");
+ else
+ unlink("/run/systemd/show-status");
+}
+
+bool manager_get_show_status(Manager *m) {
+ assert(m);
+
+ if (m->running_as != MANAGER_SYSTEM)
+ return false;
+
+ if (m->show_status)
+ return true;
+
+ /* If Plymouth is running make sure we show the status, so
+ * that there's something nice to see when people press Esc */
+
+ return plymouth_running();
+}
+
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
[MANAGER_SYSTEM] = "system",
[MANAGER_USER] = "user"
Index: systemd-26/src/manager.h
===================================================================
--- systemd-26.orig/src/manager.h
+++ systemd-26/src/manager.h
@@ -290,6 +290,9 @@ void manager_undo_generators(Manager *m)
void manager_recheck_syslog(Manager *m);
+void manager_set_show_status(Manager *m, bool b);
+bool manager_get_show_status(Manager *m);
+
const char *manager_running_as_to_string(ManagerRunningAs i);
ManagerRunningAs manager_running_as_from_string(const char *s);
Index: systemd-26/src/unit.c
===================================================================
--- systemd-26.orig/src/unit.c
+++ systemd-26/src/unit.c
@@ -2285,13 +2285,7 @@ void unit_status_printf(Unit *u, const c
if (!UNIT_VTABLE(u)->show_status)
return;
- if (u->meta.manager->running_as != MANAGER_SYSTEM)
- return;
-
- /* If Plymouth is running make sure we show the status, so
- * that there's something nice to see when people press Esc */
-
- if (!u->meta.manager->show_status && !plymouth_running())
+ if (!manager_get_show_status(u->meta.manager))
return;
if (!manager_is_booting_or_shutting_down(u->meta.manager))

View File

@ -0,0 +1,151 @@
From 3c20189a722e6f2eec12c57c3bf3567533073c66 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 04:15:42 +0200
Subject: [PATCH] getty: automatically add getty on hvsi0 virtualizer console
https://bugs.freedesktop.org/show_bug.cgi?id=39818
---
[Fixed rejects and applied pieces of trivial patches that were skipped -- michich]
Index: systemd-26/src/99-systemd.rules
===================================================================
--- systemd-26.orig/src/99-systemd.rules
+++ systemd-26/src/99-systemd.rules
@@ -8,7 +8,7 @@
ACTION!="add|change", GOTO="systemd_end"
SUBSYSTEM=="tty", KERNEL=="tty[0-9]|tty1[0-2]", TAG+="systemd"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*", TAG+="systemd"
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*", TAG+="systemd"
SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd"
SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
Index: systemd-26/src/getty-generator.c
===================================================================
--- systemd-26.orig/src/getty-generator.c
+++ systemd-26/src/getty-generator.c
@@ -47,7 +47,7 @@ static int add_symlink(const char *fserv
r = symlink(from, to);
if (r < 0) {
if (errno == EEXIST)
- /* In case console=hvc is passed this will very likely result in EEXIST */
+ /* In case console=hvc0 is passed this will very likely result in EEXIST */
r = 0;
else {
log_error("Failed to create symlink from %s to %s: %m", from, to);
@@ -64,21 +64,30 @@ finish:
}
int main(int argc, char *argv[]) {
+
+ static const char virtualization_consoles[] =
+ "hvc0\0"
+ "xvc0\0"
+ "hvsi0\0";
+
int r = EXIT_SUCCESS;
char *active;
+ const char *j;
if (argc > 2) {
log_error("This program takes one or no arguments.");
return EXIT_FAILURE;
}
- if (argc > 1)
- arg_dest = argv[1];
-
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment();
log_open();
+ umask(0022);
+
+ if (argc > 1)
+ arg_dest = argv[1];
+
if (detect_container(NULL) > 0) {
log_debug("Automatic adding console shell.");
@@ -100,8 +109,11 @@ int main(int argc, char *argv[]) {
/* Automatically add in a serial getty on the kernel
* console */
- if (!tty_is_vc(tty)) {
+ if (tty_is_vc(tty))
+ free(active);
+ else {
char *n;
+ int k;
/* We assume that gettys on virtual terminals are
* started via manual configuration and do this magic
@@ -110,30 +122,57 @@ int main(int argc, char *argv[]) {
log_debug("Automatically adding serial getty for /dev/%s.", tty);
n = unit_name_replace_instance("serial-getty@.service", tty);
- if (!n || add_symlink("serial-getty@.service", n) < 0)
+ free(active);
+
+ if (!n) {
+ log_error("Out of memory");
r = EXIT_FAILURE;
+ goto finish;
+ }
+ k = add_symlink("serial-getty@.service", n);
free(n);
+ if (k < 0) {
+ r = EXIT_FAILURE;
+ goto finish;
+ }
}
-
- free(active);
}
/* Automatically add in a serial getty on the first
* virtualizer console */
- if (access("/sys/class/tty/hvc0", F_OK) == 0) {
- log_debug("Automatic adding serial getty for hvc0.");
+ NULSTR_FOREACH(j, virtualization_consoles) {
+ char *n, *p;
+ int k;
- if (add_symlink("serial-getty@.service", "serial-getty@hvc0.service") < 0)
+ if (asprintf(&p, "/sys/class/tty/%s", j) < 0) {
+ log_error("Out of memory");
r = EXIT_FAILURE;
+ goto finish;
+ }
- }
+ k = access(p, F_OK);
+ free(p);
+
+ if (k < 0)
+ continue;
- if (access("/sys/class/tty/xvc0", F_OK) == 0) {
- log_debug("Automatic adding serial getty for xvc0.");
+ log_debug("Automatically adding serial getty for /dev/%s.", j);
- if (add_symlink("serial-getty@.service", "serial-getty@xvc0.service") < 0)
+ n = unit_name_replace_instance("serial-getty@.service", j);
+ if (!n) {
+ log_error("Out of memory");
r = EXIT_FAILURE;
+ goto finish;
+ }
+
+ k = add_symlink("serial-getty@.service", n);
+ free(n);
+
+ if (k < 0) {
+ r = EXIT_FAILURE;
+ goto finish;
+ }
}
finish:

View File

@ -0,0 +1,45 @@
From 980fc73d1fcda8c2a494a18dbd3262fdb97f5fbe Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 1 Aug 2011 20:27:57 +0200
Subject: [PATCH] getty: automatically spawn getty on xen console xvc0
https://bugzilla.redhat.com/show_bug.cgi?id=726976
---
src/99-systemd.rules | 2 +-
src/getty-generator.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/99-systemd.rules b/src/99-systemd.rules
index e0aa49d..6aaf827 100644
--- a/src/99-systemd.rules
+++ b/src/99-systemd.rules
@@ -8,7 +8,7 @@
ACTION!="add|change", GOTO="systemd_end"
SUBSYSTEM=="tty", KERNEL=="tty[0-9]|tty1[0-2]", TAG+="systemd"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*", TAG+="systemd"
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*", TAG+="systemd"
SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd"
SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
diff --git a/src/getty-generator.c b/src/getty-generator.c
index 683775a..141402b 100644
--- a/src/getty-generator.c
+++ b/src/getty-generator.c
@@ -119,6 +119,14 @@ int main(int argc, char *argv[]) {
if (add_symlink("serial-getty@.service", "serial-getty@hvc0.service") < 0)
r = EXIT_FAILURE;
+
+ }
+
+ if (access("/sys/class/tty/xvc0", F_OK) == 0) {
+ log_debug("Automatic adding serial getty for xvc0.");
+
+ if (add_symlink("serial-getty@.service", "serial-getty@xvc0.service") < 0)
+ r = EXIT_FAILURE;
}
finish:
--
1.7.6

View File

@ -0,0 +1,56 @@
From a17b785b5fa57fba8cd658fdf710d5987413d9c2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 01:30:57 +0200
Subject: [PATCH] getty-generator: ignore if symlinks already exist
---
src/getty-generator.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/getty-generator.c b/src/getty-generator.c
index 7cce76f..14cceb4 100644
--- a/src/getty-generator.c
+++ b/src/getty-generator.c
@@ -44,9 +44,15 @@ static int add_symlink(const char *fservice, const char *tservice) {
mkdir_parents(to, 0755);
- if ((r = symlink(from, to)) < 0) {
- log_error("Failed to create symlink from %s to %s: %m", from, to);
- r = -errno;
+ r = symlink(from, to);
+ if (r < 0) {
+ if (errno == EEXIST)
+ /* In case console=hvc is passed this will very likely result in EEXIST */
+ r = 0;
+ else {
+ log_error("Failed to create symlink from %s to %s: %m", from, to);
+ r = -errno;
+ }
}
finish:
@@ -88,7 +94,8 @@ int main(int argc, char *argv[]) {
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
const char *tty;
- if ((tty = strrchr(active, ' ')))
+ tty = strrchr(active, ' ');
+ if (tty)
tty ++;
else
tty = active;
@@ -104,8 +111,8 @@ int main(int argc, char *argv[]) {
log_debug("Automatically adding serial getty for /dev/%s.", tty);
- if (!(n = unit_name_replace_instance("serial-getty@.service", tty)) ||
- add_symlink("serial-getty@.service", n) < 0)
+ n = unit_name_replace_instance("serial-getty@.service", tty);
+ if (!n || add_symlink("serial-getty@.service", n) < 0)
r = EXIT_FAILURE;
free(n);
--
1.7.4.4

View File

@ -0,0 +1,108 @@
From 4dc380d16dfbead78de9caaf5104dbc00bac6d75 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 04:22:41 +0200
Subject: [PATCH] getty: simplify things a bit
https://bugs.freedesktop.org/show_bug.cgi?id=39818
---
[Fixed a reject -- michich]
Index: systemd-26/src/getty-generator.c
===================================================================
--- systemd-26.orig/src/getty-generator.c
+++ systemd-26/src/getty-generator.c
@@ -33,6 +33,9 @@ static int add_symlink(const char *fserv
char *from = NULL, *to = NULL;
int r;
+ assert(fservice);
+ assert(tservice);
+
asprintf(&from, SYSTEM_DATA_UNIT_PATH "/%s", fservice);
asprintf(&to, "%s/getty.target.wants/%s", arg_dest, tservice);
@@ -63,6 +66,26 @@ finish:
return r;
}
+static int add_serial_getty(const char *tty) {
+ char *n;
+ int r;
+
+ assert(tty);
+
+ log_debug("Automatically adding serial getty for /dev/%s.", tty);
+
+ n = unit_name_replace_instance("serial-getty@.service", tty);
+ if (!n) {
+ log_error("Out of memory");
+ return -ENOMEM;
+ }
+
+ r = add_symlink("serial-getty@.service", n);
+ free(n);
+
+ return r;
+}
+
int main(int argc, char *argv[]) {
static const char virtualization_consoles[] =
@@ -112,26 +135,15 @@ int main(int argc, char *argv[]) {
if (tty_is_vc(tty))
free(active);
else {
- char *n;
int k;
/* We assume that gettys on virtual terminals are
* started via manual configuration and do this magic
* only for non-VC terminals. */
- log_debug("Automatically adding serial getty for /dev/%s.", tty);
-
- n = unit_name_replace_instance("serial-getty@.service", tty);
+ k = add_serial_getty(tty);
free(active);
- if (!n) {
- log_error("Out of memory");
- r = EXIT_FAILURE;
- goto finish;
- }
-
- k = add_symlink("serial-getty@.service", n);
- free(n);
if (k < 0) {
r = EXIT_FAILURE;
goto finish;
@@ -142,7 +154,7 @@ int main(int argc, char *argv[]) {
/* Automatically add in a serial getty on the first
* virtualizer console */
NULSTR_FOREACH(j, virtualization_consoles) {
- char *n, *p;
+ char *p;
int k;
if (asprintf(&p, "/sys/class/tty/%s", j) < 0) {
@@ -157,18 +169,7 @@ int main(int argc, char *argv[]) {
if (k < 0)
continue;
- log_debug("Automatically adding serial getty for /dev/%s.", j);
-
- n = unit_name_replace_instance("serial-getty@.service", j);
- if (!n) {
- log_error("Out of memory");
- r = EXIT_FAILURE;
- goto finish;
- }
-
- k = add_symlink("serial-getty@.service", n);
- free(n);
-
+ k = add_serial_getty(j);
if (k < 0) {
r = EXIT_FAILURE;
goto finish;

View File

@ -0,0 +1,40 @@
From 57981b98123a6504c68981c7e3cd43f7cc1668f7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 21 Sep 2011 19:56:15 +0200
Subject: [PATCH] job: after converting a job from restart to start readd it
to run queue
When we converted a restart job it's time to look again whether any of
its dependencies are now runnable.
https://bugzilla.redhat.com/show_bug.cgi?id=735013
---
src/job.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/job.c b/src/job.c
index 26e1a7c..5c0913b 100644
--- a/src/job.c
+++ b/src/job.c
@@ -544,7 +544,9 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
j->type = JOB_START;
job_add_to_run_queue(j);
- return 0;
+
+ u = j->unit;
+ goto finish;
}
j->result = result;
@@ -613,6 +615,7 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
unit_trigger_on_failure(u);
}
+finish:
/* Try to start the next jobs that can be started */
SET_FOREACH(other, u->meta.dependencies[UNIT_AFTER], i)
if (other->meta.job)
--
1.7.4.4

View File

@ -0,0 +1,32 @@
From de3756ab9916551f3f4f1f360aee59aeed238b5b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 23 Sep 2011 02:39:28 +0200
Subject: [PATCH] llvm-analyze: fix some bugs found by llvm-analyze
---
[ removed hunks for code not present in F15 -- michich ]
src/socket.c | 6 ++++++
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/socket.c b/src/socket.c
index a1b451e..7ddf326 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1962,6 +1962,12 @@ int socket_collect_fds(Socket *s, int **fds, unsigned *n_fds) {
if (p->fd >= 0)
rn_fds++;
+ if (rn_fds <= 0) {
+ *fds = NULL;
+ *n_fds = 0;
+ return 0;
+ }
+
if (!(rfds = new(int, rn_fds)))
return -ENOMEM;
--
1.7.4.4

View File

@ -0,0 +1,101 @@
From 07bceef2a9c520e24da427c7ce500ad36ad37571 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 14:09:14 +0200
Subject: [PATCH] locale: support $LANGUAGE too
$LANGUAGE is a GNU extension that is probably worth supporting, since it
allows specifiying an order of languages.
https://bugs.freedesktop.org/show_bug.cgi?id=40510
---
[removed the localed.c patch -- michich]
man/locale.conf.xml | 2 ++
src/locale-setup.c | 8 ++++++--
units/getty@.service.m4 | 2 +-
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/man/locale.conf.xml b/man/locale.conf.xml
index 742c5eb..3723997 100644
--- a/man/locale.conf.xml
+++ b/man/locale.conf.xml
@@ -69,6 +69,7 @@
<para>Note that the kernel command line options
<varname>locale.LANG=</varname>,
+ <varname>locale.LANGUAGE=</varname>,
<varname>locale.LC_CTYPE=</varname>,
<varname>locale.LC_NUMERIC=</varname>,
<varname>locale.LC_TIME=</varname>,
@@ -101,6 +102,7 @@
<para>The following locale settings may be set using
<filename>/etc/locale.conf</filename>:
<varname>LANG=</varname>,
+ <varname>LANGUAGE=</varname>,
<varname>LC_CTYPE=</varname>,
<varname>LC_NUMERIC=</varname>,
<varname>LC_TIME=</varname>,
diff --git a/src/locale-setup.c b/src/locale-setup.c
index 33111da..41eb50b 100644
--- a/src/locale-setup.c
+++ b/src/locale-setup.c
@@ -32,6 +32,7 @@ enum {
* using LANG instead. */
VARIABLE_LANG,
+ VARIABLE_LANGUAGE,
VARIABLE_LC_CTYPE,
VARIABLE_LC_NUMERIC,
VARIABLE_LC_TIME,
@@ -49,6 +50,7 @@ enum {
static const char * const variable_names[_VARIABLE_MAX] = {
[VARIABLE_LANG] = "LANG",
+ [VARIABLE_LANGUAGE] = "LANGUAGE",
[VARIABLE_LC_CTYPE] = "LC_CTYPE",
[VARIABLE_LC_NUMERIC] = "LC_NUMERIC",
[VARIABLE_LC_TIME] = "LC_TIME",
@@ -75,6 +77,7 @@ int locale_setup(void) {
"LANG", &variables[VARIABLE_LANG],
#endif
"locale.LANG", &variables[VARIABLE_LANG],
+ "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE],
"locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
"locale.LC_NUMERIC", &variables[VARIABLE_LC_NUMERIC],
"locale.LC_TIME", &variables[VARIABLE_LC_TIME],
@@ -98,6 +101,7 @@ int locale_setup(void) {
if (r <= 0 &&
(r = parse_env_file("/etc/locale.conf", NEWLINE,
"LANG", &variables[VARIABLE_LANG],
+ "LANGUAGE", &variables[VARIABLE_LANGUAGE],
"LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
"LC_NUMERIC", &variables[VARIABLE_LC_NUMERIC],
"LC_TIME", &variables[VARIABLE_LC_TIME],
@@ -212,8 +216,8 @@ int locale_setup(void) {
"LC_IDENTIFICATION", &variables[VARIABLE_LC_IDENTIFICATION],
NULL)) < 0) {
- if (r != -ENOENT)
- log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
}
#endif
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index b111567..14d8187 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -44,7 +44,7 @@ KillMode=process
# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
-Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
+Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
--
1.7.4.4

View File

@ -0,0 +1,117 @@
From 253ee27a0c7a410d27d490bb79ea97caed6a2b68 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 23 Jul 2011 04:15:38 +0200
Subject: [PATCH] manager: add log control via RT signals
---
[hand-edited to remove unrelated TODO edits -- michich]
diff --git a/man/systemd.xml b/man/systemd.xml
index 142c1d6..5129fbb 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -800,6 +800,44 @@
on the kernel command
line.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>SIGRTMIN+22</term>
+ <term>SIGRTMIN+23</term>
+
+ <listitem><para>Sets the log level to
+ <literal>debug</literal>
+ (resp. <literal>info</literal> on
+ <literal>SIGRTMIN+32</literal>), as
+ controlled via
+ <varname>systemd.log_level=debug</varname>
+ (resp. <varname>systemd.log_level=info</varname>
+ on <literal>SIGRTMIN+23</literal>) on
+ the kernel command
+ line.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SIGRTMIN+27</term>
+ <term>SIGRTMIN+28</term>
+ <term>SIGRTMIN+29</term>
+
+ <listitem><para>Sets the log level to
+ <literal>console</literal>
+ (resp. <literal>kmsg</literal> on
+ <literal>SIGRTMIN+28</literal>;
+ resp.<literal>syslog-or-kmsg</literal>
+ on <literal>SIGRTMIN+29</literal>), as
+ controlled via
+ <varname>systemd.log_target=console</varname>
+ (resp. <varname>systemd.log_target=kmsg</varname>
+ on <literal>SIGRTMIN+28</literal>;
+ resp
+ <varname>systemd.log_target=syslog-or-kmsg</varname>
+ on <literal>SIGRTMIN+29</literal>) on
+ the kernel command
+ line.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/manager.c b/src/manager.c
index c1242ae..cdd618e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -186,6 +186,11 @@ static int manager_setup_signals(Manager *m) {
SIGRTMIN+16, /* systemd: Immediate kexec */
SIGRTMIN+20, /* systemd: enable status messages */
SIGRTMIN+21, /* systemd: disable status messages */
+ SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */
+ SIGRTMIN+23, /* systemd: set log level to LOG_INFO */
+ SIGRTMIN+27, /* systemd: set log target to console */
+ SIGRTMIN+28, /* systemd: set log target to kmsg */
+ SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */
-1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
@@ -2200,6 +2205,7 @@ static int manager_process_signal_fd(Manager *m) {
break;
default: {
+
/* Starting SIGRTMIN+0 */
static const char * const target_table[] = {
[0] = SPECIAL_DEFAULT_TARGET,
@@ -2244,6 +2250,31 @@ static int manager_process_signal_fd(Manager *m) {
m->show_status = false;
break;
+ case 22:
+ log_set_max_level(LOG_DEBUG);
+ log_notice("Setting log level to debug.");
+ break;
+
+ case 23:
+ log_set_max_level(LOG_INFO);
+ log_notice("Setting log level to info.");
+ break;
+
+ case 27:
+ log_set_target(LOG_TARGET_CONSOLE);
+ log_notice("Setting log target to console.");
+ break;
+
+ case 28:
+ log_set_target(LOG_TARGET_KMSG);
+ log_notice("Setting log target to kmsg.");
+ break;
+
+ case 29:
+ log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
+ log_notice("Setting log target to syslog-or-kmsg.");
+ break;
+
default:
log_warning("Got unhandled signal <%s>.", strna(signal_to_string(sfsi.ssi_signo)));
}
--
1.7.4.4

View File

@ -0,0 +1,34 @@
From 07f8a4aa49a84ec61513788d5ddf521f3de5a0ba Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 1 Aug 2011 20:51:18 +0200
Subject: [PATCH] manager: call generators with umask 0022
---
src/manager.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/manager.c b/src/manager.c
index 9e4bd51..69dbec4 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2985,6 +2985,7 @@ void manager_run_generators(Manager *m) {
DIR *d = NULL;
const char *generator_path;
const char *argv[3];
+ mode_t u;
assert(m);
@@ -3027,7 +3028,9 @@ void manager_run_generators(Manager *m) {
argv[1] = m->generator_unit_path;
argv[2] = NULL;
+ u = umask(0022);
execute_directory(generator_path, d, (char**) argv);
+ umask(u);
if (rmdir(m->generator_unit_path) >= 0) {
/* Uh? we were able to remove this dir? I guess that
--
1.7.6

View File

@ -0,0 +1,38 @@
From 1b562e4604f8833bc21fd251b8bdb45c9c224df4 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sat, 2 Jul 2011 14:52:52 +0200
Subject: [PATCH] manager: consider the active job when merging
In some cases systemd forgets to start enabled services, e.g. in this scenario:
1. The job "sendmail.service/start" is installed.
2. Before systemd proceeds with this job, a process requests a reload of
sendmail. The job "sendmail.service/reload" is enqueued.
3. The original job is silently discarded. The service is not started.
The reload job proceeds by doing nothing.
The fix is to allow merging transaction jobs with the active job.
With the fix the resulting merged job "sendmail.service/reload-or-start" is
installed and the service works as expected.
https://bugzilla.redhat.com/show_bug.cgi?id=633774
---
src/manager.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/manager.c b/src/manager.c
index 92a6dff..258b3ca 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -897,6 +897,9 @@ static int transaction_merge_jobs(Manager *m, DBusError *e) {
transaction_merge_and_delete_job(m, j, k, t);
}
+ if (j->unit->meta.job && !j->installed)
+ transaction_merge_and_delete_job(m, j, j->unit->meta.job, t);
+
assert(!j->transaction_next);
assert(!j->transaction_prev);
}
--
1.7.4.4

View File

@ -0,0 +1,29 @@
From 764e9b5f073e1d5216de150045ec85475835fe3c Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 23 Sep 2011 09:37:45 +0200
Subject: [PATCH] manager: fix job mode for SIGRTMIN+1, +2
The test did not work as intended and always resulted in JOB_REPLACE.
---
src/manager.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/manager.c b/src/manager.c
index 6311c10..cf308ac 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2233,8 +2233,9 @@ static int manager_process_signal_fd(Manager *m) {
if ((int) sfsi.ssi_signo >= SIGRTMIN+0 &&
(int) sfsi.ssi_signo < SIGRTMIN+(int) ELEMENTSOF(target_table)) {
- manager_start_target(m, target_table[sfsi.ssi_signo - SIGRTMIN],
- (sfsi.ssi_signo == 1 || sfsi.ssi_signo == 2) ? JOB_ISOLATE : JOB_REPLACE);
+ int idx = (int) sfsi.ssi_signo - SIGRTMIN;
+ manager_start_target(m, target_table[idx],
+ (idx == 1 || idx == 2) ? JOB_ISOLATE : JOB_REPLACE);
break;
}
--
1.7.4.4

View File

@ -0,0 +1,33 @@
[hand-removed a TODO hunk -- michich]
From 3661ac04b4f2840d3345605aa35963bbde3c469d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 20 Jun 2011 21:39:28 +0200
Subject: [PATCH] manager: include full systemctl status command line in error
message
---
TODO | 2 ++
src/manager.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/manager.c b/src/manager.c
index 68d43ad..62451a0 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1468,9 +1468,10 @@ static int transaction_add_job_and_dependencies(
if (type != JOB_STOP && unit->meta.load_state == UNIT_ERROR) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
"Unit %s failed to load: %s. "
- "See system logs and 'systemctl status' for details.",
+ "See system logs and 'systemctl status %s' for details.",
unit->meta.id,
- strerror(-unit->meta.load_error));
+ strerror(-unit->meta.load_error),
+ unit->meta.id);
return -EINVAL;
}
--
1.7.4.4

View File

@ -0,0 +1,289 @@
From a75560529663e5fd055884e32ab9c73f47f8aaa5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 6 Jul 2011 00:47:39 +0200
Subject: [PATCH] manager: merge serialization and desrialization counter into
one, and increase it when reexecuting
Instead of having individual counters n_serializing and n_deserializing
have a single one n_reloading, which should be sufficient.
Set n_reloading when we are about to go down for reexecution to avoid
cgroup trimming when we free the units for reexecution.
---
src/fdset.c | 6 ++++++
src/main.c | 3 +++
src/manager.c | 41 ++++++++++++++++++-----------------------
src/manager.h | 4 ++--
src/service.c | 2 +-
src/snapshot.c | 2 +-
src/unit.c | 10 +++++-----
7 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/src/fdset.c b/src/fdset.c
index 9bf3788..e67fe6f 100644
--- a/src/fdset.c
+++ b/src/fdset.c
@@ -49,6 +49,12 @@ void fdset_free(FDSet *s) {
* here, so that the EBADFD that valgrind will return
* us on close() doesn't influence us */
+ /* When reloading duplicates of the private bus
+ * connection fds and suchlike are closed here, which
+ * has no effect at all, since they are only
+ * duplicates. So don't be surprised about these log
+ * messages. */
+
log_debug("Closing left-over fd %i", PTR_TO_FD(p));
close_nointr(PTR_TO_FD(p));
}
diff --git a/src/main.c b/src/main.c
index 76a0943..5a8ef52 100644
--- a/src/main.c
+++ b/src/main.c
@@ -898,6 +898,9 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
assert(_f);
assert(_fds);
+ /* Make sure nothing is really destructed when we shut down */
+ m->n_reloading ++;
+
if ((r = manager_open_serialization(m, &f)) < 0) {
log_error("Failed to create serialization file: %s", strerror(-r));
goto fail;
diff --git a/src/manager.c b/src/manager.c
index 7b725e3..3291275 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -595,7 +595,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
* this is already known, so we increase the counter here
* already */
if (serialization)
- m->n_deserializing ++;
+ m->n_reloading ++;
/* First, enumerate what we can from all config files */
r = manager_enumerate(m);
@@ -610,8 +610,8 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
r = q;
if (serialization) {
- assert(m->n_deserializing > 0);
- m->n_deserializing --;
+ assert(m->n_reloading > 0);
+ m->n_reloading --;
}
return r;
@@ -2476,7 +2476,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
/* Don't generate audit events if the service was already
* started and we're just deserializing */
- if (m->n_deserializing > 0)
+ if (m->n_reloading > 0)
return;
if (m->running_as != MANAGER_SYSTEM)
@@ -2517,7 +2517,7 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) {
/* Don't generate plymouth events if the service was already
* started and we're just deserializing */
- if (m->n_deserializing > 0)
+ if (m->n_reloading > 0)
return;
if (m->running_as != MANAGER_SYSTEM)
@@ -2659,7 +2659,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
assert(f);
assert(fds);
- m->n_serializing ++;
+ m->n_reloading ++;
fprintf(f, "current-job-id=%i\n", m->current_job_id);
fprintf(f, "taint-usr=%s\n", yes_no(m->taint_usr));
@@ -2682,13 +2682,13 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
fputc('\n', f);
if ((r = unit_serialize(u, f, fds)) < 0) {
- m->n_serializing --;
+ m->n_reloading --;
return r;
}
}
- assert(m->n_serializing > 0);
- m->n_serializing --;
+ assert(m->n_reloading > 0);
+ m->n_reloading --;
if (ferror(f))
return -EIO;
@@ -2708,7 +2708,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
log_debug("Deserializing state...");
- m->n_deserializing ++;
+ m->n_reloading ++;
for (;;) {
char line[LINE_MAX], *l;
@@ -2781,8 +2781,8 @@ finish:
goto finish;
}
- assert(m->n_deserializing > 0);
- m->n_deserializing --;
+ assert(m->n_reloading > 0);
+ m->n_reloading --;
return r;
}
@@ -2797,21 +2797,21 @@ int manager_reload(Manager *m) {
if ((r = manager_open_serialization(m, &f)) < 0)
return r;
- m->n_serializing ++;
+ m->n_reloading ++;
if (!(fds = fdset_new())) {
- m->n_serializing --;
+ m->n_reloading --;
r = -ENOMEM;
goto finish;
}
if ((r = manager_serialize(m, f, fds)) < 0) {
- m->n_serializing --;
+ m->n_reloading --;
goto finish;
}
if (fseeko(f, 0, SEEK_SET) < 0) {
- m->n_serializing --;
+ m->n_reloading --;
r = -errno;
goto finish;
}
@@ -2820,9 +2820,6 @@ int manager_reload(Manager *m) {
manager_clear_jobs_and_units(m);
manager_undo_generators(m);
- assert(m->n_serializing > 0);
- m->n_serializing --;
-
/* Find new unit paths */
lookup_paths_free(&m->lookup_paths);
if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
@@ -2832,8 +2829,6 @@ int manager_reload(Manager *m) {
manager_build_unit_path_cache(m);
- m->n_deserializing ++;
-
/* First, enumerate what we can from all config files */
if ((q = manager_enumerate(m)) < 0)
r = q;
@@ -2849,8 +2844,8 @@ int manager_reload(Manager *m) {
if ((q = manager_coldplug(m)) < 0)
r = q;
- assert(m->n_deserializing > 0);
- m->n_deserializing--;
+ assert(m->n_reloading > 0);
+ m->n_reloading--;
finish:
if (f)
diff --git a/src/manager.h b/src/manager.h
index 4557d5f..22730d2 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -223,8 +223,8 @@ struct Manager {
ExecOutput default_std_output, default_std_error;
- int n_serializing;
- int n_deserializing;
+ /* non-zero if we are reloading or reexecuting, */
+ int n_reloading;
unsigned n_installed_jobs;
unsigned n_failed_jobs;
diff --git a/src/service.c b/src/service.c
index 5c7e62f..b684a37 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1496,7 +1496,7 @@ static void service_set_state(Service *s, ServiceState state) {
/* For the inactive states unit_notify() will trim the cgroup,
* but for exit we have to do that ourselves... */
- if (state == SERVICE_EXITED && s->meta.manager->n_deserializing <= 0)
+ if (state == SERVICE_EXITED && s->meta.manager->n_reloading <= 0)
cgroup_bonding_trim_list(s->meta.cgroup_bondings, true);
if (old_state != state)
diff --git a/src/snapshot.c b/src/snapshot.c
index 9825f90..270dc4f 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -66,7 +66,7 @@ static int snapshot_load(Unit *u) {
/* Make sure that only snapshots created via snapshot_create()
* can be loaded */
- if (!s->by_snapshot_create && s->meta.manager->n_deserializing <= 0)
+ if (!s->by_snapshot_create && s->meta.manager->n_reloading <= 0)
return -ENOENT;
u->meta.load_state = UNIT_LOADED;
diff --git a/src/unit.c b/src/unit.c
index a207262..d414209 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -370,7 +370,7 @@ void unit_free(Unit *u) {
u->meta.manager->n_in_gc_queue--;
}
- cgroup_bonding_free_list(u->meta.cgroup_bondings, u->meta.manager->n_serializing <= 0);
+ cgroup_bonding_free_list(u->meta.cgroup_bondings, u->meta.manager->n_reloading <= 0);
free(u->meta.description);
free(u->meta.fragment_path);
@@ -1137,7 +1137,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
* behaviour here. For example: if a mount point is remounted
* this function will be called too! */
- if (u->meta.manager->n_deserializing <= 0) {
+ if (u->meta.manager->n_reloading <= 0) {
dual_timestamp ts;
dual_timestamp_get(&ts);
@@ -1225,7 +1225,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
} else
unexpected = true;
- if (u->meta.manager->n_deserializing <= 0) {
+ if (u->meta.manager->n_reloading <= 0) {
/* If this state change happened without being
* requested by a job, then let's retroactively start
@@ -1258,7 +1258,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
if (u->meta.type == UNIT_SERVICE &&
!UNIT_IS_ACTIVE_OR_RELOADING(os) &&
- u->meta.manager->n_deserializing <= 0) {
+ u->meta.manager->n_reloading <= 0) {
/* Write audit record if we have just finished starting up */
manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_START, true);
u->meta.in_audit = true;
@@ -1275,7 +1275,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
if (u->meta.type == UNIT_SERVICE &&
UNIT_IS_INACTIVE_OR_FAILED(ns) &&
!UNIT_IS_INACTIVE_OR_FAILED(os) &&
- u->meta.manager->n_deserializing <= 0) {
+ u->meta.manager->n_reloading <= 0) {
/* Hmm, if there was no start record written
* write it now, so that we always have a nice
--
1.7.4.4

View File

@ -0,0 +1,24 @@
From c72dcc54315a5bb854849e17a34c6ad8a3f9dfaa Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 21 Sep 2011 02:57:02 +0200
Subject: [PATCH] modules-load: filter out double modules
---
src/modules-load.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/modules-load.c b/src/modules-load.c
index 4b3b121..17b5e0b 100644
--- a/src/modules-load.c
+++ b/src/modules-load.c
@@ -131,6 +131,7 @@ finish:
if (n_arguments > 3) {
arguments[n_arguments] = NULL;
+ strv_uniq(arguments);
execv("/sbin/modprobe", arguments);
log_error("Failed to execute /sbin/modprobe: %m");
--
1.7.4.4

View File

@ -0,0 +1,42 @@
From da375869ff31f83938123dc0d2a8d5c0f0845a0c Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Thu, 26 Jan 2012 01:19:19 +0100
Subject: [PATCH] mount: fix automount regression
Tom Gundersen noticed a regression where comment=systemd.automount in
fstab no longer prevented the adding of the After=foo.mount dependency
into local-fs.target. He bisected it to commit 9ddc4a26.
It turns out that clearing the default_dependencies flag is necessary
after all, in order to avoid complementing of Wants= with After= in the
target unit. We still want to add the dependencies on quota units and
umount.target though.
---
src/mount.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
Index: systemd-26/src/mount.c
===================================================================
--- systemd-26.orig/src/mount.c
+++ systemd-26/src/mount.c
@@ -590,6 +590,11 @@ static int mount_load(Unit *u) {
if (m->meta.fragment_path)
m->from_fragment = true;
+ else if (m->from_etc_fstab)
+ /* We always add several default dependencies to fstab mounts,
+ * but we do not want the implicit complementing of Wants= with After=
+ * in the target unit that this mount unit will be hooked into. */
+ m->meta.default_dependencies = false;
if (!m->where)
if (!(m->where = unit_name_to_path(u->meta.id)))
@@ -622,7 +627,7 @@ static int mount_load(Unit *u) {
if ((r = mount_add_fstab_links(m)) < 0)
return r;
- if (m->meta.default_dependencies)
+ if (m->meta.default_dependencies || m->from_etc_fstab)
if ((r = mount_add_default_dependencies(m)) < 0)
return r;

View File

@ -0,0 +1,26 @@
From 3a34ae3a4d211d9236ca77d9a162aa27ac11f5f9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 01:46:38 +0200
Subject: [PATCH] mount: fix parsing of prio value
https://bugzilla.redhat.com/show_bug.cgi?id=722803
---
src/mount.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mount.c b/src/mount.c
index bd1612f..829c2cc 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -1474,7 +1474,7 @@ static int mount_find_pri(char *options) {
char *end, *pri;
unsigned long r;
- if (!(pri = mount_test_option(options, "pri=")))
+ if (!(pri = mount_test_option(options, "pri")))
return 0;
pri += 4;
--
1.7.4.4

View File

@ -0,0 +1,79 @@
From 9ddc4a26e56b06cd7774a03597980351855d8d54 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 13 Jan 2012 23:55:28 +0100
Subject: [PATCH] mount: fix quota
quotacheck.service and quotaon.service were not pulled in for fstab mounts.
Fix it by not clearing the default_dependencies flag.
The root filesystem may have quotas too, so don't check for "/" there.
No need to have duplicate code for adding dependencies on umount.target.
https://bugzilla.redhat.com/show_bug.cgi?id=773431
---
src/mount.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/mount.c b/src/mount.c
index f72c50a..12c0710 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -357,10 +357,6 @@ static int mount_add_fstab_links(Mount *m) {
after = SPECIAL_LOCAL_FS_PRE_TARGET;
}
- if (!path_equal(m->where, "/"))
- if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
- return r;
-
if ((r = manager_load_unit(m->meta.manager, target, NULL, NULL, &tu)) < 0)
return r;
@@ -461,24 +457,23 @@ static int mount_add_device_links(Mount *m) {
static int mount_add_default_dependencies(Mount *m) {
int r;
+ MountParameters *p;
assert(m);
- if (m->meta.manager->running_as == MANAGER_SYSTEM &&
- !path_equal(m->where, "/")) {
- MountParameters *p;
-
- p = get_mount_parameters_configured(m);
+ if (m->meta.manager->running_as != MANAGER_SYSTEM)
+ return 0;
- if (p && needs_quota(p)) {
- if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
- (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
- return r;
- }
+ p = get_mount_parameters_configured(m);
+ if (p && needs_quota(p)) {
+ if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
+ (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
+ return r;
+ }
+ if (!path_equal(m->where, "/"))
if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
return r;
- }
return 0;
}
@@ -588,8 +583,6 @@ static int mount_load(Unit *u) {
if (m->meta.fragment_path)
m->from_fragment = true;
- else if (m->from_etc_fstab)
- m->meta.default_dependencies = false;
if (!m->where)
if (!(m->where = unit_name_to_path(u->meta.id)))
--
1.7.7.6

View File

@ -0,0 +1,50 @@
From 7fc2a89a7387db1e5daa4892393c9e9536920c25 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 1 Nov 2011 22:27:48 +0100
Subject: [PATCH] mount: order remote mounts after both network.target and
remote-fs-pre.target
Since remote-fs-pre.target is optional we cannot count on it to order
remote mounts after network.target, so let's add that order explicitly
in addition to remote-fs-pre.target.
https://bugzilla.redhat.com/show_bug.cgi?id=749940
---
src/mount.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/mount.c b/src/mount.c
index ef953f0..f9cfe91 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -327,7 +327,7 @@ static bool needs_quota(MountParameters *p) {
}
static int mount_add_fstab_links(Mount *m) {
- const char *target, *after = NULL;
+ const char *target, *after = NULL, *after2 = NULL;
MountParameters *p;
Unit *tu;
int r;
@@ -358,6 +358,7 @@ static int mount_add_fstab_links(Mount *m) {
if (mount_is_network(p)) {
target = SPECIAL_REMOTE_FS_TARGET;
after = SPECIAL_REMOTE_FS_PRE_TARGET;
+ after2 = SPECIAL_NETWORK_TARGET;
} else {
target = SPECIAL_LOCAL_FS_TARGET;
after = SPECIAL_LOCAL_FS_PRE_TARGET;
@@ -374,6 +375,10 @@ static int mount_add_fstab_links(Mount *m) {
if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0)
return r;
+ if (after2)
+ if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after2, NULL, true)) < 0)
+ return r;
+
if (automount) {
Unit *am;
--
1.7.7

View File

@ -0,0 +1,33 @@
From d3354f66c23aa29b3a15a4c5903fb2edcc8acfda Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 21 Sep 2011 20:19:43 +0200
Subject: [PATCH] mount: pull in quota tools from fstab lines with 'quota'
option, too
https://bugzilla.redhat.com/show_bug.cgi?id=736360
---
[ dropped TODO hunk -- michich ]
src/mount.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/mount.c b/src/mount.c
index 829c2cc..2fc799a 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -320,7 +320,10 @@ static bool needs_quota(MountParameters *p) {
return false;
return mount_test_option(p->options, "usrquota") ||
- mount_test_option(p->options, "grpquota");
+ mount_test_option(p->options, "grpquota") ||
+ mount_test_option(p->options, "quota") ||
+ mount_test_option(p->options, "usrjquota") ||
+ mount_test_option(p->options, "grpjquota");
}
static int mount_add_fstab_links(Mount *m) {
--
1.7.4.4

View File

@ -0,0 +1,135 @@
From 0e318cad06d483624076777c105bdcdd6aca3596 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 27 May 2011 01:29:34 +0200
Subject: [PATCH] pam-module: add debug= parameter
It is customary that pam modules do not log debugging information by default.
Usually they offer a 'debug' option.
Add a boolean debug= option to pam_systemd.so.
This will solve bug
https://bugzilla.redhat.com/show_bug.cgi?id=705427
Commit 53d5582fa006b0eb528f5dc3f4ba978abd8ac5a3 was not sufficient to fix it,
because in Fedora rsyslog is configured to write even LOG_DEBUG messages to
/var/log/secure by default.
---
man/pam_systemd.xml | 8 ++++++++
src/pam-module.c | 27 +++++++++++++++++++++------
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml
index 11852eb..208c7da 100644
--- a/man/pam_systemd.xml
+++ b/man/pam_systemd.xml
@@ -273,6 +273,14 @@
be reset for the processes of the
logged in user.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>debug=</option></term>
+
+ <listitem><para>Takes a boolean
+ argument. If true, logs debugging
+ information.</para></listitem>
+ </varlistentry>
</variablelist>
<para>Note that setting <varname>kill-user=1</varname>
diff --git a/src/pam-module.c b/src/pam-module.c
index 03864fe..bdf6133 100644
--- a/src/pam-module.c
+++ b/src/pam-module.c
@@ -46,7 +46,8 @@ static int parse_argv(pam_handle_t *handle,
char ***controllers,
char ***reset_controllers,
char ***kill_only_users,
- char ***kill_exclude_users) {
+ char ***kill_exclude_users,
+ bool *debug) {
unsigned i;
bool reset_controller_set = false;
@@ -145,6 +146,15 @@ static int parse_argv(pam_handle_t *handle,
kill_exclude_users_set = true;
+ } else if (startswith(argv[i], "debug=")) {
+ if ((k = parse_boolean(argv[i] + 6)) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
+ return k;
+ }
+
+ if (debug)
+ *debug = k;
+
} else {
pam_syslog(handle, LOG_ERR, "Unknown parameter '%s'.", argv[i]);
return -EINVAL;
@@ -406,6 +416,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
char *buf = NULL;
int lock_fd = -1;
bool create_session = true;
+ bool debug = false;
char **controllers = NULL, **reset_controllers = NULL, **c;
char *cgroup_user_tree = NULL;
@@ -421,7 +432,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
argc, argv,
&create_session, NULL, NULL,
&controllers, &reset_controllers,
- NULL, NULL) < 0)
+ NULL, NULL, &debug) < 0)
return PAM_SESSION_ERR;
if ((r = get_user_data(handle, &username, &pw)) != PAM_SUCCESS)
@@ -505,7 +516,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
goto finish;
}
- pam_syslog(handle, LOG_DEBUG, "Moving new user session for %s into control group %s.", username, buf);
+ if (debug)
+ pam_syslog(handle, LOG_DEBUG, "Moving new user session for %s into control group %s.", username, buf);
if ((r = create_user_group(handle, SYSTEMD_CGROUP_CONTROLLER, buf, pw, true, true)) != PAM_SUCCESS)
goto finish;
@@ -616,6 +628,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
const char *username = NULL;
bool kill_session = false;
bool kill_user = false;
+ bool debug = false;
int lock_fd = -1, r;
char *session_path = NULL, *nosession_path = NULL, *user_path = NULL;
const char *id;
@@ -634,7 +647,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
argc, argv,
NULL, &kill_session, &kill_user,
&controllers, NULL,
- &kill_only_users, &kill_exclude_users) < 0)
+ &kill_only_users, &kill_exclude_users, &debug) < 0)
return PAM_SESSION_ERR;
if ((r = get_user_data(handle, &username, &pw)) != PAM_SUCCESS)
@@ -676,13 +689,15 @@ _public_ PAM_EXTERN int pam_sm_close_session(
}
if (kill_session && check_user_lists(handle, pw->pw_uid, kill_only_users, kill_exclude_users)) {
- pam_syslog(handle, LOG_DEBUG, "Killing remaining processes of user session %s of %s.", id, username);
+ if (debug)
+ pam_syslog(handle, LOG_DEBUG, "Killing remaining processes of user session %s of %s.", id, username);
/* Kill processes in session cgroup, and delete it */
if ((r = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, session_path, true)) < 0)
pam_syslog(handle, LOG_ERR, "Failed to kill session cgroup: %s", strerror(-r));
} else {
- pam_syslog(handle, LOG_DEBUG, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path);
+ if (debug)
+ pam_syslog(handle, LOG_DEBUG, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path);
/* Migrate processes from session to user
* cgroup. First, try to create the user group
--
1.7.4.4

View File

@ -0,0 +1,30 @@
From 5ba7b871951ee120f1e9d5281debe00e2e42ba99 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 4 Jul 2011 19:06:32 +0200
Subject: [PATCH] password-agent: actually really don't access unallocated
memory
Fix for 9726f9ff11fa7b94dceed2972cd2453a08b9ee6a
---
src/tty-ask-password-agent.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c
index 38442f6..02b959e 100644
--- a/src/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent.c
@@ -384,9 +384,9 @@ static int parse_password(const char *filename, char **wall) {
packet[0] = '+';
strcpy(packet+1, password);
}
- }
- free(password);
+ free(password);
+ }
}
if (r == -ETIME || r == -ENOENT) {
--
1.7.4.4

View File

@ -0,0 +1,38 @@
From 9726f9ff11fa7b94dceed2972cd2453a08b9ee6a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 4 Jul 2011 18:59:54 +0200
Subject: [PATCH] password-agent: make sure not to access unallocated memory
Tracked down by Frederic Crozat
---
src/tty-ask-password-agent.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c
index b620aa6..38442f6 100644
--- a/src/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent.c
@@ -376,12 +376,14 @@ static int parse_password(const char *filename, char **wall) {
release_terminal();
}
- packet_length = 1+strlen(password)+1;
- if (!(packet = new(char, packet_length)))
- r = -ENOMEM;
- else {
- packet[0] = '+';
- strcpy(packet+1, password);
+ if (r >= 0) {
+ packet_length = 1+strlen(password)+1;
+ if (!(packet = new(char, packet_length)))
+ r = -ENOMEM;
+ else {
+ packet[0] = '+';
+ strcpy(packet+1, password);
+ }
}
free(password);
--
1.7.4.4

View File

@ -0,0 +1,33 @@
From 597b99b09a007dfa8ddfce31c480765b0c7baa6a Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 10 Jun 2011 14:37:21 +0200
Subject: [PATCH] readahead-common: fix total memory size detection
sysinfo returns the total memory size in multiples of mem_unit bytes.
As long as the size in bytes fits into unsigned long, the kernel uses
mem_unit = 1, but this is not true on i386 with more than 4 GB RAM.
https://bugzilla.redhat.com/show_bug.cgi?id=712341
---
src/readahead-common.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/readahead-common.c b/src/readahead-common.c
index 8a75b2e..f0d57b4 100644
--- a/src/readahead-common.c
+++ b/src/readahead-common.c
@@ -154,9 +154,8 @@ bool enough_ram(void) {
assert_se(sysinfo(&si) >= 0);
- return si.totalram > 127 * 1024*1024; /* Enable readahead only
- * with at least 128MB
- * memory */
+ /* Enable readahead only with at least 128MB memory */
+ return si.totalram > 127 * 1024*1024 / si.mem_unit;
}
int open_inotify(void) {
--
1.7.4.4

View File

@ -0,0 +1,26 @@
From 53273a6aefeb27f62c439e25f28c26859023c7df Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <bonzini@gnu.org>
Date: Tue, 11 Oct 2011 01:43:58 +0200
Subject: [PATCH] readahead: lower max file size for readahead
https://bugs.freedesktop.org/show_bug.cgi?id=41336
---
src/readahead-common.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/readahead-common.h b/src/readahead-common.h
index 167df31..9547ad2 100644
--- a/src/readahead-common.h
+++ b/src/readahead-common.h
@@ -27,7 +27,7 @@
#include "macro.h"
-#define READAHEAD_FILE_SIZE_MAX (128*1024*1024)
+#define READAHEAD_FILE_SIZE_MAX (10*1024*1024)
int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st);
--
1.7.4.4

View File

@ -0,0 +1,32 @@
From 1835f23c2a53e632959270e79dbf3143874e6111 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 11 Oct 2011 20:21:06 +0200
Subject: [PATCH] service: don't try to guess PID for SysV services anymore
As it turns out there are quite a number of SysV services too broken to
make the guessing work: instead of returning in the parent only after
the child is fully initialized they return immediately. The effect is
that the guessing in systemd might happen too early, at a time where the
final main process doesn't exist yet.
By turning this off we won't try to detect the main pid anymore, with
the effect that all processes of the service in question are considered
equally likely to be the main process.
---
[ fixed reject -- michich ]
src/service.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Index: systemd-26/src/service.c
===================================================================
--- systemd-26.orig/src/service.c
+++ systemd-26/src/service.c
@@ -827,6 +827,7 @@ static int service_load_sysv_path(Servic
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
s->remain_after_exit = true;
+ s->guess_main_pid = false;
s->restart = SERVICE_RESTART_NO;
if (s->meta.manager->sysv_console)

View File

@ -0,0 +1,35 @@
From 4e2b0f9b149e6fc1adb5ce49a6adaeed130577be Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 23 Sep 2011 17:42:21 +0200
Subject: [PATCH] service: fix up std output/error before we add dependencies
to the bridge socket
---
src/service.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/service.c b/src/service.c
index 2ae8785..c2053ce 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1145,6 +1145,8 @@ static int service_load(Unit *u) {
/* This is a new unit? Then let's add in some extras */
if (u->meta.load_state == UNIT_LOADED) {
+ service_fix_output(s);
+
if ((r = unit_add_exec_dependencies(u, &s->exec_context)) < 0)
return r;
@@ -1173,8 +1175,6 @@ static int service_load(Unit *u) {
if (s->meta.default_dependencies)
if ((r = service_add_default_dependencies(s)) < 0)
return r;
-
- service_fix_output(s);
}
return service_verify(s);
--
1.7.4.4

View File

@ -0,0 +1,59 @@
From db01f8b3f870611a013b913636bb7fefaab34018 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 20 Sep 2011 21:43:30 +0200
Subject: [PATCH] service: handle forking services that move to a new PID
When some forking daemons receive a SIGHUP, they re-execute themselves
and consequently change to a new main PID. As long as they update the
PID file in the right order (before exiting the old PID), we can detect
that and avoid killing them.
---
[ unfuzzed with quilt -- michich ]
src/service.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
Index: systemd-26/src/service.c
===================================================================
--- systemd-26.orig/src/service.c
+++ systemd-26/src/service.c
@@ -1264,9 +1264,6 @@ static int service_load_pid_file(Service
assert(s);
- if (s->main_pid_known)
- return 0;
-
if (!s->pid_file)
return 0;
@@ -1285,6 +1282,16 @@ static int service_load_pid_file(Service
return -ESRCH;
}
+ if (s->main_pid_known) {
+ if (pid == s->main_pid)
+ return 0;
+
+ log_debug("Main PID changing: %lu -> %lu",
+ (unsigned long) s->main_pid, (unsigned long) pid);
+ service_unwatch_main_pid(s);
+ s->main_pid_known = false;
+ }
+
if ((r = service_set_main_pid(s, pid)) < 0)
return r;
@@ -2569,6 +2576,11 @@ static void service_sigchld_event(Unit *
success = is_clean_exit(code, status);
if (s->main_pid == pid) {
+ /* Forking services may occasionally move to a new PID.
+ * As long as they update the PID file before exiting the old
+ * PID, they're fine. */
+ if (s->pid_file && service_load_pid_file(s) == 0)
+ return;
s->main_pid = 0;
exec_status_exit(&s->main_exec_status, pid, code, status, s->exec_context.utmp_id);

View File

@ -0,0 +1,74 @@
From 4dfc092a7176f74102b6be205f11008e1de59bb3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 22 Sep 2011 03:29:51 +0200
Subject: [PATCH] service: if StandardInput=socket and StandardOutput=inherit
imply socket for output, don't imply default output
This is useful for inetd-style per-connection services, so that they
again can simply specify StandardOutput=socket to connect all three fds
to the socket.
---
[ unfuzzed with quilt -- michich ]
Index: systemd-26/src/service.c
===================================================================
--- systemd-26.orig/src/service.c
+++ systemd-26/src/service.c
@@ -121,8 +121,6 @@ static void service_init(Unit *u) {
s->guess_main_pid = true;
exec_context_init(&s->exec_context);
- s->exec_context.std_output = u->meta.manager->default_std_output;
- s->exec_context.std_error = u->meta.manager->default_std_error;
RATELIMIT_INIT(s->ratelimit, 10*USEC_PER_SEC, 5);
@@ -830,9 +828,10 @@ static int service_load_sysv_path(Servic
s->type = SERVICE_FORKING;
s->remain_after_exit = true;
s->restart = SERVICE_RESTART_NO;
- s->exec_context.std_output =
- (s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY)
- ? EXEC_OUTPUT_TTY : s->meta.manager->default_std_output;
+
+ if (s->meta.manager->sysv_console)
+ s->exec_context.std_output = EXEC_OUTPUT_TTY;
+
s->exec_context.kill_mode = KILL_PROCESS;
/* We use the long description only if
@@ -1095,6 +1094,24 @@ static int service_add_default_dependenc
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
}
+static void service_fix_output(Service *s) {
+ assert(s);
+
+ /* If nothing has been explicitly configured, patch default
+ * output in. If input is socket/tty we avoid this however,
+ * since in that case we want output to default to the same
+ * place as we read input from. */
+
+ if (s->exec_context.std_error == EXEC_OUTPUT_INHERIT &&
+ s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
+ s->exec_context.std_input == EXEC_INPUT_NULL)
+ s->exec_context.std_error = s->meta.manager->default_std_error;
+
+ if (s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
+ s->exec_context.std_input == EXEC_INPUT_NULL)
+ s->exec_context.std_output = s->meta.manager->default_std_output;
+}
+
static int service_load(Unit *u) {
int r;
Service *s = SERVICE(u);
@@ -1151,6 +1168,8 @@ static int service_load(Unit *u) {
if (s->meta.default_dependencies)
if ((r = service_add_default_dependencies(s)) < 0)
return r;
+
+ service_fix_output(s);
}
return service_verify(s);

View File

@ -0,0 +1,39 @@
From 13230d5d3c89e866f1b9b689d41f0edc90af707a Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 21 Sep 2011 02:25:17 +0200
Subject: [PATCH] service: minor change in service_load_pid_file return value
Return 0 only if the PID was really loaded. If no PIDFile= is defined,
return -ENOENT.
Only one caller cares about the return value of this function and this
change makes the usage nicer.
---
src/service.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/service.c b/src/service.c
index 8f827aa..5050bca 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1270,7 +1270,7 @@ static int service_load_pid_file(Service *s) {
assert(s);
if (!s->pid_file)
- return 0;
+ return -ENOENT;
if ((r = read_one_line_file(s->pid_file, &k)) < 0)
return r;
@@ -2585,7 +2585,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
/* Forking services may occasionally move to a new PID.
* As long as they update the PID file before exiting the old
* PID, they're fine. */
- if (s->pid_file && service_load_pid_file(s) == 0)
+ if (service_load_pid_file(s) == 0)
return;
s->main_pid = 0;
--
1.7.4.4

View File

@ -0,0 +1,29 @@
From f8788303929c27d0b7f7e4b8ffe22767a3d0ff67 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 5 Jul 2011 10:14:12 +0200
Subject: [PATCH] service: 'pidfile:' in SysV chkconfig header implies a real
daemon
The presence of the chkconfig "pidfile:" header in the initscript is an
excellent indication that it's not a oneshot script (like iptables),
but a real daemon (like httpd).
---
src/service.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/service.c b/src/service.c
index 165655e..5c7e62f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -843,7 +843,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
- s->remain_after_exit = true;
+ s->remain_after_exit = !s->pid_file;
s->restart = SERVICE_RESTART_NO;
s->exec_context.std_output =
(s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY)
--
1.7.4.4

View File

@ -0,0 +1,35 @@
From 1a63987788624a8819b94b199aa6748665f5e957 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sat, 2 Jul 2011 20:41:36 +0200
Subject: [PATCH] shutdown: accept minutes argument without '+'
Both SysVinit's and upstart's shutdown commands accept the number of
minutes with or without the plus sign.
'shutdown -h 1' works in RHEL 5, Fedora 14, Debian 6.
Let's be compatible.
https://bugzilla.redhat.com/show_bug.cgi?id=708886
---
src/systemctl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/systemctl.c b/src/systemctl.c
index f6dca5b..b584e70 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4815,10 +4815,10 @@ static int parse_time_spec(const char *t, usec_t *_u) {
if (streq(t, "now"))
*_u = 0;
- else if (t[0] == '+') {
+ else if (!strchr(t, ':')) {
uint64_t u;
- if (safe_atou64(t + 1, &u) < 0)
+ if (safe_atou64(t, &u) < 0)
return -EINVAL;
*_u = now(CLOCK_REALTIME) + USEC_PER_MINUTE * u;
--
1.7.4.4

View File

@ -0,0 +1,164 @@
From 7e4ab3c5a6295193d0c58d353b6430265d842f34 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 10 Jan 2012 04:20:55 +0100
Subject: [PATCH] shutdown: exclude processes with argv[0][0] from killing
---
[ removed an unrelated hunk, fixed reject -- michich ]
Index: systemd-26/src/shutdown.c
===================================================================
--- systemd-26.orig/src/shutdown.c
+++ systemd-26/src/shutdown.c
@@ -40,29 +40,45 @@
#define FINALIZE_ATTEMPTS 50
static bool ignore_proc(pid_t pid) {
- if (pid == 1)
- return true;
-
- /* TODO: add more ignore rules here: device-mapper, etc */
-
- return false;
-}
-
-static bool is_kernel_thread(pid_t pid)
-{
char buf[PATH_MAX];
FILE *f;
char c;
size_t count;
+ uid_t uid;
+ int r;
+
+ /* We are PID 1, let's not commit suicide */
+ if (pid == 1)
+ return true;
+
+ r = get_process_uid(pid, &uid);
+ if (r < 0)
+ return true; /* not really, but better safe than sorry */
+
+ /* Non-root processes otherwise are always subject to be killed */
+ if (uid != 0)
+ return false;
+
+ snprintf(buf, sizeof(buf), "/proc/%lu/cmdline", (unsigned long) pid);
+ char_array_0(buf);
- snprintf(buf, sizeof(buf), "/proc/%lu/cmdline", (unsigned long)pid);
f = fopen(buf, "re");
if (!f)
return true; /* not really, but has the desired effect */
count = fread(&c, 1, 1, f);
fclose(f);
- return count != 1;
+
+ /* Kernel threads have an empty cmdline */
+ if (count <= 0)
+ return true;
+
+ /* Processes with argv[0][0] = '@' we ignore from the killing
+ * spree. */
+ if (count == 1 && c == '@')
+ return true;
+
+ return false;
}
static int killall(int sign) {
@@ -70,7 +86,8 @@ static int killall(int sign) {
struct dirent *d;
unsigned int n_processes = 0;
- if ((dir = opendir("/proc")) == NULL)
+ dir = opendir("/proc");
+ if (!dir)
return -errno;
while ((d = readdir(dir))) {
@@ -79,9 +96,6 @@ static int killall(int sign) {
if (parse_pid(d->d_name, &pid) < 0)
continue;
- if (is_kernel_thread(pid))
- continue;
-
if (ignore_proc(pid))
continue;
Index: systemd-26/src/util.c
===================================================================
--- systemd-26.orig/src/util.c
+++ systemd-26/src/util.c
@@ -961,6 +961,57 @@ int get_process_cmdline(pid_t pid, size_
return 0;
}
+int get_process_uid(pid_t pid, uid_t *uid) {
+ char *p;
+ FILE *f;
+ int r;
+
+ assert(uid);
+
+ if (pid == 0)
+ return getuid();
+
+ if (asprintf(&p, "/proc/%lu/status", (unsigned long) pid) < 0)
+ return -ENOMEM;
+
+ f = fopen(p, "re");
+ free(p);
+
+ if (!f)
+ return -errno;
+
+ while (!feof(f)) {
+ char line[LINE_MAX], *l;
+
+ if (!fgets(line, sizeof(line), f)) {
+ if (feof(f))
+ break;
+
+ r = -errno;
+ goto finish;
+ }
+
+ l = strstrip(line);
+
+ if (startswith(l, "Uid:")) {
+ l += 4;
+ l += strspn(l, WHITESPACE);
+
+ l[strcspn(l, WHITESPACE)] = 0;
+
+ r = parse_uid(l, uid);
+ goto finish;
+ }
+ }
+
+ r = -EIO;
+
+finish:
+ fclose(f);
+
+ return r;
+}
+
char *strnappend(const char *s, const char *suffix, size_t b) {
size_t a;
char *r;
Index: systemd-26/src/util.h
===================================================================
--- systemd-26.orig/src/util.h
+++ systemd-26/src/util.h
@@ -243,6 +243,7 @@ int rmdir_parents(const char *path, cons
int get_process_name(pid_t pid, char **name);
int get_process_cmdline(pid_t pid, size_t max_length, char **line);
+int get_process_uid(pid_t pid, uid_t *uid);
char hexchar(int x);
int unhexchar(char c);

View File

@ -0,0 +1,74 @@
From 30923233b34e23ed1b3ffa7317f6219f695fec2f Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sat, 2 Jul 2011 23:40:42 +0200
Subject: [PATCH] shutdown: print the standard wall message even when the user
provided one
Print the user-provided wall message in addition to the standard one, not
instead of it.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=624149
---
src/shutdownd.c | 38 +++++++++++++++++---------------------
1 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/shutdownd.c b/src/shutdownd.c
index 7fd9573..49ab886 100644
--- a/src/shutdownd.c
+++ b/src/shutdownd.c
@@ -100,6 +100,9 @@ static int read_packet(int fd, struct shutdownd_command *_c) {
}
static void warn_wall(usec_t n, struct shutdownd_command *c) {
+ char date[FORMAT_TIMESTAMP_MAX];
+ const char *prefix;
+ char *l = NULL;
assert(c);
assert(c->warn_wall);
@@ -107,28 +110,21 @@ static void warn_wall(usec_t n, struct shutdownd_command *c) {
if (n >= c->elapse)
return;
- if (c->wall_message[0])
- utmp_wall(c->wall_message, NULL);
+ if (c->mode == 'H')
+ prefix = "The system is going down for system halt at ";
+ else if (c->mode == 'P')
+ prefix = "The system is going down for power-off at ";
+ else if (c->mode == 'r')
+ prefix = "The system is going down for reboot at ";
+ else
+ assert_not_reached("Unknown mode!");
+
+ if (asprintf(&l, "%s%s%s%s!", c->wall_message, c->wall_message[0] ? "\n" : "",
+ prefix, format_timestamp(date, sizeof(date), c->elapse)) < 0)
+ log_error("Failed to allocate wall message");
else {
- char date[FORMAT_TIMESTAMP_MAX];
- const char* prefix;
- char *l = NULL;
-
- if (c->mode == 'H')
- prefix = "The system is going down for system halt at ";
- else if (c->mode == 'P')
- prefix = "The system is going down for power-off at ";
- else if (c->mode == 'r')
- prefix = "The system is going down for reboot at ";
- else
- assert_not_reached("Unknown mode!");
-
- if (asprintf(&l, "%s%s!", prefix, format_timestamp(date, sizeof(date), c->elapse)) < 0)
- log_error("Failed to allocate wall message");
- else {
- utmp_wall(l, NULL);
- free(l);
- }
+ utmp_wall(l, NULL);
+ free(l);
}
}
--
1.7.4.4

View File

@ -0,0 +1,80 @@
From 52c002150a34c07a59369ee952bcd3a1f8f316ca Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sat, 2 Jul 2011 23:09:59 +0200
Subject: [PATCH] shutdown: respect the dry run option '-k'
Don't do the actual power-off/reboot when '-k' is passed to shutdown.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=624149
---
src/shutdownd.c | 2 +-
src/shutdownd.h | 1 +
src/systemctl.c | 6 ++++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/shutdownd.c b/src/shutdownd.c
index 1381941..7fd9573 100644
--- a/src/shutdownd.c
+++ b/src/shutdownd.c
@@ -348,7 +348,7 @@ finish:
if (unlink_nologin)
unlink("/run/nologin");
- if (exec_shutdown) {
+ if (exec_shutdown && !c.dry_run) {
char sw[3];
sw[0] = '-';
diff --git a/src/shutdownd.h b/src/shutdownd.h
index ed8a704..4581649 100644
--- a/src/shutdownd.h
+++ b/src/shutdownd.h
@@ -33,6 +33,7 @@ _packed_ struct shutdownd_command {
char mode; /* H, P, r, i.e. the switches usually passed to
* shutdown to select whether to halt, power-off or
* reboot the machine */
+ bool dry_run;
bool warn_wall;
/* Yepp, sometimes we are lazy and use fixed-size strings like
diff --git a/src/systemctl.c b/src/systemctl.c
index b584e70..8f904c1 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -5422,7 +5422,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
return verbs[i].dispatch(bus, argv + optind, left);
}
-static int send_shutdownd(usec_t t, char mode, bool warn, const char *message) {
+static int send_shutdownd(usec_t t, char mode, bool dry_run, bool warn, const char *message) {
int fd = -1;
struct msghdr msghdr;
struct iovec iovec;
@@ -5432,6 +5432,7 @@ static int send_shutdownd(usec_t t, char mode, bool warn, const char *message) {
zero(c);
c.elapse = t;
c.mode = mode;
+ c.dry_run = dry_run;
c.warn_wall = warn;
if (message)
@@ -5527,6 +5528,7 @@ static int halt_main(DBusConnection *bus) {
arg_action == ACTION_HALT ? 'H' :
arg_action == ACTION_POWEROFF ? 'P' :
'r',
+ arg_dry,
!arg_no_wall,
m);
free(m);
@@ -5774,7 +5776,7 @@ int main(int argc, char*argv[]) {
break;
case ACTION_CANCEL_SHUTDOWN:
- r = send_shutdownd(0, 0, false, NULL);
+ r = send_shutdownd(0, 0, false, false, NULL);
break;
case ACTION_INVALID:
--
1.7.4.4

View File

@ -0,0 +1,90 @@
From d68af58657ce0e99594dff199fbb9b319cf6af96 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 29 Nov 2011 22:15:41 +0100
Subject: [PATCH 1/4] socket: add option for SO_PASSCRED
Add an option to enable SO_PASSCRED for unix sockets.
---
src/dbus-socket.c | 2 ++
src/load-fragment-gperf.gperf.m4 | 1 +
src/socket.c | 8 ++++++++
src/socket.h | 1 +
4 files changed, 12 insertions(+), 0 deletions(-)
Index: systemd-26/src/dbus-socket.c
===================================================================
--- systemd-26.orig/src/dbus-socket.c
+++ systemd-26/src/dbus-socket.c
@@ -49,6 +49,7 @@
" <property name=\"IPTTL\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"PipeSize\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"FreeBind\" type=\"b\" access=\"read\"/>\n" \
+ " <property name=\"PassCred\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"Mark\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"MaxConnections\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"NAccepted\" type=\"u\" access=\"read\"/>\n" \
@@ -107,6 +108,7 @@ DBusHandlerResult bus_socket_message_han
{ "org.freedesktop.systemd1.Socket", "IPTTL", bus_property_append_int, "i", &u->socket.ip_ttl },
{ "org.freedesktop.systemd1.Socket", "PipeSize", bus_property_append_size, "t", &u->socket.pipe_size },
{ "org.freedesktop.systemd1.Socket", "FreeBind", bus_property_append_bool, "b", &u->socket.free_bind },
+ { "org.freedesktop.systemd1.Socket", "PassCred", bus_property_append_bool, "b", &u->socket.pass_cred },
{ "org.freedesktop.systemd1.Socket", "Mark", bus_property_append_int, "i", &u->socket.mark },
{ "org.freedesktop.systemd1.Socket", "MaxConnections", bus_property_append_unsigned, "u", &u->socket.max_connections },
{ "org.freedesktop.systemd1.Socket", "NConnections", bus_property_append_unsigned, "u", &u->socket.n_connections },
Index: systemd-26/src/socket.c
===================================================================
--- systemd-26.orig/src/socket.c
+++ systemd-26/src/socket.c
@@ -404,6 +404,7 @@ static void socket_dump(Unit *u, FILE *f
"%sDirectoryMode: %04o\n"
"%sKeepAlive: %s\n"
"%sFreeBind: %s\n"
+ "%sPassCred: %s\n"
"%sTCPCongestion: %s\n",
prefix, socket_state_to_string(s->state),
prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
@@ -412,6 +413,7 @@ static void socket_dump(Unit *u, FILE *f
prefix, s->directory_mode,
prefix, yes_no(s->keep_alive),
prefix, yes_no(s->free_bind),
+ prefix, yes_no(s->pass_cred),
prefix, strna(s->tcp_congestion));
if (s->control_pid > 0)
@@ -635,6 +637,12 @@ static void socket_apply_socket_options(
log_warning("SO_KEEPALIVE failed: %m");
}
+ if (s->pass_cred) {
+ int one = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
+ log_warning("SO_PASSCRED failed: %m");
+ }
+
if (s->priority >= 0)
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &s->priority, sizeof(s->priority)) < 0)
log_warning("SO_PRIORITY failed: %m");
Index: systemd-26/src/socket.h
===================================================================
--- systemd-26.orig/src/socket.h
+++ systemd-26/src/socket.h
@@ -115,6 +115,7 @@ struct Socket {
/* Socket options */
bool keep_alive;
bool free_bind;
+ bool pass_cred;
int priority;
int mark;
size_t receive_buffer;
Index: systemd-26/src/load-fragment.c
===================================================================
--- systemd-26.orig/src/load-fragment.c
+++ systemd-26/src/load-fragment.c
@@ -1945,6 +1945,7 @@ static int load_from_path(Unit *u, const
{ "Mark", config_parse_int, 0, &u->socket.mark, "Socket" },
{ "PipeSize", config_parse_size, 0, &u->socket.pipe_size, "Socket" },
{ "FreeBind", config_parse_bool, 0, &u->socket.free_bind, "Socket" },
+ { "PassCred", config_parse_bool, 0, &u->socket.pass_cred, "Socket" },
{ "TCPCongestion", config_parse_string, 0, &u->socket.tcp_congestion, "Socket" },
{ "Service", config_parse_socket_service, 0, &u->socket, "Socket" },
EXEC_CONTEXT_CONFIG_ITEMS(u->socket.exec_context, "Socket"),

View File

@ -0,0 +1,105 @@
From 271b032a053f9d4a1be271bb052276ae27fe36c6 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 31 Dec 2011 01:07:49 +0100
Subject: [PATCH] socket: rename the PassCred= option to PassCredentials=,
since we don't want to needlessly abbreviate options unless
they are very well established
---
man/systemd.socket.xml | 8 ++++----
src/dbus-socket.c | 4 ++--
src/load-fragment-gperf.gperf.m4 | 2 +-
src/socket.c | 2 +-
units/syslog.socket | 2 +-
units/systemd-journald.socket | 1 +
units/systemd-shutdownd.socket | 2 +-
7 files changed, 11 insertions(+), 10 deletions(-)
Index: systemd-26/man/systemd.socket.xml
===================================================================
--- systemd-26.orig/man/systemd.socket.xml
+++ systemd-26/man/systemd.socket.xml
@@ -480,10 +480,10 @@
</varlistentry>
<varlistentry>
- <term><varname>PassCred=</varname></term>
+ <term><varname>PassCredentials=</varname></term>
<listitem><para>Takes a boolean
value. This controls the SO_PASSCRED
- option, which allows UNIX sockets to
+ socket option, which allows UNIX sockets to
receive the credentials of the sending
process in an ancillary message.
Defaults to
Index: systemd-26/src/dbus-socket.c
===================================================================
--- systemd-26.orig/src/dbus-socket.c
+++ systemd-26/src/dbus-socket.c
@@ -49,7 +49,7 @@
" <property name=\"IPTTL\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"PipeSize\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"FreeBind\" type=\"b\" access=\"read\"/>\n" \
- " <property name=\"PassCred\" type=\"b\" access=\"read\"/>\n" \
+ " <property name=\"PassCredentials\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"Mark\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"MaxConnections\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"NAccepted\" type=\"u\" access=\"read\"/>\n" \
@@ -108,7 +108,7 @@ DBusHandlerResult bus_socket_message_han
{ "org.freedesktop.systemd1.Socket", "IPTTL", bus_property_append_int, "i", &u->socket.ip_ttl },
{ "org.freedesktop.systemd1.Socket", "PipeSize", bus_property_append_size, "t", &u->socket.pipe_size },
{ "org.freedesktop.systemd1.Socket", "FreeBind", bus_property_append_bool, "b", &u->socket.free_bind },
- { "org.freedesktop.systemd1.Socket", "PassCred", bus_property_append_bool, "b", &u->socket.pass_cred },
+ { "org.freedesktop.systemd1.Socket", "PassCredentials",bus_property_append_bool, "b", &u->socket.pass_cred },
{ "org.freedesktop.systemd1.Socket", "Mark", bus_property_append_int, "i", &u->socket.mark },
{ "org.freedesktop.systemd1.Socket", "MaxConnections", bus_property_append_unsigned, "u", &u->socket.max_connections },
{ "org.freedesktop.systemd1.Socket", "NConnections", bus_property_append_unsigned, "u", &u->socket.n_connections },
Index: systemd-26/src/socket.c
===================================================================
--- systemd-26.orig/src/socket.c
+++ systemd-26/src/socket.c
@@ -404,7 +404,7 @@ static void socket_dump(Unit *u, FILE *f
"%sDirectoryMode: %04o\n"
"%sKeepAlive: %s\n"
"%sFreeBind: %s\n"
- "%sPassCred: %s\n"
+ "%sPassCredentials: %s\n"
"%sTCPCongestion: %s\n",
prefix, socket_state_to_string(s->state),
prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
Index: systemd-26/units/syslog.socket
===================================================================
--- systemd-26.orig/units/syslog.socket
+++ systemd-26/units/syslog.socket
@@ -18,7 +18,7 @@ Wants=syslog.target
[Socket]
ListenDatagram=/dev/log
SocketMode=0666
-PassCred=yes
+PassCredentials=yes
# The service we activate on incoming traffic is
# systemd-kmsg-syslogd.service. That doesn't mean however, that this
Index: systemd-26/units/systemd-shutdownd.socket
===================================================================
--- systemd-26.orig/units/systemd-shutdownd.socket
+++ systemd-26/units/systemd-shutdownd.socket
@@ -15,4 +15,4 @@ Before=sockets.target
[Socket]
ListenDatagram=/run/systemd/shutdownd
SocketMode=0600
-PassCred=yes
+PassCredentials=yes
Index: systemd-26/src/load-fragment.c
===================================================================
--- systemd-26.orig/src/load-fragment.c
+++ systemd-26/src/load-fragment.c
@@ -1945,7 +1945,7 @@ static int load_from_path(Unit *u, const
{ "Mark", config_parse_int, 0, &u->socket.mark, "Socket" },
{ "PipeSize", config_parse_size, 0, &u->socket.pipe_size, "Socket" },
{ "FreeBind", config_parse_bool, 0, &u->socket.free_bind, "Socket" },
- { "PassCred", config_parse_bool, 0, &u->socket.pass_cred, "Socket" },
+ { "PassCredentials", config_parse_bool, 0, &u->socket.pass_cred, "Socket" },
{ "TCPCongestion", config_parse_string, 0, &u->socket.tcp_congestion, "Socket" },
{ "Service", config_parse_socket_service, 0, &u->socket, "Socket" },
EXEC_CONTEXT_CONFIG_ITEMS(u->socket.exec_context, "Socket"),

View File

@ -0,0 +1,24 @@
From 149e180ac35564b6c8bf7757301634b31e3d0054 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 30 Aug 2011 16:49:17 +0200
Subject: [PATCH] specifier: drop misplaced assert()
---
src/specifier.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/specifier.c b/src/specifier.c
index 497d395..a9fff88 100644
--- a/src/specifier.c
+++ b/src/specifier.c
@@ -104,7 +104,5 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata
/* Generic handler for simple string replacements */
char* specifier_string(char specifier, void *data, void *userdata) {
- assert(data);
-
return strdup(strempty(data));
}
--
1.7.4.4

View File

@ -0,0 +1,29 @@
From 43de46ab92e3b343c2e35b42cf0728a9adf48f1c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 1 Sep 2011 21:15:00 +0200
Subject: [PATCH] stdout-bridge: set facility of messages with no facility to
configured facility instead of LOG_USER
---
[ fixed the filename -- michich ]
diff --git a/src/stdout-syslog-bridge.c b/src/stdout-syslog-bridge.c
index 48a301f..7358a42 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -111,9 +111,9 @@ static int stream_log(Stream *s, char *p, usec_t ts) {
if (*p == 0)
return 0;
- /* Patch in LOG_USER facility if necessary */
+ /* Patch in configured facility if necessary */
if ((priority & LOG_FACMASK) == 0)
- priority = LOG_USER | LOG_PRI(priority);
+ priority = (s->priority & LOG_FACMASK) | priority;
/*
* The format glibc uses to talk to the syslog daemon is:
--
1.7.4.4

View File

@ -0,0 +1,69 @@
From a94e09a5b935a3fb64a4e2c9f22220899ff40294 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 20 Sep 2011 02:46:04 +0200
Subject: [PATCH] stdout-syslog-bridge: properly handle overly long log lines
---
[ fixed the file name -- michich ]
diff --git a/src/stdout-syslog-bridge.c b/src/stdout-syslog-bridge.c
index 7358a42..9a04088 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -88,7 +88,7 @@ struct Stream {
bool prefix:1;
bool tee_console:1;
- char buffer[LINE_MAX];
+ char buffer[LINE_MAX+1];
size_t length;
LIST_FIELDS(Stream, stream);
@@ -321,16 +321,25 @@ static int stream_scan(Stream *s, usec_t ts) {
p = s->buffer;
remaining = s->length;
for (;;) {
- char *newline;
-
- if (!(newline = memchr(p, '\n', remaining)))
- break;
+ char *end;
+ size_t skip;
+
+ end = memchr(p, '\n', remaining);
+ if (!end) {
+ if (remaining >= LINE_MAX) {
+ end = p + LINE_MAX;
+ skip = LINE_MAX;
+ } else
+ break;
+ } else
+ skip = end - p + 1;
- *newline = 0;
+ *end = 0;
- if ((r = stream_line(s, p, ts)) >= 0) {
- remaining -= newline-p+1;
- p = newline+1;
+ r = stream_line(s, p, ts);
+ if (r >= 0) {
+ remaining -= skip;
+ p += skip;
}
}
@@ -347,7 +356,8 @@ static int stream_process(Stream *s, usec_t ts) {
int r;
assert(s);
- if ((l = read(s->fd, s->buffer+s->length, LINE_MAX-s->length)) < 0) {
+ l = read(s->fd, s->buffer+s->length, LINE_MAX-s->length);
+ if (l < 0) {
if (errno == EAGAIN)
return 0;
--
1.7.4.4

View File

@ -0,0 +1,68 @@
From 700de55514bc3137bb90aa87326f2ed80e675dda Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 24 Aug 2011 01:10:13 +0200
Subject: [PATCH] strv: fix counting in strv_env_delete()
---
src/strv.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/strv.c b/src/strv.c
index a52440d..92851b2 100644
--- a/src/strv.c
+++ b/src/strv.c
@@ -482,8 +482,8 @@ static bool env_match(const char *t, const char *pattern) {
}
char **strv_env_delete(char **x, unsigned n_lists, ...) {
- size_t n = 0, i = 0;
- char **l, **k, **r, **j;
+ size_t n, i = 0;
+ char **k, **r;
va_list ap;
/* Deletes every entry from x that is mentioned in the other
@@ -491,29 +491,34 @@ char **strv_env_delete(char **x, unsigned n_lists, ...) {
n = strv_length(x);
- if (!(r = new(char*, n+1)))
+ r = new(char*, n+1);
+ if (!r)
return NULL;
STRV_FOREACH(k, x) {
+ unsigned v;
+
va_start(ap, n_lists);
+ for (v = 0; v < n_lists; v++) {
+ char **l, **j;
- for (i = 0; i < n_lists; i++) {
l = va_arg(ap, char**);
STRV_FOREACH(j, l)
if (env_match(*k, *j))
- goto delete;
+ goto skip;
}
-
va_end(ap);
- if (!(r[i++] = strdup(*k))) {
+ r[i] = strdup(*k);
+ if (!r[i]) {
strv_free(r);
return NULL;
}
+ i++;
continue;
- delete:
+ skip:
va_end(ap);
}
--
1.7.4.4

View File

@ -0,0 +1,27 @@
From 3f8587327556c97ae4fc4c8b3ea0df122f769d4b Mon Sep 17 00:00:00 2001
From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Fri, 24 Jun 2011 13:43:19 +0200
Subject: [PATCH] swap: ignore missing /proc/swaps
Otherwise systemd reports "Failed to fully start up daemon: No such file or
directory" when swap is disabled in the kernel.
---
src/swap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/swap.c b/src/swap.c
index 14719ad..7675e6a 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -1237,7 +1237,7 @@ static int swap_enumerate(Manager *m) {
if (!m->proc_swaps) {
if (!(m->proc_swaps = fopen("/proc/swaps", "re")))
- return -errno;
+ return (errno == ENOENT) ? 0 : -errno;
m->swap_watch.type = WATCH_SWAP;
m->swap_watch.fd = fileno(m->proc_swaps);
--
1.7.4.4

View File

@ -0,0 +1,29 @@
From b8590c197deceab623d37dbb95e30eec9cf47d14 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 3 Jul 2011 01:47:21 +0200
Subject: [PATCH] systemadm: report GLib.Error only to stderr
When a GLib.Error happens, it is likely that showing a message box would fail
too.
https://bugzilla.redhat.com/show_bug.cgi?id=716663
---
src/systemadm.vala | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/systemadm.vala b/src/systemadm.vala
index c262794..d45ec64 100644
--- a/src/systemadm.vala
+++ b/src/systemadm.vala
@@ -1011,7 +1011,7 @@ int main(string[] args) {
} catch (IOError e) {
show_error(e.message);
} catch (GLib.Error e) {
- show_error(e.message);
+ stderr.printf("%s\n", e.message);
}
return 0;
--
1.7.4.4

View File

@ -0,0 +1,54 @@
From abebb5af9a7f5da77425aab1ecadd9bfcad53009 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sat, 18 Jun 2011 16:23:43 +0300
Subject: [PATCH] systemctl: Add SYSTEMD_PAGER for setting the pager to use in
systemctl
---
man/systemctl.xml | 16 ++++++++++++++++
src/systemctl.c | 2 +-
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/man/systemctl.xml b/man/systemctl.xml
index a9e86ce..2fd2b7b 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -1022,6 +1022,22 @@
</refsect1>
<refsect1>
+ <title>Environment</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><varname>$SYSTEMD_PAGER</varname></term>
+ <listitem><para>Pager to use when
+ <option>--no-pager</option> is not given;
+ overrides <varname>$PAGER</varname>. Setting
+ this to an empty string or the value
+ <literal>cat</literal> is equivalent to passing
+ <option>--no-pager</option>.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/src/systemctl.c b/src/systemctl.c
index 08c7fab..ab41566 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -5572,7 +5572,7 @@ static void pager_open(void) {
if (!on_tty() || arg_no_pager)
return;
- if ((pager = getenv("PAGER")))
+ if ((pager = getenv("SYSTEMD_PAGER")) || (pager = getenv("PAGER")))
if (!*pager || streq(pager, "cat"))
return;
--
1.7.4.4

View File

@ -0,0 +1,24 @@
From 78e39b43b89c6bf9ce401d6030939a004a23c850 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 5 Jun 2011 17:22:37 +0200
Subject: [PATCH] systemctl: fix double unref of a dbus message
---
src/systemctl.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/systemctl.c b/src/systemctl.c
index 99ada38..a82cce4 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1565,6 +1565,7 @@ static int check_unit(DBusConnection *bus, char **args, unsigned n) {
dbus_error_free(&error);
dbus_message_unref(m);
+ m = NULL;
continue;
}
--
1.7.4.4

View File

@ -0,0 +1,50 @@
From b77398f7a05aa313cebcea81e9381833bede2d61 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Mon, 13 Jun 2011 14:19:47 +0200
Subject: [PATCH] systemctl: fix 'is-enabled' for native units under /lib
The units always showed up as enabled.
The config file has to be parsed before we can check what's in
the [Install] section.
https://bugzilla.redhat.com/show_bug.cgi?id=699027
---
src/systemctl.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/systemctl.c b/src/systemctl.c
index faca797..889e3ee 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4160,6 +4160,13 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
return -ENOENT;
}
+ i->path = filename;
+
+ if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) {
+ fclose(f);
+ return r;
+ }
+
/* Consider unit files stored in /lib and /usr always enabled
* if they have no [Install] data. */
if (streq(verb, "is-enabled") &&
@@ -4168,13 +4175,6 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
!path_startswith(filename, "/etc"))
return 1;
- i->path = filename;
-
- if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) {
- fclose(f);
- return r;
- }
-
n_symlinks += strv_length(i->aliases);
n_symlinks += strv_length(i->wanted_by);
--
1.7.4.4

View File

@ -0,0 +1,28 @@
From d76702a7b22c85c40c740a63d727a0f114e177ad Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 31 Aug 2011 03:31:27 +0200
Subject: [PATCH] systemctl: if we managed to reexec the init system via the
bus don't retry via signal
If we managed to reeexec the init system via the bus this allows us to
provide synchronous behaviour to callers. This is all lost if we then
repeat the reexecution via SIGTERM.
https://bugzilla.redhat.com/show_bug.cgi?id=698198
---
[rediffed with quilt to apply -- michich]
Index: systemd-26/src/systemctl.c
===================================================================
--- systemd-26.orig/src/systemctl.c
+++ systemd-26/src/systemctl.c
@@ -5428,7 +5428,7 @@ static int reload_with_fallback(DBusConn
if (bus) {
/* First, try systemd via D-Bus. */
- if (daemon_reload(bus, NULL, 0) > 0)
+ if (daemon_reload(bus, NULL, 0) >= 0)
return 0;
}

View File

@ -0,0 +1,23 @@
From e5396fed3f33cb80699561b55090dc3ba7c95de8 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay.sievers@vrfy.org>
Date: Sun, 9 Oct 2011 16:36:45 +0200
Subject: [PATCH] test_virtualization: do not try to compare id in !virt
context
---
[ simple backport -- michich ]
Index: systemd-26/src/condition.c
===================================================================
--- systemd-26.orig/src/condition.c
+++ systemd-26/src/condition.c
@@ -129,7 +129,7 @@ static bool test_virtualization(const ch
if (r == 0 && b == 0)
return true;
- return streq(parameter, id);
+ return r > 0 && streq(parameter, id);
}
static bool test_security(const char *parameter) {

View File

@ -0,0 +1,23 @@
From 3b09f343fe2414cfb36860f1692f327011c4bc44 Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Sat, 6 Aug 2011 15:56:39 -0700
Subject: [PATCH] tmpfiles: Remove X11 lock files for displays :10 and higher
too
---
tmpfiles.d/x11.conf | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tmpfiles.d/x11.conf b/tmpfiles.d/x11.conf
index 5072b58..7f81af6 100644
--- a/tmpfiles.d/x11.conf
+++ b/tmpfiles.d/x11.conf
@@ -15,4 +15,4 @@ d /tmp/.font-unix 1777 root root 10d
d /tmp/.Test-unix 1777 root root 10d
# Unlink the X11 lock files
-r /tmp/.X[0-9]-lock
+r /tmp/.X[0-9]*-lock
--
1.7.4.4

View File

@ -0,0 +1,44 @@
[hand-removed the TODO hunk -- michich]
From 21bdae12e11ae20460715475d8a0c991f15464ac Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 2 Jul 2011 01:44:49 +0200
Subject: [PATCH] tmpfiles: don't exit with an error code if we cannot access
all files
This is just to avoid confusion if people use stuff like FUSE file
systems or SELinux which might disallow access to files even if tmpfiles
is running as root.
We still log away if we cannot access a file, but we do not return a
failure exit code in the end.
---
TODO | 4 ++++
src/tmpfiles.c | 8 ++------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 954c3b7..4394f0d 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -983,15 +983,11 @@ int main(int argc, char *argv[]) {
strv_free(files);
}
-
-
HASHMAP_FOREACH(i, globs, iterator)
- if (process_item(i) < 0)
- r = EXIT_FAILURE;
+ process_item(i);
HASHMAP_FOREACH(i, items, iterator)
- if (process_item(i) < 0)
- r = EXIT_FAILURE;
+ process_item(i);
finish:
while ((i = hashmap_steal_first(items)))
--
1.7.4.4

View File

@ -0,0 +1,25 @@
From 10d975f54c88223fb8762a226fd011ec3f30f2eb Mon Sep 17 00:00:00 2001
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Wed, 5 Oct 2011 22:30:49 +0200
Subject: [PATCH] tmpfiles: fix file descriptor leak
Detected by "cppcheck"
---
src/tmpfiles.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index a6b8f85..21bf44d 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -157,6 +157,7 @@ static void load_unix_sockets(void) {
}
}
+ fclose(f);
return;
fail:
--
1.7.4.4

View File

@ -0,0 +1,27 @@
From dee87d612d295d9c8642b76c716b8e357411e65a Mon Sep 17 00:00:00 2001
From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Tue, 28 Jun 2011 09:30:08 +0200
Subject: [PATCH] umount: ignore missing /proc/swaps
/proc/swaps does not exist when swap is disabled in the kernel.
Just report an empty list of mountpoints to unmount in this case.
---
src/umount.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/umount.c b/src/umount.c
index 3d328e0..95efa82 100644
--- a/src/umount.c
+++ b/src/umount.c
@@ -146,7 +146,7 @@ static int swap_list_get(MountPoint **head) {
assert(head);
if (!(proc_swaps = fopen("/proc/swaps", "re")))
- return -errno;
+ return (errno == ENOENT) ? 0 : -errno;
(void) fscanf(proc_swaps, "%*s %*s %*s %*s %*s\n");
--
1.7.4.4

View File

@ -0,0 +1,44 @@
From a82e5507a6e03766957d43ca8818112ae9766288 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 22 Sep 2011 21:32:18 +0200
Subject: [PATCH] unit: don't recheck conditions when a unit is already
starting but unit_start() is invoked
---
src/unit.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/unit.c b/src/unit.c
index 3ce87ea..0b435cb 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -888,16 +888,20 @@ int unit_start(Unit *u) {
if (u->meta.load_state != UNIT_LOADED)
return -EINVAL;
- /* If this is already (being) started, then this will
- * succeed. Note that this will even succeed if this unit is
- * not startable by the user. This is relied on to detect when
- * we need to wait for units and when waiting is finished. */
+ /* If this is already started, then this will succeed. Note
+ * that this will even succeed if this unit is not startable
+ * by the user. This is relied on to detect when we need to
+ * wait for units and when waiting is finished. */
state = unit_active_state(u);
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
return -EALREADY;
- /* If the conditions failed, don't do anything at all */
- if (!unit_condition_test(u)) {
+ /* If the conditions failed, don't do anything at all. If we
+ * already are activating this call might still be useful to
+ * speed up activation in case there is some hold-off time,
+ * but we don't want to recheck the condition in that case. */
+ if (state != UNIT_ACTIVATING &&
+ !unit_condition_test(u)) {
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
return -EALREADY;
}
--
1.7.4.4

View File

@ -0,0 +1,33 @@
From a65cb51f29ee177f6f800c87232b68475216a418 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 23 Sep 2011 13:58:00 +0200
Subject: [PATCH] unit: fix complementing of requirement deps with After deps
for targets
'man systemd.target' says:
Unless DefaultDependencies= is set to false, target units will
implicitly complement all configured dependencies of type
Wants=, Requires=, RequiresOverridable= with dependencies of type
After= if the units in question also have DefaultDependencies=true.
It did not work because of a forgotten negation.
---
src/unit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/unit.c b/src/unit.c
index 0b435cb..903a8e4 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -774,7 +774,7 @@ int unit_add_default_target_dependency(Unit *u, Unit *target) {
/* If either side wants no automatic dependencies, then let's
* skip this */
if (!u->meta.default_dependencies ||
- target->meta.default_dependencies)
+ !target->meta.default_dependencies)
return 0;
/* Don't create loops */
--
1.7.4.4

View File

@ -0,0 +1,54 @@
From f60c2665f9ba1dd4a6b4a36b2e8195482ada9957 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 9 Dec 2011 15:24:04 +0100
Subject: [PATCH 1/2] unit: fix false positive in check for unneeded unit
A freshly started unit A was immediately considered unneeded just because
unit B, which Requires A, was starting later in the transaction.
Fix it by looking not only at the state of B, but also at its pending job.
Also fix a copied&pasted comment.
---
src/unit.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/unit.c b/src/unit.c
index 018e986..56137d7 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1032,19 +1032,19 @@ static void unit_check_unneeded(Unit *u) {
return;
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i)
- if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+ if (unit_pending_active(other))
return;
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i)
- if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+ if (unit_pending_active(other))
return;
SET_FOREACH(other, u->meta.dependencies[UNIT_WANTED_BY], i)
- if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+ if (unit_pending_active(other))
return;
SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
- if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
+ if (unit_pending_active(other))
return;
log_info("Service %s is not needed anymore. Stopping.", u->meta.id);
@@ -2518,7 +2518,7 @@ bool unit_pending_inactive(Unit *u) {
bool unit_pending_active(Unit *u) {
assert(u);
- /* Returns true if the unit is inactive or going down */
+ /* Returns true if the unit is active or going up */
if (UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u)))
return true;
--
1.7.7.5

View File

@ -0,0 +1,29 @@
From 9a46fc3b9014de1bf0ed1f3004a536b08a19ebb3 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 6 Dec 2011 00:47:28 +0100
Subject: [PATCH] unit: garbage collect units with load error
Units that failed to load were never cleaned up. It was possible to
reach the 128K limit of units by attempting to load a bunch of nonsense.
Bug observed by Reartes Guillermo in
https://bugzilla.redhat.com/show_bug.cgi?id=680122
---
src/unit.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/unit.c b/src/unit.c
index 2a549e2..018e986 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -858,6 +858,7 @@ fail:
u->meta.load_state = UNIT_ERROR;
u->meta.load_error = r;
unit_add_to_dbus_queue(u);
+ unit_add_to_gc_queue(u);
log_debug("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
--
1.7.7.5

View File

@ -0,0 +1,60 @@
[hand-removed an irrelevant non-applicable hunk for logind.h -- michich]
From 15e11d81e7c26439f583e1cf67ac3c712430a79e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 28 Jun 2011 02:53:15 +0200
Subject: [PATCH] unit: when loading symlinked template units, properly add
all names on the way to the unit
---
src/load-fragment.c | 11 +++++++----
src/logind.h | 3 +--
src/unit-name.c | 7 ++++---
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 56eaed9..352db6b 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1661,13 +1661,16 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
* unit name. */
name = file_name_from_path(*filename);
- if (unit_name_is_valid(name, false)) {
- if (!(id = set_get(names, name))) {
+ if (unit_name_is_valid(name, true)) {
- if (!(id = strdup(name)))
+ id = set_get(names, name);
+ if (!id) {
+ id = strdup(name);
+ if (!id)
return -ENOMEM;
- if ((r = set_put(names, id)) < 0) {
+ r = set_put(names, id);
+ if (r < 0) {
free(id);
return r;
}
diff --git a/src/unit-name.c b/src/unit-name.c
index be4e73e..6d45576 100644
--- a/src/unit-name.c
+++ b/src/unit-name.c
@@ -272,9 +272,10 @@ char *unit_name_unescape(const char *f) {
else if (*f == '\\') {
int a, b;
- if (f[1] != 'x' || (a = unhexchar(f[2])) < 0 ||
- (b = unhexchar(f[3])) < 0) {
- /* Invalid escape code, let's take it literal then */
+ if (f[1] != 'x' ||
+ (a = unhexchar(f[2])) < 0 ||
+ (b = unhexchar(f[3])) < 0) {
+ /* Invalid escape code, let's take it literal then */
*(t++) = '\\';
} else {
*(t++) = (char) ((a << 4) | b);
--
1.7.4.4

View File

@ -0,0 +1,60 @@
From cbe8269481a0272a51d72dc35a54a1fe20c93dfc Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 20 Sep 2011 12:11:04 +0200
Subject: [PATCH] units: direct stdout/stderr of rescue shells to tty
With output of services going to syslog by default now, the rescue shell
units need to direct their output to tty explicitly.
Specify stderr too, just in case.
[ the default has not changed in F15, but someone might change their config
-- michich ]
---
units/console-shell.service.m4 | 2 ++
units/emergency.service | 2 ++
units/rescue.service.m4 | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4
index cce2d5a..a4a9108 100644
--- a/units/console-shell.service.m4
+++ b/units/console-shell.service.m4
@@ -31,6 +31,8 @@ WorkingDirectory=/root
ExecStart=-/sbin/sulogin
ExecStopPost=-/bin/systemctl poweroff
StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
KillMode=process
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
diff --git a/units/emergency.service b/units/emergency.service
index eff5261..4847f4f 100644
--- a/units/emergency.service
+++ b/units/emergency.service
@@ -21,6 +21,8 @@ ExecStartPre=-/bin/echo 'Welcome to emergency mode. Use "systemctl default" or ^
ExecStart=-/sbin/sulogin
ExecStopPost=/bin/systemctl --fail --no-block default
StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
KillMode=process
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
diff --git a/units/rescue.service.m4 b/units/rescue.service.m4
index d2fd582..5b4ab6e 100644
--- a/units/rescue.service.m4
+++ b/units/rescue.service.m4
@@ -31,6 +31,8 @@ m4_ifdef(`TARGET_MEEGO',
ExecStart=-/bin/bash -c "exec ${SINGLE}"',)))
ExecStopPost=-/bin/systemctl --fail --no-block default
StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
KillMode=process
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
--
1.7.4.4

View File

@ -0,0 +1,26 @@
From fc8f0b5c9cb8277950a2fefdb7f754c47b172dfd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 1 Nov 2011 22:29:48 +0100
Subject: [PATCH] units: drop [Install] section from remote-fs-pre.target
remote-fs-pre.target is not a unit a user should ever explicitly enable.
Instead services which need to hook before network mounts should pull it
in.
---
units/remote-fs-pre.target | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/units/remote-fs-pre.target b/units/remote-fs-pre.target
index 5406aa2..8aceb08 100644
--- a/units/remote-fs-pre.target
+++ b/units/remote-fs-pre.target
@@ -10,6 +10,3 @@
[Unit]
Description=Remote File Systems (Pre)
After=network.target
-
-[Install]
-WantedBy=multi-user.target
--
1.7.7

View File

@ -0,0 +1,38 @@
From 26b8e979c8a6340180716f686dbe26e4906bc568 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 2 Jul 2011 01:00:00 +0200
Subject: [PATCH] units: enable dev-hugepages.automount and
dev-mqueue.automount only when enabled in kernel
---
units/dev-hugepages.automount | 1 +
units/dev-mqueue.automount | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/units/dev-hugepages.automount b/units/dev-hugepages.automount
index dfd3868..6e03df3 100644
--- a/units/dev-hugepages.automount
+++ b/units/dev-hugepages.automount
@@ -9,6 +9,7 @@
Description=Huge Pages File System Automount Point
DefaultDependencies=no
Before=sysinit.target
+ConditionPathExists=/sys/kernel/mm/hugepages
[Automount]
Where=/dev/hugepages
diff --git a/units/dev-mqueue.automount b/units/dev-mqueue.automount
index 73c4110..1061597 100644
--- a/units/dev-mqueue.automount
+++ b/units/dev-mqueue.automount
@@ -9,6 +9,7 @@
Description=POSIX Message Queue File System Automount Point
DefaultDependencies=no
Before=sysinit.target
+ConditionPathExists=/proc/sys/fs/mqueue
[Automount]
Where=/dev/mqueue
--
1.7.4.4

View File

@ -0,0 +1,33 @@
From 0fe9972f3c2e20b649e0e7da0e61945253622128 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Thu, 22 Sep 2011 23:52:38 +0200
Subject: [PATCH] units: fix rescue.service race with plymouth
It was possible for the "ExecStartPre=-/bin/plymouth quit" to race
with plymouth-start.service which is pulled in indirectly by
basic.target -> sysinit.target.
The race left plymouth running on the terminal, making it unusable for
rescue purposes.
https://bugzilla.redhat.com/show_bug.cgi?id=710487
---
units/rescue.service.m4 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/units/rescue.service.m4 b/units/rescue.service.m4
index 8f29de8..19b30d8 100644
--- a/units/rescue.service.m4
+++ b/units/rescue.service.m4
@@ -11,7 +11,7 @@
Description=Rescue Shell
DefaultDependencies=no
Conflicts=shutdown.target
-After=basic.target
+After=basic.target plymouth-start.service
Before=shutdown.target
[Service]
--
1.7.4.4

View File

@ -0,0 +1,53 @@
From 822b18599d1c9465449c7111fe7e7b86fbf44a57 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 11 Oct 2011 14:26:20 +0200
Subject: [PATCH] units: forgot target units
---
units/local-fs-pre.target | 11 +++++++++++
units/remote-fs-pre.target | 15 +++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 units/local-fs-pre.target
create mode 100644 units/remote-fs-pre.target
diff --git a/units/local-fs-pre.target b/units/local-fs-pre.target
new file mode 100644
index 0000000..11e67ba
--- /dev/null
+++ b/units/local-fs-pre.target
@@ -0,0 +1,11 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Local File Systems (Pre)
diff --git a/units/remote-fs-pre.target b/units/remote-fs-pre.target
new file mode 100644
index 0000000..5406aa2
--- /dev/null
+++ b/units/remote-fs-pre.target
@@ -0,0 +1,15 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Remote File Systems (Pre)
+After=network.target
+
+[Install]
+WantedBy=multi-user.target
--
1.7.4.4

View File

@ -0,0 +1,148 @@
From 21e557edcc1894ce4eeb70b71ca16e82e95bc0df Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 11 Oct 2011 03:33:53 +0200
Subject: [PATCH] units: introduce local-fs-pre.target and
remote-fs-pre.target
This hook target enables services to order themselves between
network.target and remote mounts, which is needed for GFS2 and similar
systems.
---
[ patching Makefile.in too to avoid the need for autotools -- michich ]
Makefile.am | 2 ++
Makefile.in | 4 +++-
man/systemd.special.xml.in | 26 ++++++++++++++++++++++++++
src/mount.c | 6 ++++--
src/special.h | 2 ++
5 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 873090e..26fc1f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -237,6 +237,8 @@ dist_systemunit_DATA = \
units/halt.target \
units/kexec.target \
units/local-fs.target \
+ units/local-fs-pre.target \
+ units/remote-fs-pre.target \
units/cryptsetup.target \
units/network.target \
units/nss-lookup.target \
diff --git a/Makefile.in b/Makefile.in
index 9897e73..611c392 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -845,7 +845,8 @@ am__dist_systemunit_DATA_DIST = units/graphical.target \
units/multi-user.target units/emergency.service \
units/emergency.target units/sysinit.target units/basic.target \
units/getty.target units/halt.target units/kexec.target \
- units/local-fs.target units/cryptsetup.target \
+ units/local-fs.target units/local-fs-pre.target \
+ units/remote-fs-pre.target units/cryptsetup.target \
units/network.target units/nss-lookup.target \
units/mail-transfer-agent.target units/http-daemon.target \
units/poweroff.target units/reboot.target units/rescue.target \
@@ -1135,6 +1136,7 @@ dist_systemunit_DATA = units/graphical.target units/multi-user.target \
units/emergency.service units/emergency.target \
units/sysinit.target units/basic.target units/getty.target \
units/halt.target units/kexec.target units/local-fs.target \
+ units/local-fs-pre.target units/remote-fs-pre.target \
units/cryptsetup.target units/network.target \
units/nss-lookup.target units/mail-transfer-agent.target \
units/http-daemon.target units/poweroff.target \
diff --git a/man/systemd.special.xml.in b/man/systemd.special.xml.in
index ecc9dde..24f2d65 100644
--- a/man/systemd.special.xml.in
+++ b/man/systemd.special.xml.in
@@ -59,6 +59,7 @@
<filename>halt.target</filename>,
<filename>kbrequest.target</filename>,
<filename>local-fs.target</filename>,
+ <filename>local-fs-pre.target</filename>,
<filename>mail-transfer-agent.target</filename>,
<filename>multi-user.target</filename>,
<filename>network.target</filename>,
@@ -66,6 +67,7 @@
<filename>poweroff.target</filename>,
<filename>reboot.target</filename>,
<filename>remote-fs.target</filename>,
+ <filename>remote-fs-pre.target</filename>,
<filename>rescue.target</filename>,
<filename>rpcbind.target</filename>,
<filename>time-sync.target</filename>,
@@ -261,6 +263,18 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><filename>local-fs-pre.target</filename></term>
+ <listitem>
+ <para>This target unit is
+ automatically ordered before
+ all local mount points marked
+ with <option>auto</option>
+ (see above). It can be used to
+ execute certain units before
+ all local mounts.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>mail-transfer-agent.target</filename></term>
<listitem>
<para>The mail transfer agent
@@ -374,6 +388,18 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><filename>remote-fs-pre.target</filename></term>
+ <listitem>
+ <para>This target unit is
+ automatically ordered before
+ all remote mount points marked
+ with <option>auto</option>
+ (see above). It can be used to
+ execute certain units before
+ all remote mounts.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>rescue.target</filename></term>
<listitem>
<para>A special target unit
diff --git a/src/mount.c b/src/mount.c
index 11b6e83..1a9505e 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -357,9 +357,11 @@ static int mount_add_fstab_links(Mount *m) {
if (mount_is_network(p)) {
target = SPECIAL_REMOTE_FS_TARGET;
- after = SPECIAL_NETWORK_TARGET;
- } else
+ after = SPECIAL_REMOTE_FS_PRE_TARGET;
+ } else {
target = SPECIAL_LOCAL_FS_TARGET;
+ after = SPECIAL_LOCAL_FS_PRE_TARGET;
+ }
if (!path_equal(m->where, "/"))
if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
diff --git a/src/special.h b/src/special.h
index 08dae11..703559b 100644
--- a/src/special.h
+++ b/src/special.h
@@ -45,7 +45,9 @@
#define SPECIAL_SYSINIT_TARGET "sysinit.target"
#define SPECIAL_SOCKETS_TARGET "sockets.target"
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target" /* LSB's $local_fs */
+#define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */
+#define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
#define SPECIAL_SWAP_TARGET "swap.target"
#define SPECIAL_BASIC_TARGET "basic.target"
--
1.7.4.4

View File

@ -0,0 +1,47 @@
From 8266f984df0b069a345bf959628bac70877ce5e1 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 11 Oct 2011 03:41:04 +0200
Subject: [PATCH] units: remount root and API FS before all mount units are
applied
In order to ensure that bind mounts copy the final mount settings to the
new bind mount make the root and API FS mount options are applied before
the other file systems are mounted.
https://bugzilla.redhat.com/show_bug.cgi?id=718464
---
units/remount-rootfs.service | 3 ++-
units/systemd-remount-api-vfs.service.in | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/units/remount-rootfs.service b/units/remount-rootfs.service
index e95023f..89a16c8 100644
--- a/units/remount-rootfs.service
+++ b/units/remount-rootfs.service
@@ -10,7 +10,8 @@ Description=Remount Root FS
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service fsck-root.service
-Before=local-fs.target shutdown.target
+Before=local-fs-pre.target local-fs.target shutdown.target
+Wants=local-fs-pre.target
[Service]
Type=oneshot
diff --git a/units/systemd-remount-api-vfs.service.in b/units/systemd-remount-api-vfs.service.in
index 2ccbe23..6339ee6 100644
--- a/units/systemd-remount-api-vfs.service.in
+++ b/units/systemd-remount-api-vfs.service.in
@@ -10,7 +10,8 @@ Description=Remount API VFS
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
-Before=local-fs.target shutdown.target
+Before=local-fs-pre.target local-fs.target shutdown.target
+Wants=local-fs-pre.target
[Service]
Type=oneshot
--
1.7.4.4

View File

@ -0,0 +1,40 @@
From 678abaf91e2308f02fb679c2dc2679a3b6a5b8be Mon Sep 17 00:00:00 2001
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Wed, 5 Oct 2011 22:31:41 +0200
Subject: [PATCH] util: fix close() call on wrong variable
Detected by "cppcheck" (actually it detected a file descriptor leak)
---
src/util.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/util.c b/src/util.c
index 7977ee4..e46606d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2307,8 +2307,10 @@ int chvt(int vt) {
0
};
- if (ioctl(fd, TIOCLINUX, tiocl) < 0)
- return -errno;
+ if (ioctl(fd, TIOCLINUX, tiocl) < 0) {
+ r = -errno;
+ goto fail;
+ }
vt = tiocl[0] <= 0 ? 1 : tiocl[0];
}
@@ -2316,7 +2318,8 @@ int chvt(int vt) {
if (ioctl(fd, VT_ACTIVATE, vt) < 0)
r = -errno;
- close_nointr_nofail(r);
+fail:
+ close_nointr_nofail(fd);
return r;
}
--
1.7.4.4

View File

@ -0,0 +1,136 @@
From 0ad26e09de813857382ec3a787fc6df5e52cf98b Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 6 Nov 2011 23:06:38 +0100
Subject: [PATCH 1/4] utmp: remove unneded parameters
With these functions no caller ever passes anything else than 0
for 't' (meaning the current time will be used).
---
src/execute.c | 2 +-
src/systemctl.c | 2 +-
src/update-utmp.c | 4 ++--
src/utmp-wtmp.c | 12 ++++++------
src/utmp-wtmp.h | 6 +++---
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/execute.c b/src/execute.c
index 866e8bf..250d53a 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1170,7 +1170,7 @@ int exec_spawn(ExecCommand *command,
}
if (context->utmp_id)
- utmp_put_init_process(0, context->utmp_id, getpid(), getsid(0), context->tty_path);
+ utmp_put_init_process(context->utmp_id, getpid(), getsid(0), context->tty_path);
if (context->user) {
username = context->user;
diff --git a/src/systemctl.c b/src/systemctl.c
index 175159d..7373e64 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -5156,7 +5156,7 @@ static int halt_main(DBusConnection *bus) {
if (!arg_no_wtmp) {
if (sd_booted() > 0)
log_debug("Not writing utmp record, assuming that systemd-update-utmp is used.");
- else if ((r = utmp_put_shutdown(0)) < 0)
+ else if ((r = utmp_put_shutdown()) < 0)
log_warning("Failed to write utmp record: %s", strerror(-r));
}
diff --git a/src/update-utmp.c b/src/update-utmp.c
index 12e4d11..073f28e 100644
--- a/src/update-utmp.c
+++ b/src/update-utmp.c
@@ -284,7 +284,7 @@ static int on_shutdown(Context *c) {
}
#endif
- if ((q = utmp_put_shutdown(0)) < 0) {
+ if ((q = utmp_put_shutdown()) < 0) {
log_error("Failed to write utmp record: %s", strerror(-q));
r = q;
}
@@ -339,7 +339,7 @@ static int on_runlevel(Context *c) {
}
#endif
- if ((q = utmp_put_runlevel(0, runlevel, previous)) < 0) {
+ if ((q = utmp_put_runlevel(runlevel, previous)) < 0) {
log_error("Failed to write utmp record: %s", strerror(-q));
r = q;
}
diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c
index b03a3e7..e7b2e3c 100644
--- a/src/utmp-wtmp.c
+++ b/src/utmp-wtmp.c
@@ -172,10 +172,10 @@ static int write_entry_both(const struct utmpx *store) {
return r;
}
-int utmp_put_shutdown(usec_t t) {
+int utmp_put_shutdown(void) {
struct utmpx store;
- init_entry(&store, t);
+ init_entry(&store, 0);
store.ut_type = RUN_LVL;
strncpy(store.ut_user, "shutdown", sizeof(store.ut_user));
@@ -206,12 +206,12 @@ static const char *sanitize_id(const char *id) {
return id + l - sizeof(((struct utmpx*) NULL)->ut_id);
}
-int utmp_put_init_process(usec_t t, const char *id, pid_t pid, pid_t sid, const char *line) {
+int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line) {
struct utmpx store;
assert(id);
- init_timestamp(&store, t);
+ init_timestamp(&store, 0);
store.ut_type = INIT_PROCESS;
store.ut_pid = pid;
@@ -257,7 +257,7 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
}
-int utmp_put_runlevel(usec_t t, int runlevel, int previous) {
+int utmp_put_runlevel(int runlevel, int previous) {
struct utmpx store;
int r;
@@ -277,7 +277,7 @@ int utmp_put_runlevel(usec_t t, int runlevel, int previous) {
if (previous == runlevel)
return 0;
- init_entry(&store, t);
+ init_entry(&store, 0);
store.ut_type = RUN_LVL;
store.ut_pid = (runlevel & 0xFF) | ((previous & 0xFF) << 8);
diff --git a/src/utmp-wtmp.h b/src/utmp-wtmp.h
index 4054aff..a5998eb 100644
--- a/src/utmp-wtmp.h
+++ b/src/utmp-wtmp.h
@@ -26,12 +26,12 @@
int utmp_get_runlevel(int *runlevel, int *previous);
-int utmp_put_shutdown(usec_t timestamp);
+int utmp_put_shutdown(void);
int utmp_put_reboot(usec_t timestamp);
-int utmp_put_runlevel(usec_t timestamp, int runlevel, int previous);
+int utmp_put_runlevel(int runlevel, int previous);
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
-int utmp_put_init_process(usec_t timestamp, const char *id, pid_t pid, pid_t sid, const char *line);
+int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line);
int utmp_wall(const char *message, bool (*match_tty)(const char *tty));
--
1.7.7.5

View File

@ -0,0 +1,117 @@
From 563ba9ea6e60774086555998b957edf923e24b46 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Mon, 17 Oct 2011 11:12:12 +0200
Subject: [PATCH 2/5] manager: fix a crash in isolating
HASHMAP_FOREACH is safe against the removal of the current entry, but
not against the removal of other entries. job_finish_and_invalidate()
can recursively remove other entries.
It triggered an assertion failure:
Assertion 'j->installed' failed at src/manager.c:1218, function
transaction_apply(). Aborting.
Fix the crash by iterating from the beginning when there is a
possibility that the iterator could be invalid.
It is O(n^2) in the worst case, but that's better than a crash.
https://bugzilla.redhat.com/show_bug.cgi?id=717325
---
src/job.c | 19 ++++++++++++++-----
src/manager.c | 7 ++++++-
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/job.c b/src/job.c
index 5c0913b..20971da 100644
--- a/src/job.c
+++ b/src/job.c
@@ -527,6 +527,7 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
Unit *other;
JobType t;
Iterator i;
+ bool recursed = false;
assert(j);
assert(j->installed);
@@ -573,23 +574,29 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
if (other->meta.job &&
(other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
- other->meta.job->type == JOB_RELOAD_OR_START))
+ other->meta.job->type == JOB_RELOAD_OR_START)) {
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
+ recursed = true;
+ }
SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
if (other->meta.job &&
(other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
- other->meta.job->type == JOB_RELOAD_OR_START))
+ other->meta.job->type == JOB_RELOAD_OR_START)) {
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
+ recursed = true;
+ }
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i)
if (other->meta.job &&
!other->meta.job->override &&
(other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
- other->meta.job->type == JOB_RELOAD_OR_START))
+ other->meta.job->type == JOB_RELOAD_OR_START)) {
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
+ recursed = true;
+ }
} else if (t == JOB_STOP) {
@@ -597,8 +604,10 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
if (other->meta.job &&
(other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
- other->meta.job->type == JOB_RELOAD_OR_START))
+ other->meta.job->type == JOB_RELOAD_OR_START)) {
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
+ recursed = true;
+ }
}
}
@@ -626,7 +635,7 @@ finish:
manager_check_finished(u->meta.manager);
- return 0;
+ return recursed;
}
int job_start_timer(Job *j) {
diff --git a/src/manager.c b/src/manager.c
index e626347..6d20258 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1214,13 +1214,18 @@ static int transaction_apply(Manager *m, JobMode mode) {
/* When isolating first kill all installed jobs which
* aren't part of the new transaction */
+ rescan:
HASHMAP_FOREACH(j, m->jobs, i) {
assert(j->installed);
if (hashmap_get(m->transaction_jobs, j->unit))
continue;
- job_finish_and_invalidate(j, JOB_CANCELED);
+ /* 'j' itself is safe to remove, but if other jobs
+ are invalidated recursively, our iterator may become
+ invalid and we need to start over. */
+ if (job_finish_and_invalidate(j, JOB_CANCELED) > 0)
+ goto rescan;
}
}
--
1.7.4.4

View File

@ -0,0 +1,55 @@
From 75d3fc60f88e08bf953063819a8a04b881d6db23 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 29 Nov 2011 23:14:36 +0100
Subject: [PATCH 2/4] shutdownd: use PassCred=yes in the socket unit
Since Linux 3.2 in order to receive SCM_CREDENTIALS it is not sufficient
to set SO_PASSCRED just before recvmsg(). The option has to be already
set when the sender sends the message.
With socket activation it is too late to set the option in the service.
It must be set on the socket right from the start.
See the kernel commit:
16e57262 af_unix: dont send SCM_CREDENTIALS by default
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=757628
---
src/shutdownd.c | 6 ------
units/systemd-shutdownd.socket | 1 +
2 files changed, 1 insertions(+), 6 deletions(-)
Index: systemd-26/src/shutdownd.c
===================================================================
--- systemd-26.orig/src/shutdownd.c
+++ systemd-26/src/shutdownd.c
@@ -173,7 +173,6 @@ int main(int argc, char *argv[]) {
};
int r = EXIT_FAILURE, n_fds;
- int one = 1;
struct shutdownd_command c;
struct pollfd pollfd[_FD_MAX];
bool exec_shutdown = false, unlink_nologin = false, failed = false;
@@ -203,11 +202,6 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- if (setsockopt(SD_LISTEN_FDS_START, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0) {
- log_error("SO_PASSCRED failed: %m");
- return EXIT_FAILURE;
- }
-
zero(c);
zero(pollfd);
Index: systemd-26/units/systemd-shutdownd.socket
===================================================================
--- systemd-26.orig/units/systemd-shutdownd.socket
+++ systemd-26/units/systemd-shutdownd.socket
@@ -14,3 +14,5 @@ Before=sockets.target
[Socket]
ListenDatagram=/run/systemd/shutdownd
+SocketMode=0600
+PassCred=yes

View File

@ -0,0 +1,47 @@
From cd0504d0a13d8297b97c9238fd1b94b4141c5aa8 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 9 Dec 2011 15:25:29 +0100
Subject: [PATCH 2/2] unit: check for unneeded dependencies even when unit
stop was expected
systemd did not stop units marked as "StopWhenUnneeded=yes" when the requiring
unit was stopped on user's request.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=704197
---
src/unit.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/unit.c b/src/unit.c
index 56137d7..03c90f5 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1105,6 +1105,14 @@ static void retroactively_stop_dependencies(Unit *u) {
SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
manager_add_job(u->meta.manager, JOB_STOP, other, JOB_REPLACE, true, NULL, NULL);
+}
+
+static void check_unneeded_dependencies(Unit *u) {
+ Iterator i;
+ Unit *other;
+
+ assert(u);
+ assert(UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)));
/* Garbage collect services that might not be needed anymore, if enabled */
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRES], i)
@@ -1263,6 +1271,10 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
retroactively_stop_dependencies(u);
}
+ /* stop unneeded units regardless if going down was expected or not */
+ if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+ check_unneeded_dependencies(u);
+
if (ns != os && ns == UNIT_FAILED) {
log_notice("Unit %s entered failed state.", u->meta.id);
unit_trigger_on_failure(u);
--
1.7.7.5

View File

@ -0,0 +1,26 @@
From b8e47420b32b52619c6c49c98a663bee7929ccbe Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 6 Nov 2011 23:07:54 +0100
Subject: [PATCH 2/4] utmp: no need to zero a struct before overwriting it
with memcpy
---
src/utmp-wtmp.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c
index e7b2e3c..98c1a25 100644
--- a/src/utmp-wtmp.c
+++ b/src/utmp-wtmp.c
@@ -242,8 +242,6 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
if (found->ut_pid != pid)
return 0;
- zero(store);
-
memcpy(&store, &lookup, sizeof(store));
store.ut_type = DEAD_PROCESS;
store.ut_exit.e_termination = code;
--
1.7.7.5

View File

@ -0,0 +1,51 @@
From 1a2801529e916ec31d2a8cc66cd5c3b8d9ad9caa Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 30 Nov 2011 09:37:13 +0100
Subject: [PATCH 3/4] syslog: use PassCred=yes for the /dev/log socket
Both kmsg-syslogd and the real syslog service want to receive
SCM_CREDENTIALS. With socket activation it is too late to set
SO_PASSCRED in the services.
---
src/kmsg-syslogd.c | 5 +----
units/syslog.socket | 1 +
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/kmsg-syslogd.c b/src/kmsg-syslogd.c
index 0901a0e..7fd69f8 100644
--- a/src/kmsg-syslogd.c
+++ b/src/kmsg-syslogd.c
@@ -91,7 +91,7 @@ static int server_init(Server *s, unsigned n_sockets) {
}
for (i = 0; i < n_sockets; i++) {
- int fd, one = 1;
+ int fd;
fd = SD_LISTEN_FDS_START+i;
@@ -106,9 +106,6 @@ static int server_init(Server *s, unsigned n_sockets) {
goto fail;
}
- if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
- log_error("SO_PASSCRED failed: %m");
-
zero(ev);
ev.events = EPOLLIN;
ev.data.fd = fd;
diff --git a/units/syslog.socket b/units/syslog.socket
index 500bb7c..e74b559 100644
--- a/units/syslog.socket
+++ b/units/syslog.socket
@@ -18,6 +18,7 @@ Wants=syslog.target
[Socket]
ListenDatagram=/dev/log
SocketMode=0666
+PassCred=yes
# The service we activate on incoming traffic is
# systemd-kmsg-syslogd.service. That doesn't mean however, that this
--
1.7.7.6

View File

@ -0,0 +1,26 @@
From fa4ad7ceca6c96d9f0b7022819acf8954cba35ea Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 6 Nov 2011 23:31:46 +0100
Subject: [PATCH 3/4] utmp: initialize store with the found entry, not with
the lookup key
---
src/utmp-wtmp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c
index 98c1a25..00e19a3 100644
--- a/src/utmp-wtmp.c
+++ b/src/utmp-wtmp.c
@@ -242,7 +242,7 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
if (found->ut_pid != pid)
return 0;
- memcpy(&store, &lookup, sizeof(store));
+ memcpy(&store, found, sizeof(store));
store.ut_type = DEAD_PROCESS;
store.ut_exit.e_termination = code;
store.ut_exit.e_exit = status;
--
1.7.7.5

View File

@ -0,0 +1,34 @@
From 42e87475cfe20a5e79da882012629f9d3ae63648 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 30 Nov 2011 11:06:35 +0100
Subject: [PATCH 4/4] man: document the PassCred option
---
man/systemd.socket.xml | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 28c8dc4..2f31242 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -525,6 +525,17 @@
</varlistentry>
<varlistentry>
+ <term><varname>PassCred=</varname></term>
+ <listitem><para>Takes a boolean
+ value. This controls the SO_PASSCRED
+ option, which allows UNIX sockets to
+ receive the credentials of the sending
+ process in an ancillary message.
+ Defaults to
+ <option>false</option>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>TCPCongestion=</varname></term>
<listitem><para>Takes a string
value. Controls the TCP congestion
--
1.7.7.6

View File

@ -0,0 +1,70 @@
From 4743137a4b7ce6214a06d02872bdfac080b6f131 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Sun, 6 Nov 2011 23:55:06 +0100
Subject: [PATCH 4/4] utmp: for DEAD_PROCESS write the current time to wtmp
Zeroed .ut_tv values in wtmp confuse chkrootkit.
Reported and debugged by Norman Smith. This is based on his patch,
but modified to behave more like upstart did in F14 and cleaned up.
https://bugzilla.redhat.com/show_bug.cgi?id=743696
---
src/utmp-wtmp.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c
index 00e19a3..217ae1e 100644
--- a/src/utmp-wtmp.c
+++ b/src/utmp-wtmp.c
@@ -155,11 +155,11 @@ static int write_entry_wtmp(const struct utmpx *store) {
return -errno;
}
-static int write_entry_both(const struct utmpx *store) {
+static int write_utmp_wtmp(const struct utmpx *store_utmp, const struct utmpx *store_wtmp) {
int r, s;
- r = write_entry_utmp(store);
- s = write_entry_wtmp(store);
+ r = write_entry_utmp(store_utmp);
+ s = write_entry_wtmp(store_wtmp);
if (r >= 0)
r = s;
@@ -172,6 +172,10 @@ static int write_entry_both(const struct utmpx *store) {
return r;
}
+static int write_entry_both(const struct utmpx *store) {
+ return write_utmp_wtmp(store, store);
+}
+
int utmp_put_shutdown(void) {
struct utmpx store;
@@ -226,7 +230,7 @@ int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line
}
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
- struct utmpx lookup, store, *found;
+ struct utmpx lookup, store, store_wtmp, *found;
assert(id);
@@ -251,7 +255,11 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
zero(store.ut_host);
zero(store.ut_tv);
- return write_entry_both(&store);
+ memcpy(&store_wtmp, &store, sizeof(store_wtmp));
+ /* wtmp wants the current time */
+ init_timestamp(&store_wtmp, 0);
+
+ return write_utmp_wtmp(&store, &store_wtmp);
}
--
1.7.7.5

View File

@ -0,0 +1,30 @@
From 90eb06e8c7da2c10eeccc4915bca577304785664 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 2 Mar 2012 10:39:10 +0100
Subject: [PATCH] util: never follow symlinks in rm_rf_children()
The function checks if the entry is a directory before recursing, but
there is a window between the check and the open, during which the
directory could be replaced with a symlink.
CVE-2012-1174
https://bugzilla.redhat.com/show_bug.cgi?id=803358
(cherry picked from commit 5ebff5337594d690b322078c512eb222d34aaa82)
---
src/util.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/util.c b/src/util.c
index a488289..6a2c61f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3483,7 +3483,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) {
if (is_dir) {
int subdir_fd;
- if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) {
+ subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
+ if (subdir_fd < 0) {
if (ret == 0 && errno != ENOENT)
ret = -errno;
continue;

View File

@ -0,0 +1,26 @@
allow fedora-storage-init to detect encrypted PVs
After unlocking an encrypted volume, let LVM detect a possible PV on it.
This way fedora-storage-init-late.service will be able to activate the VG.
This is a non-upstream patch and it is only temporary until lvm2 is updated
to use udev and to get rid of /etc/lvm/cache. According to Milan Brož it is
already implemented upstream.
https://bugzilla.redhat.com/show_bug.cgi?id=708684
Index: systemd-26/src/cryptsetup-generator.c
===================================================================
--- systemd-26.orig/src/cryptsetup-generator.c
+++ systemd-26/src/cryptsetup-generator.c
@@ -131,8 +131,10 @@ static int create_disk(
"RemainAfterExit=yes\n"
"TimeoutSec=0\n" /* the binary handles timeouts anyway */
"ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '%s' '%s'\n"
+ "ExecStart=-/sbin/pvs -o pv_uuid '/dev/mapper/%s'\n"
"ExecStop=" SYSTEMD_CRYPTSETUP_PATH " detach '%s'\n",
name, u, strempty(password), strempty(options),
+ name,
name);
if (has_option(options, "tmp"))

View File

@ -2,7 +2,7 @@ Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Version: 26
Release: 2%{?dist}
Release: 18%{?dist}
License: GPLv2+
Group: System Environment/Base
Summary: A System and Service Manager
@ -40,6 +40,101 @@ Patch0: 0001-dbus-common-fix-segfault-when-a-DBus-message-has-no-.patch
Patch1: 0001-readahead-collect-ignore-EACCES-for-fanotify.patch
Patch2: 0001-vconsole-use-open_terminal-instead-of-open.patch
Patch3: 0001-pam-downgrade-a-few-log-msgs.patch
Patch4: 0001-systemctl-fix-double-unref-of-a-dbus-message.patch
Patch5: 0001-cryptsetup-generator-fix-etc-cryptsetup-options.patch
Patch6: 0001-readahead-common-fix-total-memory-size-detection.patch
Patch7: 0001-systemctl-fix-is-enabled-for-native-units-under-lib.patch
Patch8: 0001-dbus-fix-name-of-capability-property.patch
Patch9: 0001-pam-module-add-debug-parameter.patch
Patch10: 0001-systemctl-Add-SYSTEMD_PAGER-for-setting-the-pager-to.patch
Patch11: 0001-manager-include-full-systemctl-status-command-line-i.patch
Patch12: 0001-swap-ignore-missing-proc-swaps.patch
Patch13: 0001-unit-when-loading-symlinked-template-units-properly-.patch
Patch14: 0001-execute-don-t-choke-when-systemd-was-compiled-with-a.patch
Patch15: 0001-execute-fix-PAM-error-checking.patch
Patch16: 0001-umount-ignore-missing-proc-swaps.patch
Patch17: 0001-units-enable-dev-hugepages.automount-and-dev-mqueue..patch
Patch18: 0001-tmpfiles-don-t-exit-with-an-error-code-if-we-cannot-.patch
Patch19: 0001-manager-consider-the-active-job-when-merging.patch
Patch20: 0001-shutdown-accept-minutes-argument-without.patch
Patch21: 0001-shutdown-respect-the-dry-run-option-k.patch
Patch22: 0001-shutdown-print-the-standard-wall-message-even-when-t.patch
Patch23: 0001-systemadm-report-GLib.Error-only-to-stderr.patch
Patch24: 0001-password-agent-make-sure-not-to-access-unallocated-m.patch
Patch25: 0001-password-agent-actually-really-don-t-access-unalloca.patch
# Cannot apply this yet because of bz719931
#Patch26: 0001-service-pidfile-in-SysV-chkconfig-header-implies-a-r.patch
Patch27: 0001-cgroup-don-t-trim-a-cgroup-we-create-we-might-just-t.patch
Patch28: 0001-manager-merge-serialization-and-desrialization-count.patch
Patch29: 0001-execute-properly-enforce-group.patch
Patch30: 0001-manager-call-generators-with-umask-0022.patch
Patch31: 0001-getty-automatically-spawn-getty-on-xen-console-xvc0.patch
Patch32: 0001-manager-add-log-control-via-RT-signals.patch
Patch33: 0001-Don-t-show-a-warning-message-in-non-enforcing-mode.patch
Patch34: 0001-strv-fix-counting-in-strv_env_delete.patch
Patch35: 0001-tmpfiles-Remove-X11-lock-files-for-displays-10-and-h.patch
Patch36: 0001-cryptsetup-accept-none-option.patch
# May cause a new dep cycle, related to bz711150
#Patch37: 0001-cryptsetup-generator-block-boot-when-querying-passph.patch
Patch38: 0001-execute-fix-bus-serialization-for-commands.patch
Patch39: 0001-specifier-drop-misplaced-assert.patch
Patch40: 0001-getty-generator-ignore-if-symlinks-already-exist.patch
Patch41: 0001-mount-fix-parsing-of-prio-value.patch
Patch42: 0001-systemctl-if-we-managed-to-reexec-the-init-system-vi.patch
Patch43: 0001-dropin-don-t-fail-if-random-files-are-stored-in-.wan.patch
Patch44: 0001-getty-automatically-add-getty-on-hvsi0-virtualizer-c.patch
Patch45: 0001-getty-simplify-things-a-bit.patch
Patch46: 0001-locale-support-LANGUAGE-too.patch
Patch47: 0001-fsck-show-progress-while-fscking-at-boot.patch
Patch48: 0001-stdout-bridge-set-facility-of-messages-with-no-facil.patch
Patch49: 0001-condition-opt-out-of-proc-cmdline-parsing-only-when-.patch
Patch50: 0001-stdout-syslog-bridge-properly-handle-overly-long-log.patch
Patch51: 0001-units-direct-stdout-stderr-of-rescue-shells-to-tty.patch
Patch52: 0001-service-handle-forking-services-that-move-to-a-new-P.patch
Patch53: 0001-service-minor-change-in-service_load_pid_file-return.patch
Patch54: 0001-modules-load-filter-out-double-modules.patch
Patch55: 0001-job-after-converting-a-job-from-restart-to-start-rea.patch
Patch56: 0001-mount-pull-in-quota-tools-from-fstab-lines-with-quot.patch
Patch57: 0001-service-if-StandardInput-socket-and-StandardOutput-i.patch
Patch58: 0001-unit-don-t-recheck-conditions-when-a-unit-is-already.patch
Patch59: 0001-units-fix-rescue.service-race-with-plymouth.patch
Patch60: 0001-coverity-fix-a-couple-of-bugs-found-by-coverity.patch
Patch61: 0001-condition-fix-reversed-tests-if-path-does-not-exist-.patch
Patch62: 0001-manager-fix-job-mode-for-SIGRTMIN-1-2.patch
Patch63: 0001-llvm-analyze-fix-some-bugs-found-by-llvm-analyze.patch
# May be risky. See what it caused in F16 in bz741078.
#Patch64: 0001-unit-fix-complementing-of-requirement-deps-with-Afte.patch
Patch65: 0001-service-fix-up-std-output-error-before-we-add-depend.patch
Patch66: 0001-test_virtualization-do-not-try-to-compare-id-in-virt.patch
Patch67: 0001-tmpfiles-fix-file-descriptor-leak.patch
Patch68: 0001-util-fix-close-call-on-wrong-variable.patch
Patch69: 0001-readahead-lower-max-file-size-for-readahead.patch
Patch70: 0001-units-introduce-local-fs-pre.target-and-remote-fs-pr.patch
Patch71: 0001-units-forgot-target-units.patch
Patch72: 0001-units-remount-root-and-API-FS-before-all-mount-units.patch
Patch73: 0001-service-don-t-try-to-guess-PID-for-SysV-services-any.patch
Patch74: 0002-manager-fix-a-crash-in-isolating.patch
Patch75: 0001-mount-order-remote-mounts-after-both-network.target-.patch
Patch76: 0001-units-drop-Install-section-from-remote-fs-pre.target.patch
Patch77: 0001-unit-fix-false-positive-in-check-for-unneeded-unit.patch
Patch78: 0002-unit-check-for-unneeded-dependencies-even-when-unit-.patch
Patch79: 0001-utmp-remove-unneded-parameters.patch
Patch80: 0002-utmp-no-need-to-zero-a-struct-before-overwriting-it-.patch
Patch81: 0003-utmp-initialize-store-with-the-found-entry-not-with-.patch
Patch82: 0004-utmp-for-DEAD_PROCESS-write-the-current-time-to-wtmp.patch
Patch83: 0001-unit-garbage-collect-units-with-load-error.patch
Patch84: 0001-mount-fix-quota.patch
Patch85: 0001-mount-fix-automount-regression.patch
Patch86: 0001-socket-add-option-for-SO_PASSCRED.patch
Patch87: 0002-shutdownd-use-PassCred-yes-in-the-socket-unit.patch
Patch88: 0003-syslog-use-PassCred-yes-for-the-dev-log-socket.patch
Patch89: 0004-man-document-the-PassCred-option.patch
Patch90: 0001-socket-rename-the-PassCred-option-to-PassCredentials.patch
Patch91: util-add-parse_uid.patch
Patch92: 0001-shutdown-exclude-processes-with-argv-0-0-from-killin.patch
Patch93: 0161-util-never-follow-symlinks-in-rm_rf_children.patch
Patch100: fedora-storage-detect-encrypted-PVs.patch
# For sysvinit tools
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
@ -93,10 +188,12 @@ SysV compatibility tools for systemd
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
set +x
for p in %{patches}; do
echo "Applying $p"
patch -p1 < $p
done
set -x
%build
%configure --with-rootdir= --with-distro=fedora
@ -299,6 +396,81 @@ fi
%{_bindir}/systemd-sysv-convert
%changelog
* Fri Mar 16 2012 Michal Schmidt <mschmidt@redhat.com> - 26-18
- CVE-2012-1174 (#803358)
* Mon Feb 27 2012 Michal Schmidt <mschmidt@redhat.com> - 26-17
- Backport the detection of root storage daemons.
http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
* Tue Jan 31 2012 Michal Schmidt <mschmidt@redhat.com> - 26-16
- Backport PassCredentials to avoid #757628 when F15 kernel is rebased to 3.2.
* Tue Jan 31 2012 Michal Schmidt <mschmidt@redhat.com> - 26-15
- Fix quota (#773431).
* Tue Jan 17 2012 Michal Schmidt <mschmidt@redhat.com> - 26-14
- Slowing down in F15. Only a few fixes for bugs reported against F15:
- StopWhenUnneeded
- wtmp
- gc of units with load error
* Wed Nov 02 2011 Michal Schmidt <mschmidt@redhat.com> - 26-13
- Fix remote-fs-pre.target and its ordering.
- Fixes: BZ#749940
* Wed Oct 19 2011 Michal Schmidt <mschmidt@redhat.com> - 26-12
- Fix a crash in isolating.
- Fixes: BZ#717325
* Wed Oct 12 2011 Michal Schmidt <mschmidt@redhat.com> - 26-11
- Pick a few fixes from upstream v37.
- Including the change to disable main PID guessing for SysV services.
- Loop over %%{patches} in the spec.
- Fixes: BZ#718464, fdo#41336
* Sun Sep 25 2011 Michal Schmidt <mschmidt@redhat.com> - 26-10
- Pick lots of fixes from upstream up to v36.
- A few features added too:
- support more types of virtual serial consoles in getty-generator
- log control via RT signals
- support for LANGUAGE in environment
- show fsck progress on the console
- Fixes: BZ#735013, BZ#722803, BZ#736360, BZ#698198, BZ#710487
- Fixes: fdo39957, fdo39818, fdo40510
* Tue Aug 23 2011 Lennart Poettering <lpoetter@redhat.com> - 26-9
- Fix a couple of bugs (#723892, #726976)
* Fri Jul 08 2011 Michal Schmidt <mschmidt@redhat.com> - 26-8
- Drop the pidfile patch for now. It exposes a bug in sendmail (BZ#719884)
* Wed Jul 06 2011 Michal Schmidt <mschmidt@redhat.com> - 26-7
- Add more fixes from upstream:
- don't trim cgroups on reexec (BZ#678555)
- treat SysV services with "pidfile:" header as real daemons (BZ#702621)
* Mon Jul 04 2011 Michal Schmidt <mschmidt@redhat.com> - 26-6
- Cherry-picked a bunch of upstream patches.
- Fixes: BZ#633774, BZ#708886, BZ#712710, BZ#716663
- Partially fixes: BZ#624149
- other small fixes
* Mon Jun 20 2011 Michal Schmidt <mschmidt@redhat.com> - 26-5
- Temporary workaround to detect LVM VGs on encrypted PVs. (BZ#708684)
* Wed Jun 15 2011 Michal Schmidt <mschmidt@redhat.com> - 26-4
- Pick bugfixes from upstream:
- systemctl: fix 'is-enabled' for native units under /lib (BZ#699027)
- dbus: fix name of capability property
- pam-module: add debug= parameter (BZ#705427)
* Sun Jun 12 2011 Michal Schmidt <mschmidt@redhat.com> - 26-3
- Pick bugfixes from upstream:
- systemctl: fix double unref of a dbus message (BZ#709909)
- cryptsetup-generator: fix /etc/cryptsetup options (BZ#710839)
- readahead-common: fix total memory size detection (BZ#712341)
* Wed May 25 2011 Lennart Poettering <lpoetter@redhat.com> - 26-2
- Bugfix release
- https://bugzilla.redhat.com/show_bug.cgi?id=707507

54
util-add-parse_uid.patch Normal file
View File

@ -0,0 +1,54 @@
util: add parse_uid
Hand-edited by michich from the following upstream patch:
From 034a2a52ac0ec83e0229941d635d310b23eb04df Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 22 Jul 2011 21:01:15 +0200
Subject: [PATCH] sd-login: beef up login api, to add monitoring and
enumerating
---
diff --git a/src/util.c b/src/util.c
index 328a1ea..2d4f229 100644
--- a/src/util.c
+++ b/src/util.c
@@ -317,6 +317,26 @@ int parse_pid(const char *s, pid_t* ret_pid) {
return 0;
}
+int parse_uid(const char *s, uid_t* ret_uid) {
+ unsigned long ul = 0;
+ uid_t uid;
+ int r;
+
+ assert(s);
+ assert(ret_uid);
+
+ if ((r = safe_atolu(s, &ul)) < 0)
+ return r;
+
+ uid = (uid_t) ul;
+
+ if ((unsigned long) uid != ul)
+ return -ERANGE;
+
+ *ret_uid = uid;
+ return 0;
+}
+
int safe_atou(const char *s, unsigned *ret_u) {
char *x = NULL;
unsigned long l;
diff --git a/src/util.h b/src/util.h
index f39c01f..9537d13 100644
--- a/src/util.h
+++ b/src/util.h
@@ -136,6 +136,7 @@ void close_many(const int fds[], unsigned n_fd);
int parse_boolean(const char *v);
int parse_usec(const char *t, usec_t *usec);
int parse_pid(const char *s, pid_t* ret_pid);
+int parse_uid(const char *s, uid_t* ret_uid);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);