diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-13 18:24:22 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-13 18:24:22 +0000 |
commit | f02ef380800bd38dbe71222060eb0b63fe324040 (patch) | |
tree | f091cf306f923dc1ced5e37882d80b885d47cc2b /sys/kern/kern_fork.c | |
parent | 15b2d31e358554d642da71cfc6c4967e3bea1414 (diff) | |
download | FreeBSD-src-f02ef380800bd38dbe71222060eb0b63fe324040.zip FreeBSD-src-f02ef380800bd38dbe71222060eb0b63fe324040.tar.gz |
- Cache a reference to the credential of the thread that starts a ktrace in
struct proc as p_tracecred alongside the current cache of the vnode in
p_tracep. This credential is then used for all later ktrace operations on
this file rather than using the credential of the current thread at the
time of each ktrace event.
- Now that we have multiple ktrace-related items in struct proc that are
pointers, rename p_tracep to p_tracevp to make it less ambiguous.
Requested by: rwatson (1)
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 65a3360..0c24cc6 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -626,11 +626,15 @@ again: * Copy traceflag and tracefile if enabled. */ mtx_lock(&ktrace_mtx); - KASSERT(p2->p_tracep == NULL, ("new process has a ktrace vnode")); + 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_tracep = p1->p_tracep) != NULL) - VREF(p2->p_tracep); + if ((p2->p_tracevp = p1->p_tracevp) != NULL) { + VREF(p2->p_tracevp); + KASSERT(p1->p_tracecred != NULL, + ("ktrace vnode with no cred")); + p2->p_tracecred = crhold(p1->p_tracecred); + } } mtx_unlock(&ktrace_mtx); #endif |