[Pkg-sysvinit-commits] r1373 - in sysvinit/trunk/debian: . patches
Petter Reinholdtsen
pere at alioth.debian.org
Mon Jul 6 17:04:33 UTC 2009
Author: pere
Date: 2009-07-06 17:04:31 +0000 (Mon, 06 Jul 2009)
New Revision: 1373
Added:
sysvinit/trunk/debian/patches/85_killall_safecwd.dpatch
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/patches/00list
Log:
New patch 85_killall_safecwd to chdir to /proc before stopping and
killing processes, to avoid deadlock if / is a fuse file system.
Patch from Goswin von Brederlow, fixing part of 476698.
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2009-07-06 15:56:03 UTC (rev 1372)
+++ sysvinit/trunk/debian/changelog 2009-07-06 17:04:31 UTC (rev 1373)
@@ -13,6 +13,9 @@
on patch from Martin Pitt and Ubuntu. Modified Ubuntu patch to
keep the generic splash support when usplash is not used.
* Avoid bashism in service(8) (Closes: #535883).
+ * New patch 85_killall_safecwd to chdir to /proc before stopping and
+ killing processes, to avoid deadlock if / is a fuse file system.
+ Patch from Goswin von Brederlow, fixing part of 476698.
-- Petter Reinholdtsen <pere at debian.org> Wed, 01 Jul 2009 20:04:20 +0200
Modified: sysvinit/trunk/debian/patches/00list
===================================================================
--- sysvinit/trunk/debian/patches/00list 2009-07-06 15:56:03 UTC (rev 1372)
+++ sysvinit/trunk/debian/patches/00list 2009-07-06 17:04:31 UTC (rev 1373)
@@ -39,6 +39,7 @@
82_killall_exclude_pids
83_killall_manref
84_killall_fuse
+85_killall_safecwd
90_shutdown_H
91_sulogin_lockedpw
92_sata-hddown
Added: sysvinit/trunk/debian/patches/85_killall_safecwd.dpatch
===================================================================
--- sysvinit/trunk/debian/patches/85_killall_safecwd.dpatch (rev 0)
+++ sysvinit/trunk/debian/patches/85_killall_safecwd.dpatch 2009-07-06 17:04:31 UTC (rev 1373)
@@ -0,0 +1,75 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 85_killall_safecwd.dpatch by Goswin von Brederlow.
+
+Goal:
+ Avoid deadlocks with fuse filesystems.
+
+ After stopping all processes all filesystem access must be relative
+ and restricted to /proc/.
+
+Fixes: part of #476698
+Status wrt upstream: Should be sent upstream. Not done yet.
+
+ at DPATCH@
+diff -urNad sysvinit-2.86.ds1~/src/killall5.c sysvinit-2.86.ds1/src/killall5.c
+--- sysvinit-2.86.ds1~/src/killall5.c 2008-05-26 16:07:00.309320829 +0200
++++ sysvinit-2.86.ds1/src/killall5.c 2008-05-26 16:07:00.585275811 +0200
+@@ -168,6 +168,7 @@
+
+ /*
+ * Read the proc filesystem.
++ * CWD must be /proc to avoid problems if / is affected by the killing (ie depend on fuse).
+ */
+ int readproc(int do_stat)
+ {
+@@ -183,7 +184,7 @@
+ int pid, f;
+
+ /* Open the /proc directory. */
+- if ((dir = opendir("/proc")) == NULL) {
++ if ((dir = opendir(".")) == NULL) {
+ nsyslog(LOG_ERR, "cannot opendir(/proc)");
+ return -1;
+ }
+@@ -209,10 +210,10 @@
+ memset(p, 0, sizeof(PROC));
+
+ /* Open the status file. */
+- snprintf(path, sizeof(path), "/proc/%s/stat", d->d_name);
++ snprintf(path, sizeof(path), "%s/stat", d->d_name);
+
+ /* Read SID & statname from it. */
+- if ((fp = fopen(path, "r")) != NULL) {
++ if ((fp = fopen(path, "r")) != NULL) {
+ buf[0] = 0;
+ fgets(buf, sizeof(buf), fp);
+
+@@ -226,7 +227,7 @@
+ if (q == NULL) {
+ p->sid = 0;
+ nsyslog(LOG_ERR,
+- "can't get program name from %s\n",
++ "can't get program name from /proc/%s\n",
+ path);
+ free(p);
+ continue;
+@@ -263,7 +264,7 @@
+ continue;
+ }
+
+- snprintf(path, sizeof(path), "/proc/%s/cmdline", d->d_name);
++ snprintf(path, sizeof(path), "%s/cmdline", d->d_name);
+ if ((fp = fopen(path, "r")) != NULL) {
+
+ /* Now read argv[0] */
+@@ -646,6 +647,10 @@
+
+ /* First get the /proc filesystem online. */
+ mount_proc();
++ if (chdir("/proc") == -1) {
++ nsyslog(LOG_ERR, "chdir /proc failed");
++ return(1);
++ }
+
+ /*
+ * Ignoring SIGKILL and SIGSTOP do not make sense, but
More information about the Pkg-sysvinit-commits
mailing list