summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-07-14 17:58:35 +0000
committeralc <alc@FreeBSD.org>2002-07-14 17:58:35 +0000
commit136c0ea4b28e10a8ac21890ca3efe6b268d18d1e (patch)
treec6de880c21f1704463ca87dcca73469d9745d9df /sys/kern/kern_exec.c
parentb7f8470fdfa178fefb93ecb7ba7ee667ea16704c (diff)
downloadFreeBSD-src-136c0ea4b28e10a8ac21890ca3efe6b268d18d1e.zip
FreeBSD-src-136c0ea4b28e10a8ac21890ca3efe6b268d18d1e.tar.gz
In execve(), delay the acquisition of Giant until after kmem_alloc_wait().
(Operations on the exec_map don't require Giant.)
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 9e0a18f..c7df555 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -155,13 +155,11 @@ execve(td, uap)
* that might allow a local user to illicitly obtain elevated
* privileges.
*/
- mtx_lock(&Giant);
PROC_LOCK(p);
KASSERT((p->p_flag & P_INEXEC) == 0,
("%s(): process already has P_INEXEC flag", __func__));
if ((p->p_flag & P_KSES) && thread_single(SNGLE_EXIT)) {
PROC_UNLOCK(p);
- mtx_unlock(&Giant);
return (ERESTART); /* Try again later. */
}
/* If we get here all other threads are dead. */
@@ -194,6 +192,7 @@ execve(td, uap)
imgp->stringbase = (char *)kmem_alloc_wait(exec_map, ARG_MAX + PAGE_SIZE);
if (imgp->stringbase == NULL) {
error = ENOMEM;
+ mtx_lock(&Giant);
goto exec_fail;
}
imgp->stringp = imgp->stringbase;
@@ -208,6 +207,7 @@ execve(td, uap)
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME,
UIO_USERSPACE, uap->fname, td);
+ mtx_lock(&Giant);
interpret:
error = namei(ndp);
OpenPOWER on IntegriCloud