execve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set

MFC after:	1 week
This commit is contained in:
Mateusz Guzik 2017-10-19 00:46:15 +00:00
parent 80a2397a38
commit e6b645ae89
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324735

View File

@ -900,10 +900,12 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
free(imgp->freepath, M_TEMP);
if (error == 0) {
PROC_LOCK(p);
if (p->p_ptevents & PTRACE_EXEC)
td->td_dbgflags |= TDB_EXEC;
PROC_UNLOCK(p);
if (p->p_ptevents & PTRACE_EXEC) {
PROC_LOCK(p);
if (p->p_ptevents & PTRACE_EXEC)
td->td_dbgflags |= TDB_EXEC;
PROC_UNLOCK(p);
}
/*
* Stop the process here if its stop event mask has