Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 2002 10:23:52 -0700
From:      Alfred Perlstein <bright@mu.org>
To:        Don Lewis <dl-freebsd@catspoiler.org>
Cc:        jhb@freebsd.org, hackers@freebsd.org
Subject:   Re: Suggested fixes for uidinfo "would sleep" messages
Message-ID:  <20020619172352.GH85935@elvis.mu.org>
In-Reply-To: <20020619172107.GF85935@elvis.mu.org>
References:  <20020619061332.GA85935@elvis.mu.org> <200206190810.g5J8AKM1065115@gw.catspoiler.org> <20020619172107.GF85935@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Alfred Perlstein <bright@mu.org> [020619 10:22] wrote:
> re execve() issues...
> 
> * Don Lewis <dl-freebsd@catspoiler.org> [020619 01:10] wrote:
> > On 18 Jun, Alfred Perlstein wrote:
> > > Thanks a ton for taking care of it, your patch is actually cleaner
> > > than what I had started on, I'll be committing it shortly.
> > 
> > While you're working in this area, take a look at execve().  If the
> > fdcheckstd() test fails, we leak ucred and uidinfo structures, and also
> > leave the proc locked.  The fix is pretty straightforward.
> 
> I'm a bit confused actually, it looks like just unlocking the proc
> and then moving the 'exec_fail_dealloc' label higher would fix it,
> except I'm not sure about the:
> 
>         /*
>          * Handle deferred decrement of ref counts.
>          */
>         if (textvp != NULL)
>                 vrele(textvp);
> #ifdef KTRACE
>         if (tracevp != NULL)
>                 vrele(tracevp);
> #endif
>         pargs_drop(oldargs);
> 
> part... should that be before or after exec_fail_dealloc?
> 
> Any ideas?

This is what I have so far, I'll look at it more, but I'm a bit
cafinated and irritated (at other things) at the current moment.
:)

Index: kern_exec.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.165
diff -u -r1.165 kern_exec.c
--- kern_exec.c	19 Jun 2002 06:39:24 -0000	1.165
+++ kern_exec.c	19 Jun 2002 17:18:32 -0000
@@ -385,8 +385,10 @@
 #endif
 		/* Make sure file descriptors 0..2 are in use.  */
 		error = fdcheckstd(td);
-		if (error != 0)
+		if (error != 0) {
+			PROC_UNLOCK(p);
 			goto exec_fail_dealloc;
+		}
 		/*
 		 * Set the new credentials.
 		 */
@@ -471,6 +473,8 @@
 	}
 	PROC_UNLOCK(p);
 
+exec_fail_dealloc:
+
 	/*
 	 * Free any resources malloc'd earlier that we didn't use.
 	 */
@@ -490,8 +494,6 @@
 		vrele(tracevp);
 #endif
 	pargs_drop(oldargs);
-
-exec_fail_dealloc:
 
 	/*
 	 * free various allocated resources

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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