Index: sys/kern/subr_syscall.c =================================================================== --- sys/kern/subr_syscall.c +++ sys/kern/subr_syscall.c @@ -261,10 +261,16 @@ * the next stop is reported as a syscall exit by * linux_ptrace_status(). */ - if ((td->td_dbgflags & TDB_EXEC) != 0 && - SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) { - ptracestop(td, SIGTRAP, NULL); - td->td_dbgflags &= ~TDB_EXEC; + if (traced && (td->td_dbgflags & TDB_EXEC) != 0 && + SV_PROC_ABI(p) == SV_ABI_LINUX) { + PROC_LOCK(p->p_pptr); + if (SV_PROC_ABI(p->p_pptr) == SV_ABI_LINUX) { + PROC_UNLOCK(p->p_pptr); + ptracestop(td, SIGTRAP, NULL); + td->td_dbgflags &= ~TDB_EXEC; + } else { + PROC_UNLOCK(p->p_pptr); + } } /* * If tracing the execed process, trap to the debugger