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

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


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)
-- 
2.37.2




More information about the DTrace-devel mailing list