diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 0e30fc9cd9c8..676cd438420b 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -572,9 +572,14 @@ void ktrprocfork(struct proc *p1, struct proc *p2) { + MPASS(p2->p_tracevp == NULL); + MPASS(p2->p_traceflag == 0); + + if (p1->p_traceflag == 0) + return; + PROC_LOCK(p1); mtx_lock(&ktrace_mtx); - KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode")); if (p1->p_traceflag & KTRFAC_INHERIT) { p2->p_traceflag = p1->p_traceflag; if ((p2->p_tracevp = p1->p_tracevp) != NULL) {