Close a possible bug where the p_lock for a new process inherits a
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 19 Dec 2008 04:20:15 +0000 (20:20 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 19 Dec 2008 04:20:15 +0000 (20:20 -0800)
non-zero value from its parent on fork(), preventing the process
from being able to exit later on.

sys/kern/kern_fork.c

index 5fc6391..ed60299 100644 (file)
@@ -372,6 +372,9 @@ fork1(struct lwp *lp1, int flags, struct proc **procp)
        if (p1->p_flag & P_PROFIL)
                startprofclock(p2);
        p2->p_ucred = crhold(p1->p_ucred);
+       if (p2->p_lock)
+               kprintf("Debug: p_lock race averted\n");
+       p2->p_lock = 0;
 
        if (jailed(p2->p_ucred))
                p2->p_flag |= P_JAILED;