NetBSD-Bugs archive

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

Re: PR/53998 CVS commit: src/sys/kern



On Feb 23,  6:55pm, joel.bertrand%systella.fr@localhost (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) wrote:
-- Subject: Re: PR/53998 CVS commit: src/sys/kern

The problem is that p_nsems is zeroed out on fork so we end up with negative
counts when we close on the child (which are interpreted as overflow). The
following patch moves p_nsems to the copy part of struct proc.

christos

Index: proc.h
===================================================================
RCS file: /cvsroot/src/sys/sys/proc.h,v
retrieving revision 1.350
diff -u -p -u -r1.350 proc.h
--- proc.h	5 Dec 2018 18:16:51 -0000	1.350
+++ proc.h	24 Feb 2019 04:56:30 -0000
@@ -316,7 +316,6 @@ struct proc {
 	pid_t 		p_vfpid_done;	/* :: vforked done pid */
 	lwpid_t		p_lwp_created;	/* :: lwp created */
 	lwpid_t		p_lwp_exited;	/* :: lwp exited */
-	u_int		p_nsems;	/* Count of semaphores */
 	char		*p_path;	/* :: full pathname of executable */
 
 /*
@@ -338,7 +337,7 @@ struct proc {
 
 	vaddr_t		p_psstrp;	/* :: address of process's ps_strings */
 	u_int		p_pax;		/* :: PAX flags */
-
+	u_int		p_nsems;	/* Count of semaphores */
 	int		p_xexit;	/* p: exit code */
 /*
  * End area that is copied on creation


Home | Main Index | Thread Index | Old Index