Print this page
3597 dtrace probe lookup ignores provider, asserts on conflict

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_provider.c
          +++ new/usr/src/lib/libdtrace/common/dt_provider.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  #include <sys/types.h>
  30   28  #include <sys/sysmacros.h>
  31   29  
  32   30  #include <assert.h>
  33   31  #include <limits.h>
  34   32  #include <strings.h>
  35   33  #include <stdlib.h>
  36   34  #include <alloca.h>
  37   35  #include <unistd.h>
  38   36  #include <errno.h>
↓ open down ↓ 314 lines elided ↑ open up ↑
 353  351  {
 354  352          dtrace_hdl_t *dtp = pvp->pv_hdl;
 355  353          dtrace_probedesc_t pd;
 356  354          dt_ident_t *idp;
 357  355          size_t keylen;
 358  356          char *key;
 359  357  
 360  358          if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, s, &pd) != 0)
 361  359                  return (NULL); /* dt_errno is set for us */
 362  360  
      361 +        /*
      362 +         * Make sure the probe is fully specified as being in this provider,
      363 +         * even if the name is missing that part of the specification,
      364 +         * otherwise our lookups may match in the wrong provider when we ask
      365 +         * dtrace(7D).
      366 +         *
      367 +         * We always do this because we are explicitly searching _this_
      368 +         * provider.
      369 +         */
      370 +        bcopy(pvp->pv_desc.dtvd_name, pd.dtpd_provider,
      371 +            DTRACE_PROVNAMELEN);
      372 +
 363  373          keylen = dt_probe_keylen(&pd);
 364  374          key = dt_probe_key(&pd, alloca(keylen));
 365  375  
 366  376          /*
 367  377           * If the probe is already declared, then return the dt_probe_t from
 368  378           * the existing identifier.  This could come from a static declaration
 369  379           * or it could have been cached from an earlier call to this function.
 370  380           */
 371  381          if ((idp = dt_idhash_lookup(pvp->pv_probes, key)) != NULL)
 372  382                  return (idp->di_data);
↓ open down ↓ 507 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX