summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-10-11 21:04:01 +0000
committerjhb <jhb@FreeBSD.org>2002-10-11 21:04:01 +0000
commit6d8bd893546cb3ad05b421f7313e2d5fc44240df (patch)
tree060f999b5a9d0c2c11f440871575ea5af991c3cf /sys/kern/kern_exec.c
parent1a10e2f35a4be7790f519238f8b6491bea83d6f2 (diff)
downloadFreeBSD-src-6d8bd893546cb3ad05b421f7313e2d5fc44240df.zip
FreeBSD-src-6d8bd893546cb3ad05b421f7313e2d5fc44240df.tar.gz
- 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
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 784ed5c..0e5c94c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -469,9 +469,9 @@ interpret:
PROC_UNLOCK(p);
setugidsafety(td);
error = fdcheckstd(td);
- PROC_LOCK(p);
if (error != 0)
goto done1;
+ PROC_LOCK(p);
/*
* Set the new credentials.
*/
@@ -543,24 +543,23 @@ interpret:
oldargs = p->p_args;
p->p_args = NULL;
- /* Set values passed into the program in registers. */
- if (p->p_sysent->sv_setregs)
- (*p->p_sysent->sv_setregs)(td, imgp->entry_addr,
- (u_long)(uintptr_t)stack_base, imgp->ps_strings);
- else
- 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);
+ /* Set values passed into the program in registers. */
+ if (p->p_sysent->sv_setregs)
+ (*p->p_sysent->sv_setregs)(td, imgp->entry_addr,
+ (u_long)(uintptr_t)stack_base, imgp->ps_strings);
+ else
+ exec_setregs(td, imgp->entry_addr,
+ (u_long)(uintptr_t)stack_base, imgp->ps_strings);
+done1:
/*
* Free any resources malloc'd earlier that we didn't use.
*/
OpenPOWER on IntegriCloud