From c331c9703cc208068d5d492838f7d292b2e8acc9 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Sat, 6 Oct 2012 19:23:44 +0000 Subject: [PATCH] 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 --- sys/kern/kern_exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 /*