Hi Alan,

Rod's init version (from RH 7.0) doesn't reap children that died before
it was started. Is that an init bug or should the kernel reap them
before the execve?
The attached patch reaps all zombies before the execve("/sbin/init").

I also found a bug in kernel/context.c: it doesn't acquire the sigmask
spinlock around the call to recalc_sigpending.

Rod Stewart wrote:
> 
> Yes, that fixes my problem.  No more defunct eth? processes when IP_PNP is
> compiled in.  With the fix you said to the patch; replacing curtask with
> current.
>
Fortunately you don't use SMP - spin_lock_irq();...;spin_lock_irq()
instead of spin_lock_irq();...;spin_unlock_irq();

--
        Manfred
// $Header$
// Kernel Version:
//  VERSION = 2
//  PATCHLEVEL = 4
//  SUBLEVEL = 3
//  EXTRAVERSION = -ac3
--- 2.4/init/main.c     Sat Apr  7 22:02:27 2001
+++ build-2.4/init/main.c       Sat Apr 14 19:18:34 2001
@@ -883,6 +883,13 @@
 
        (void) dup(0);
        (void) dup(0);
+
+       while (waitpid(-1, (unsigned int *)0, __WALL|WNOHANG) > 0)
+               ;
+       spin_lock_irq(&current->sigmask_lock);
+       flush_signals(current);
+       recalc_sigpending(current);
+       spin_unlock_irq(&current->sigmask_lock);
        
        /*
         * We try each of these until one succeeds.
--- 2.4/kernel/context.c        Fri Feb  2 15:20:37 2001
+++ build-2.4/kernel/context.c  Sat Apr 14 19:09:10 2001
@@ -101,8 +101,10 @@
                if (signal_pending(curtask)) {
                        while (waitpid(-1, (unsigned int *)0, __WALL|WNOHANG) > 0)
                                ;
+                       spin_lock_irq(&curtask->sigmask_lock);
                        flush_signals(curtask);
                        recalc_sigpending(curtask);
+                       spin_unlock_irq(&curtask->sigmask_lock);
                }
        }
 }


Reply via email to