Skip to content

Commit

Permalink
Catch special DPTR cases in the parser
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed May 25, 2023
1 parent 7877da7 commit 5a71649
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion libdtrace/dt_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2839,11 +2839,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;
Expand Down Expand Up @@ -4109,6 +4112,9 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags)
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);
}
Expand Down
3 changes: 1 addition & 2 deletions test/unittest/pointers/tst.basic2.d
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 5a71649

Please sign in to comment.