NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/50300: Issue with updating p_nstopchild count



>Number:         50300
>Category:       kern
>Synopsis:       p_nstopchild count not being correctly updated
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 05 02:25:00 +0000 2015
>Originator:     paul%whooppee.com@localhost
>Release:        NetBSD 7.99.21
>Organization:
+------------------+--------------------------+-------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
+------------------+--------------------------+-------------------------+
>Environment:
	
	
System: NetBSD pokey.whooppee.com 7.99.21 NetBSD 7.99.21 (POKEY 2015-09-20 02:09:58) #0: Sun Sep 20 14:01:44 PHT 2015 paul%pokey.whooppee.com@localhost:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/POKEY amd64
Architecture: x86_64
Machine: amd64
>Description:
In sys/kern/kern_exit.c routine exit1() ...

At line 492 we mark the exiting process as SDEAD, and increment the parent's
p_nstopchild count.  Then we make sure that the process is at the head of
the p_children list.

Now if the parent has decided not to wait for the child, we re-parent the
process to init.

At lines 964-965, proc_reparent() adjusts the p_nstopchild counts for the
old and new parents.  But it only does it for processes that are SZOMB or
SSTOP.  That doesn't help for this process, since it is still SDEAD.

>How-To-Repeat:
Unknown - found by code inspection
>Fix:
It seems to me that the check at line 962 should include SDEAD as well as
SZOMB
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_exit.c,v
retrieving revision 1.245
diff -u -p -r1.245 kern_exit.c
--- kern_exit.c 2 Oct 2015 16:54:15 -0000       1.245
+++ kern_exit.c 5 Oct 2015 02:12:19 -0000
@@ -959,7 +959,7 @@ proc_reparent(struct proc *child, struct
 	if (child->p_pptr == parent)
 		return;
 
-	if (child->p_stat == SZOMB ||
+	if (child->p_stat == SZOMB || child->p_stat == SDEAD ||
 	    (child->p_stat == SSTOP && !child->p_waited)) {
 		child->p_pptr->p_nstopchild--;
 		parent->p_nstopchild++;

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index