[DTrace-devel] [PATCH v2 02/14] Catch special DPTR cases in the parser
eugene.loh at oracle.com
eugene.loh at oracle.com
Sun May 7 04:23:10 UTC 2023
From: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_parser.c | 8 +++++++-
test/unittest/pointers/tst.basic2.d | 3 +--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libdtrace/dt_parser.c b/libdtrace/dt_parser.c
index ea9ff15b..be27fdbe 100644
--- a/libdtrace/dt_parser.c
+++ b/libdtrace/dt_parser.c
@@ -2838,11 +2838,14 @@ dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create)
* REF-type, we mark this variable node as a pointer to
* DTrace-managed storage (DPTR).
*
- * We account for two notable exception: args and execname.
+ * We account for a few exceptions:
+ * - strings (which could be NULL)
+ * - args and execname
*/
if (idp->di_flags & DT_IDFLG_DPTR)
dnp->dn_flags |= DT_NF_DPTR;
else if ((dnp->dn_flags & DT_NF_REF) &&
+ !dt_node_is_string(dnp) &&
idp->di_id != DIF_VAR_ARGS &&
idp->di_id != DIF_VAR_EXECNAME)
dnp->dn_flags |= DT_NF_DPTR;
@@ -4108,6 +4111,9 @@ asgn_common:
if (dnp->dn_args->dn_flags & DT_NF_ALLOCA)
dt_cook_taint_alloca(dnp, idp, dnp->dn_args);
+ /* An associative array cannot return a DPTR. */
+ dnp->dn_flags &= ~DT_NF_DPTR; assert((dnp->dn_flags & DT_NF_DPTR) == 0);
+
dt_node_free(lp);
return dt_node_cook(dnp, idflags);
}
diff --git a/test/unittest/pointers/tst.basic2.d b/test/unittest/pointers/tst.basic2.d
index 559fd93b..c17f9251 100644
--- a/test/unittest/pointers/tst.basic2.d
+++ b/test/unittest/pointers/tst.basic2.d
@@ -1,10 +1,9 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
-/* @@xfail: dtv2 */
/*
* ASSERTION: Pointers can be stored in associative arrays.
--
2.18.4
More information about the DTrace-devel
mailing list