diff options
| -rw-r--r-- | sys/kern/kern_exec.c | 20 | ||||
| -rw-r--r-- | sys/sys/imgact.h | 1 |
2 files changed, 17 insertions, 4 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 7c25dc60960d..15570eee4c37 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -441,6 +441,21 @@ execve_unblock(struct thread *td, struct proc *p) } } +void +execve_block_pass(struct thread *td) +{ + struct proc *p; + + MPASS(td == curthread); + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + while (p->p_execblock != 0) { + p->p_flag |= P_INEXEC_WAIT; + msleep(&p->p_execblock, &p->p_mtx, 0, "exeblk", 0); + } +} + /* * In-kernel implementation of execve(). All arguments are assumed to be * userspace pointers from the passed thread. @@ -496,10 +511,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, PROC_LOCK(p); KASSERT((p->p_flag & P_INEXEC) == 0, ("%s(): process already has P_INEXEC flag", __func__)); - while (p->p_execblock != 0) { - p->p_flag |= P_INEXEC_WAIT; - msleep(&p->p_execblock, &p->p_mtx, 0, "exeblk", 0); - } + execve_block_pass(td); p->p_flag |= P_INEXEC; PROC_UNLOCK(p); diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index dbb76a1d9b93..bf0453beec1f 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -127,6 +127,7 @@ void post_execve(struct thread *td, int error, struct vmspace *oldvmspace); bool execve_block(struct thread *td, struct proc *p); void execve_block_wait(struct thread *td, struct proc *p); void execve_unblock(struct thread *td, struct proc *p); +void execve_block_pass(struct thread *td); #endif #endif /* !_SYS_IMGACT_H_ */ |
