Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Oct 2005 08:38:40 GMT
From:      Don Lewis <truckman@FreeBSD.org>
To:        apelisse@gmail.com, truckman@FreeBSD.org, freebsd-bugs@FreeBSD.org, truckman@FreeBSD.org
Subject:   Re: kern/84935: [PATCH] Panic in kern_exec.c: missing lock
Message-ID:  <200510010838.j918ce0p092508@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
Synopsis: [PATCH] Panic in kern_exec.c: missing lock

State-Changed-From-To: open->patched
State-Changed-By: truckman
State-Changed-When: Sat Oct 1 08:34:48 GMT 2005
State-Changed-Why: 
The following patch committed in src/sys/kern/kern_exec.c 1.276:

Index: kern_exec.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.275
diff -u -r1.275 kern_exec.c
--- kern_exec.c	30 Jun 2005 19:01:26 -0000	1.275
+++ kern_exec.c	1 Oct 2005 06:19:48 -0000
@@ -479,8 +479,11 @@
 	newcred = crget();
 	euip = uifind(attr.va_uid);
 	i = imgp->args->begin_envv - imgp->args->begin_argv;
-	if (ps_arg_cache_limit >= i + sizeof(struct pargs))
+	/* Cache arguments if they fit inside our allowance */
+	if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
 		newargs = pargs_alloc(i);
+		bcopy(imgp->args->begin_argv, newargs->ar_args, i);
+	}
 
 	/* close files on exec */
 	fdcloseexec(td);
@@ -661,16 +664,13 @@
 	/* clear "fork but no exec" flag, as we _are_ execing */
 	p->p_acflag &= ~AFORK;
 
-	/* Free any previous argument cache */
+	/*
+	 * Free any previous argument cache and it with
+	 * the new argument cache, if any.
+	 */
 	oldargs = p->p_args;
-	p->p_args = NULL;
-
-	/* Cache arguments if they fit inside our allowance */
-	if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
-		bcopy(imgp->args->begin_argv, newargs->ar_args, i);
-		p->p_args = newargs;
-		newargs = NULL;
-	}
+	p->p_args = newargs;
+	newargs = NULL;
 
 #ifdef	HWPMC_HOOKS
 	/*

This version of the patch has one less PROC_LOCK()/PROC_UNLOCK() pair
and simplifies the p->p_args update logic.


Responsible-Changed-From-To: freebsd-bugs->truckman
Responsible-Changed-By: truckman
Responsible-Changed-When: Sat Oct 1 08:34:48 GMT 2005
Responsible-Changed-Why: 
Changed responsible party to patch committer.

http://www.freebsd.org/cgi/query-pr.cgi?pr=84935



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510010838.j918ce0p092508>