Date: Fri, 26 Jun 2026 22:20:46 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: cbd584772858 - stable/15 - execve_block_pass(9): a helper to wait for the execblock to pass Message-ID: <6a3efb3e.3096e.7b2d1ce7@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cbd58477285888b1b7ff21bdd0bc039f7ffad4ef commit cbd58477285888b1b7ff21bdd0bc039f7ffad4ef Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-06-17 19:06:50 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-26 22:16:03 +0000 execve_block_pass(9): a helper to wait for the execblock to pass (cherry picked from commit 450fe67d19eb2ea8e27109214ff21064fdcf808c) --- sys/kern/kern_exec.c | 20 ++++++++++++++++---- 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 ed7534af21bf..a3c9a4baa787 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 8c91b3a54bfa..df7d8b2d3908 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -126,6 +126,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_ */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3efb3e.3096e.7b2d1ce7>
