SHA256
1
0
forked from pool/systemd

Accepting request 89336 from home:fcrozat:systemd

- Add avoid-random-seed-cycle.patch: fix dependency cycle between
  cryptsetup and random-seed-load (bnc#721666).
- Add crash-isolating.patch: fix crash when isolating a service.
- Fix bootsplash being killed too early.
- Fix some manpages not being redirected properly.
- Add storage-after-cryptsetup.service to restart lvm after
  cryptsetup. Fixes lvm on top of LUKS (bnc#724238).

- Add avoid-random-seed-cycle.patch: fix dependency cycle between
  cryptsetup and random-seed-load (bnc#721666).
- Add crash-isolating.patch: fix crash when isolating a service.
- Fix bootsplash being killed too early.
- Fix some manpages not being redirected properly.
- Add storage-after-cryptsetup.service to restart lvm after
  cryptsetup. Fixes lvm on top of LUKS (bnc#724238).

OBS-URL: https://build.opensuse.org/request/show/89336
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=219
This commit is contained in:
Frederic Crozat 2011-10-26 08:14:55 +00:00 committed by Git OBS Bridge
parent 1962b7c419
commit f02af58b62
8 changed files with 213 additions and 1 deletions

View File

@ -0,0 +1,40 @@
Devices with random keys (swap), should not be ordered before local-fs.target,
as this creates a cycle with systemd-load-random-seed.service (and also it
does not make sense, a swap device is not a local-fs).
---
src/cryptsetup-generator.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/cryptsetup-generator.c b/src/cryptsetup-generator.c
index 6f3aa78..a48b7a4 100644
--- a/src/cryptsetup-generator.c
+++ b/src/cryptsetup-generator.c
@@ -112,8 +112,7 @@ 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=local-fs.target\n",
+ "Before=umount.target\n",
d, d);
if (!nofail)
@@ -125,6 +124,9 @@ static int create_disk(
streq(password, "/dev/hw_random")))
fprintf(f,
"After=systemd-random-seed-load.service\n");
+ else
+ fprintf(f,
+ "Before=local-fs.target\n");
fprintf(f,
"\n[Service]\n"
--
1.7.7
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

View File

@ -1,6 +1,7 @@
[Unit]
Description=Terminate bootsplash
After=xdm.service rc-local.service bootsplash-startup.service
Before=getty@tty1.service
DefaultDependencies=no
Names=plymout-quit-wait.service

117
crash-isolating.patch Normal file
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] 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.3.4

View File

@ -0,0 +1,12 @@
[Unit]
Description=Restart storage after crypsetup
DefaultDependencies=no
Before=local-fs.target shutdown.target
After=cryptsetup.target
Wants=cryptsetup.target
[Service]
RemainAfterExit=true
Type=oneshot
TimeoutSec=0
ExecStart=/bin/systemctl restart lvm.service

View File

@ -3,6 +3,17 @@
export RUNLEVEL=$1
export PREVLEVEL=N
if [ "$1" == "5" ]; then
/bin/systemctl status --no-pager default.target | grep -q graphical.target
if [ $? -eq 0 ]; then
declare -i timeout
timeout=0
console=`fgconsole`
while [ $console -eq 1 -a $timeout -lt 30 ] ; do
sleep 1
timeout+=1
console=`fgconsole`
done
fi
splashtrigger "rlreached $1"
else
splashtrigger "rlchange $1"

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Oct 19 13:18:54 UTC 2011 - fcrozat@suse.com
- Add avoid-random-seed-cycle.patch: fix dependency cycle between
cryptsetup and random-seed-load (bnc#721666).
- Add crash-isolating.patch: fix crash when isolating a service.
- Fix bootsplash being killed too early.
- Fix some manpages not being redirected properly.
- Add storage-after-cryptsetup.service to restart lvm after
cryptsetup. Fixes lvm on top of LUKS (bnc#724238).
-------------------------------------------------------------------
Fri Oct 14 13:07:07 UTC 2011 - fcrozat@suse.com

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Oct 19 13:18:54 UTC 2011 - fcrozat@suse.com
- Add avoid-random-seed-cycle.patch: fix dependency cycle between
cryptsetup and random-seed-load (bnc#721666).
- Add crash-isolating.patch: fix crash when isolating a service.
- Fix bootsplash being killed too early.
- Fix some manpages not being redirected properly.
- Add storage-after-cryptsetup.service to restart lvm after
cryptsetup. Fixes lvm on top of LUKS (bnc#724238).
-------------------------------------------------------------------
Fri Oct 14 13:07:07 UTC 2011 - fcrozat@suse.com

View File

@ -61,6 +61,7 @@ Source7: systemd-bootsplash
Source8: bootsplash-startup.service
Source9: bootsplash-quit.service
Source10: bootsplash-shutdown.service
Source11: storage-after-cryptsetup.service
Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch
# handle SUSE specific kbd settings
Patch6: 0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch
@ -72,11 +73,13 @@ Patch15: support-sysvinit.patch
Patch16: modules_on_boot.patch
Patch17: private_tmp_crash.patch
Patch18: systemctl-completion-fix.patch
Patch19: avoid-random-seed-cycle.patch
# Upstream First - Policy:
# Never add any patches to this package without the upstream commit id
# in the patch. Any patches added here without a very good reason to make
# an exception will be silently removed with the next version update.
Patch20: crash-isolating.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -129,6 +132,8 @@ Plymouth integration for systemd
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%build
autoreconf -fiv
@ -147,6 +152,9 @@ make %{?_smp_mflags}
%install
%makeinstall
#fix manpages
sed -i -e 's,^\(\.so \)\(.*\.\)\([0-9]\),\1man\3/\2\3,g' %{buildroot}/%{_mandir}/*/*
#workaround for 716939
chmod 644 %{buildroot}%{_bindir}/systemd-analyze
mkdir -p %{buildroot}%{_sysconfdir}/rpm
@ -157,11 +165,12 @@ install -m755 %{S:3} -D %{buildroot}%{_sbindir}/systemd-sysv-convert
# do not install, code has been fixed, might be useful in the future
#install -m755 %{S:5} %{buildroot}/lib/systemd/system-generators
install -m755 %{S:7} %{buildroot}/lib/systemd/
install -m644 %{S:8} %{S:9} %{S:10} %{buildroot}/lib/systemd/system/
install -m644 %{S:8} %{S:9} %{S:10} %{S:11} %{buildroot}/lib/systemd/system/
ln -s ../bootsplash-startup.service %{buildroot}/lib/systemd/system/basic.target.wants/
ln -s ../bootsplash-quit.service %{buildroot}/lib/systemd/system/multi-user.target.wants/
ln -s ../bootsplash-shutdown.service %{buildroot}/lib/systemd/system/shutdown.target.wants/
ln -s ../bootsplash-shutdown.service %{buildroot}/lib/systemd/system/reboot.target.wants/
ln -s ../storage-after-cryptsetup.service %{buildroot}/lib/systemd/system/local-fs.target.wants/
ln -s ../bin/systemd %{buildroot}/sbin/init
ln -s ../bin/systemctl %{buildroot}/sbin/reboot
ln -s ../bin/systemctl %{buildroot}/sbin/halt