[DTrace-devel] [PATCH 2/3] Ensure that 'execname' is not marked DPTR

Kris Van Hees kris.van.hees at oracle.com
Thu Oct 6 18:12:20 UTC 2022


On Thu, Oct 06, 2022 at 01:57:05PM -0400, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> though maybe squash with the previous patch?  Also,
> 
>         if ((idp->di_flags & DT_IDFLG_DPTR) ||
>          ((dnp->dn_flags & DT_NF_REF) && idp->di_id != DIF_VAR_EXECNAME)
>              dnp->dn_flags |= DT_NF_DPTR;
> 
> seems simpler and a smaller change.

I actually did that originally but I decided against it because I wanted to
more clearly separate the check on the identifier flags vs the check on the
node flags.

> Kris Van Hees via DTrace-devel wrote:
> > The 'execname' builtin variable is a notable exception to REF-type
> > variables being DTrace-managed pointers.  It is a pointer into the
> > task_struct and therefore needs to be explicitly excluded from the
> > DPTR marking of variable nodes.
> > 
> > Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> > ---
> >   libdtrace/dt_parser.c | 8 ++++++--
> >   1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libdtrace/dt_parser.c b/libdtrace/dt_parser.c
> > index 6fc48c83..c718680e 100644
> > --- a/libdtrace/dt_parser.c
> > +++ b/libdtrace/dt_parser.c
> > @@ -2837,9 +2837,13 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create)
> >   		 * storage (DPTR), or if the type of the variable is a
> >   		 * REF-type, we mark this variable node as a pointer to
> >   		 * DTrace-managed storage (DPTR).
> > +		 *
> > +		 * We account for one notable exception: execname.
> >   		 */
> > -		if ((idp->di_flags & DT_IDFLG_DPTR) ||
> > -		    (dnp->dn_flags & DT_NF_REF))
> > +		if (idp->di_flags & DT_IDFLG_DPTR)
> > +			dnp->dn_flags |= DT_NF_DPTR;
> > +		else if ((dnp->dn_flags & DT_NF_REF) &&
> > +			 idp->di_id != DIF_VAR_EXECNAME)
> >   			dnp->dn_flags |= DT_NF_DPTR;
> >   		if (idp->di_flags & DT_IDFLG_WRITE)
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list