- Move the 'done1' label down below the unlock of the proc lock and move

the locking of the proc lock after the goto to done1 to avoid locking
  the lock in an error case just so we can turn around and unlock it.
- Move the exec_setregs() stuff out from under the proc lock and after
  the p_args stuff.  This allows exec_setregs() to be able to sleep or
  write things out to userland, etc. which ia64 does.

Tested by:	peter
This commit is contained in:
John Baldwin 2002-10-11 21:04:01 +00:00
parent 8523987b73
commit e1b1aa3bc2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104937

View File

@ -469,9 +469,9 @@ execve(td, uap)
PROC_UNLOCK(p);
setugidsafety(td);
error = fdcheckstd(td);
PROC_LOCK(p);
if (error != 0)
goto done1;
PROC_LOCK(p);
/*
* Set the new credentials.
*/
@ -543,6 +543,14 @@ execve(td, uap)
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->stringbase, newargs->ar_args, i);
p->p_args = newargs;
newargs = NULL;
}
PROC_UNLOCK(p);
/* Set values passed into the program in registers. */
if (p->p_sysent->sv_setregs)
(*p->p_sysent->sv_setregs)(td, imgp->entry_addr,
@ -551,16 +559,7 @@ execve(td, uap)
exec_setregs(td, imgp->entry_addr,
(u_long)(uintptr_t)stack_base, imgp->ps_strings);
/* Cache arguments if they fit inside our allowance */
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
bcopy(imgp->stringbase, newargs->ar_args, i);
p->p_args = newargs;
newargs = NULL;
}
done1:
PROC_UNLOCK(p);
/*
* Free any resources malloc'd earlier that we didn't use.
*/