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

@@ -22,12 +22,10 @@
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 
 #include <assert.h>
 #include <limits.h>

@@ -358,10 +356,22 @@
         char *key;
 
         if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, s, &pd) != 0)
                 return (NULL); /* dt_errno is set for us */
 
+        /*
+         * Make sure the probe is fully specified as being in this provider,
+         * even if the name is missing that part of the specification,
+         * otherwise our lookups may match in the wrong provider when we ask
+         * dtrace(7D).
+         *
+         * We always do this because we are explicitly searching _this_
+         * provider.
+         */
+        bcopy(pvp->pv_desc.dtvd_name, pd.dtpd_provider,
+            DTRACE_PROVNAMELEN);
+
         keylen = dt_probe_keylen(&pd);
         key = dt_probe_key(&pd, alloca(keylen));
 
         /*
          * If the probe is already declared, then return the dt_probe_t from