summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 4d2a7fe..d4508c6 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -253,12 +253,14 @@ kern_execve(td, fname, argv, envv, mac_p)
* 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_SA || p->p_numthreads > 1) {
if (thread_single(SINGLE_EXIT)) {
PROC_UNLOCK(p);
+ mtx_unlock(&Giant);
return (ERESTART); /* Try again later. */
}
/*
@@ -269,6 +271,7 @@ kern_execve(td, fname, argv, envv, mac_p)
td->td_mailbox = NULL;
thread_single_end();
}
+ mtx_unlock(&Giant);
p->p_flag |= P_INEXEC;
PROC_UNLOCK(p);
OpenPOWER on IntegriCloud