ktrace/kern_exec: check p_tracecred instead of p_cred

.. when deciding whether to continue tracing across suid/sgid exec.
Otherwise if root ktrace-d an unprivileged process and the processed
exec-ed a suid program, then tracing didn't continue across exec.

Reviewed by:	bde, kib
MFC after:	22 days
This commit is contained in:
Andriy Gapon 2012-10-06 19:23:44 +00:00
parent 09606b760a
commit c331c9703c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241281

View File

@ -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
/*