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

Eugene Loh eugene.loh at oracle.com
Thu Oct 6 17:57:05 UTC 2022


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.

On 10/6/22 12:20, 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)



More information about the DTrace-devel mailing list