Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jan 2018 12:13:27 -0500
From:      Mark Johnston <markj@freebsd.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r327888 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety sys/cddl/contrib/ope...
Message-ID:  <20180114171327.GA89171@raichu>
In-Reply-To: <CAGudoHHQGT_S5LS6QLMLbmGY2XZ1cCGHMi1-x3U7%2Bpkg3_=JVQ@mail.gmail.com>
References:  <201801121959.w0CJxlaw010074@repo.freebsd.org> <CAGudoHHQGT_S5LS6QLMLbmGY2XZ1cCGHMi1-x3U7%2Bpkg3_=JVQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 12, 2018 at 11:37:51PM +0100, Mateusz Guzik wrote:
> On Fri, Jan 12, 2018 at 8:59 PM, Mark Johnston <markj@freebsd.org> wrote:
> 
> > Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
> > ============================================================
> > ==================
> > --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
> > Fri Jan 12 18:44:28 2018        (r327887)
> > +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
> > Fri Jan 12 19:59:46 2018        (r327888)
> > @@ -3654,6 +3654,24 @@ dtrace_dif_variable(dtrace_mstate_t *mstate,
> > dtrace_st
> >                 return (dtrace_dif_varstr(
> >                     (uintptr_t)curthread->t_procp->p_zone->zone_name,
> >                     state, mstate));
> > +#elif defined(__FreeBSD__)
> > +       /*
> > +        * On FreeBSD, we introduce compatibility to zonename by falling
> > through
> > +        * into jailname.
> > +        */
> > +       case DIF_VAR_JAILNAME:
> > +               if (!dtrace_priv_kernel(state))
> > +                       return (0);
> > +
> > +               return (dtrace_dif_varstr(
> > +                   (uintptr_t)curthread->t_procp-
> > >p_ucred->cr_prison->pr_name,
> > +                   state, mstate));
> > +
> >
> 
> Why t_procp? 

It's the field name used in upstream (illumos) code, but we can just use
the FreeBSD field names.

> curthread->td_proc creds are what is used for permission
> checking and it
> rarely temporarily goes out of sync with proc's creds. However, if someone
> changes creds
> while this tracing is enabled this extra dereference risks accessing a
> freed object. On the
> other hand curthread creads are always safe to read.

Thanks. I'll fix this.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180114171327.GA89171>