From owner-freebsd-hackers Wed Jun 19 10:24: 0 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id E971E37B408; Wed, 19 Jun 2002 10:23:52 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id A6DE4AE027; Wed, 19 Jun 2002 10:23:52 -0700 (PDT) Date: Wed, 19 Jun 2002 10:23:52 -0700 From: Alfred Perlstein To: Don Lewis Cc: jhb@freebsd.org, hackers@freebsd.org Subject: Re: Suggested fixes for uidinfo "would sleep" messages Message-ID: <20020619172352.GH85935@elvis.mu.org> References: <20020619061332.GA85935@elvis.mu.org> <200206190810.g5J8AKM1065115@gw.catspoiler.org> <20020619172107.GF85935@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020619172107.GF85935@elvis.mu.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Alfred Perlstein [020619 10:22] wrote: > re execve() issues... > > * Don Lewis [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