diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index eff0f832b01d..22c53a5b0dac 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -691,7 +691,8 @@ do_execve(td, args, mac_p) setsugid(p); #ifdef KTRACE - if (priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) + if (p->p_tracecred != NULL && + priv_check_cred(p->p_tracecred, PRIV_DEBUG_DIFFCRED, 0)) ktrprocexec(p, &tracecred, &tracevp); #endif /*