diff options
author | jhb <jhb@FreeBSD.org> | 2002-06-07 05:42:25 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-06-07 05:42:25 +0000 |
commit | b83763b2494f24805b7f84aad3be3da87ea5100e (patch) | |
tree | 8b3950e6043924cd75421eb06458cc619f735751 /sys/kern/kern_fork.c | |
parent | eb29fde68b289c16b9ea94acea2342fc6d6042d7 (diff) | |
download | FreeBSD-src-b83763b2494f24805b7f84aad3be3da87ea5100e.zip FreeBSD-src-b83763b2494f24805b7f84aad3be3da87ea5100e.tar.gz |
- Proper locking for p_tracep and p_traceflag.
- Catch up to new ktrace API.
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5a856ce..5088645 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -597,15 +597,16 @@ again: #ifdef KTRACE /* - * Copy traceflag and tracefile if enabled. If not inherited, - * these were zeroed above but we still could have a trace race - * so make sure p2's p_tracep is NULL. + * Copy traceflag and tracefile if enabled. */ - if ((p1->p_traceflag & KTRFAC_INHERIT) && p2->p_tracep == NULL) { + mtx_lock(&ktrace_mtx); + KASSERT(p2->p_tracep == NULL, ("new process has a ktrace vnode")); + if (p1->p_traceflag & KTRFAC_INHERIT) { p2->p_traceflag = p1->p_traceflag; if ((p2->p_tracep = p1->p_tracep) != NULL) VREF(p2->p_tracep); } + mtx_unlock(&ktrace_mtx); #endif /* @@ -861,9 +862,8 @@ fork_return(td, frame) userret(td, frame, 0); #ifdef KTRACE - if (KTRPOINT(td->td_proc, KTR_SYSRET)) { - ktrsysret(td->td_proc->p_tracep, SYS_fork, 0, 0); - } + if (KTRPOINT(td, KTR_SYSRET)) + ktrsysret(SYS_fork, 0, 0); #endif mtx_assert(&Giant, MA_NOTOWNED); } |