From 3ace9e38834072a6fd9fc633851c02386a38dd3d9dd5da7fd958f89cad572e14 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 11 Mar 2009 20:39:53 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysvinit?expand=0&rev=39 --- killproc-2.14.dif | 32 ++++++++++++++++++++++++++++++++ sysvinit-2.86-nfs4pidof.patch | 35 ++++++++++++++++++++--------------- sysvinit.changes | 12 ++++++++++++ sysvinit.spec | 12 +++++++++--- 4 files changed, 73 insertions(+), 18 deletions(-) create mode 100644 killproc-2.14.dif diff --git a/killproc-2.14.dif b/killproc-2.14.dif new file mode 100644 index 0000000..f2dc836 --- /dev/null +++ b/killproc-2.14.dif @@ -0,0 +1,32 @@ +--- libinit.h ++++ libinit.h 2009-03-10 13:06:32.512001779 +0100 +@@ -46,7 +46,7 @@ + # define restrict __restrict__ + # endif + #endif +-#define alignof(type) (sizeof(type)+(sizeof(type)%sizeof(void*))) ++#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1)) + + /* + * LSB specs: +--- mkill.c ++++ mkill.c 2009-03-11 14:37:13.668001801 +0100 +@@ -525,6 +525,7 @@ static void sort_proc(void) + + static int check(const char *restrict name) + { ++ const size_t nlen = strlen(name); + mntent_t *p, *n, *l; + + n = mntent; +@@ -532,6 +533,10 @@ static int check(const char *restrict na + for (p = mntent; n; p = n) { + l = p->prev; + n = p->next; ++ if (nlen < p->nlen) ++ continue; ++ if (name[p->nlen] != '\0' && name[p->nlen] != '/') ++ continue; + if (strncmp(name, p->name, p->nlen) == 0) + return p->order; + } diff --git a/sysvinit-2.86-nfs4pidof.patch b/sysvinit-2.86-nfs4pidof.patch index 42ed040..212e0fa 100644 --- a/sysvinit-2.86-nfs4pidof.patch +++ b/sysvinit-2.86-nfs4pidof.patch @@ -1,5 +1,5 @@ --- src/killall5.c -+++ src/killall5.c 2008-10-01 16:42:51.186708662 +0200 ++++ src/killall5.c 2009-03-11 14:13:21.708001809 +0100 @@ -40,6 +40,8 @@ #include #include @@ -40,7 +40,7 @@ /* Did we stop all processes ? */ int sent_sigstop; -@@ -152,6 +166,111 @@ int mount_proc(void) +@@ -152,6 +166,116 @@ int mount_proc(void) return did_mount; } @@ -135,12 +135,17 @@ + if (real) strcpy(real, curr); + + if (errno == EINVAL) { ++ const size_t nlen = strlen(curr); + NFS *p, *n, *l; + n = nlist; + l = (NFS*)0; + for (p = nlist; n; p = n) { + l = p->prev; + n = p->next; ++ if (nlen < p->nlen) ++ continue; ++ if (curr[p->nlen] != '\0' && curr[p->nlen] != '/') ++ continue; + if (!strncmp(curr, p->name, p->nlen)) + return 1; + } @@ -152,7 +157,7 @@ int readarg(FILE *fp, char *buf, int sz) { int c = 0, f = 0; -@@ -173,8 +292,8 @@ int readproc() +@@ -173,8 +297,8 @@ int readproc() PROC *p, *n; struct dirent *d; struct stat st; @@ -163,7 +168,7 @@ char *s, *q; unsigned long startcode, endcode; int pid, f; -@@ -191,6 +310,7 @@ int readproc() +@@ -191,6 +315,7 @@ int readproc() n = p->next; if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); @@ -171,7 +176,7 @@ free(p); } plist = NULL; -@@ -225,6 +345,9 @@ int readproc() +@@ -225,6 +350,9 @@ int readproc() nsyslog(LOG_ERR, "can't get program name from %s\n", path); @@ -181,7 +186,7 @@ free(p); continue; } -@@ -248,6 +371,9 @@ int readproc() +@@ -248,6 +376,9 @@ int readproc() p->sid = 0; nsyslog(LOG_ERR, "can't read sid from %s\n", path); @@ -191,7 +196,7 @@ free(p); continue; } -@@ -256,6 +382,9 @@ int readproc() +@@ -256,6 +387,9 @@ int readproc() fclose(fp); } else { /* Process disappeared.. */ @@ -201,7 +206,7 @@ free(p); continue; } -@@ -300,13 +429,18 @@ int readproc() +@@ -300,13 +434,18 @@ int readproc() } else { /* Process disappeared.. */ @@ -221,7 +226,7 @@ p->dev = st.st_dev; p->ino = st.st_ino; } -@@ -374,12 +508,25 @@ PIDQ_HEAD *pidof(char *prog) +@@ -374,12 +513,25 @@ PIDQ_HEAD *pidof(char *prog) PIDQ_HEAD *q; struct stat st; char *s; @@ -248,7 +253,7 @@ /* Get basename of program. */ if ((s = strrchr(prog, '/')) == NULL) -@@ -393,10 +540,30 @@ PIDQ_HEAD *pidof(char *prog) +@@ -393,10 +545,30 @@ PIDQ_HEAD *pidof(char *prog) /* First try to find a match based on dev/ino pair. */ if (dostat) { for (p = plist; p; p = p->next) { @@ -283,7 +288,7 @@ } } -@@ -428,7 +595,7 @@ PIDQ_HEAD *pidof(char *prog) +@@ -428,7 +600,7 @@ PIDQ_HEAD *pidof(char *prog) if (ok) add_pid_to_q(q, p); } @@ -292,7 +297,7 @@ } /* Give usage message and exit. */ -@@ -477,6 +644,9 @@ int main_pidof(int argc, char **argv) +@@ -477,6 +649,9 @@ int main_pidof(int argc, char **argv) int first = 1; int i, oind, opt, flags = 0; @@ -302,7 +307,7 @@ for (oind = PIDOF_OMITSZ-1; oind > 0; oind--) opid[oind] = 0; opterr = 0; -@@ -561,6 +731,7 @@ int main(int argc, char **argv) +@@ -561,6 +736,7 @@ int main(int argc, char **argv) PROC *p; int pid, sid = -1; int sig = SIGKILL; @@ -310,7 +315,7 @@ /* Get program name. */ if ((progname = strrchr(argv[0], '/')) == NULL) -@@ -583,7 +754,10 @@ int main(int argc, char **argv) +@@ -583,7 +759,10 @@ int main(int argc, char **argv) } /* First get the /proc filesystem online. */ @@ -322,7 +327,7 @@ /* * Ignoring SIGKILL and SIGSTOP do not make sense, but -@@ -608,9 +782,13 @@ int main(int argc, char **argv) +@@ -608,9 +787,13 @@ int main(int argc, char **argv) /* Now kill all processes except our session. */ sid = (int)getsid(0); pid = (int)getpid(); diff --git a/sysvinit.changes b/sysvinit.changes index e413f6c..fc59ff8 100644 --- a/sysvinit.changes +++ b/sysvinit.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Wed Mar 11 14:24:06 CET 2009 - werner@suse.de + +- nfs4pidof: make sure not to stumble on short named mount points + to avoid to terminate processes on wrong mount points + +------------------------------------------------------------------- +Tue Mar 10 13:12:16 CET 2009 - werner@suse.de + +- mkill: make sure not to stumble on short named mount points to + avoid to terminate processes on wrong mount points (bnc#466484) + ------------------------------------------------------------------- Mon Mar 9 13:54:55 CET 2009 - werner@suse.de diff --git a/sysvinit.spec b/sysvinit.spec index 9cd369d..dd932af 100644 --- a/sysvinit.spec +++ b/sysvinit.spec @@ -30,7 +30,7 @@ Group: System/Base PreReq: coreutils AutoReqProv: on Version: 2.86 -Release: 198 +Release: 199 Summary: SysV-Style init BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libselinux-devel libsepol-devel @@ -47,7 +47,7 @@ Source10: mkinitrd-kill2.sh Patch: sysvinit-2.86.dif Patch1: sysvinit-2.86-nfs4pidof.patch Patch2: powerd-2.0.2.dif -#Patch3: killproc-2.14.dif +Patch3: killproc-2.14.dif Patch5: sysvinit-2.86-sulogin.patch Patch6: sysvinit-2.82-startstop.patch Patch7: sysvinit-2.85-suse.patch @@ -103,7 +103,7 @@ pushd ../powerd-%{PDVER} %patch -P 2 popd pushd ../killproc-%{KPVER} -#%patch -P 3 +%patch -P 3 popd pushd ../showconsole-%{SCVER} %patch -P 10 @@ -323,6 +323,12 @@ rm -rf ${RPM_BUILD_ROOT} %doc %{_mandir}/man8/mkill.8.gz %changelog +* Wed Mar 11 2009 werner@suse.de +- nfs4pidof: make sure not to stumble on short named mount points + to avoid to terminate processes on wrong mount points +* Tue Mar 10 2009 werner@suse.de +- mkill: make sure not to stumble on short named mount points to + avoid to terminate processes on wrong mount points (bnc#466484) * Mon Mar 09 2009 werner@suse.de - Add patch from Debian people to startpar and mode to version 0.53 * Thu Mar 05 2009 werner@suse.de