Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Apr 2014 15:32:44 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264040 - in head: cddl/contrib/opensolaris/lib/libdtrace/common sys/cddl/contrib/opensolaris/uts/common/dtrace
Message-ID:  <201404021532.s32FWi4W038238@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Apr  2 15:32:44 2014
New Revision: 264040
URL: http://svnweb.freebsd.org/changeset/base/264040

Log:
  MFV	r258379;
  
  4248 dtrace(1M) should never create DOF with empty probes section
  4249 Only probes from the first DTrace object file will be included
  
  Illumos Revision:	4a20ab41aadcb81c53e72fc65886e964e9add59
  
  Reference:
  https://www.illumos.org/issues/4248
  https://www.illumos.org/issues/4249
  
  Obtained from:	Illumos
  MFC after:	1 month

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	Wed Apr  2 11:12:48 2014	(r264039)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	Wed Apr  2 15:32:44 2014	(r264040)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -486,7 +487,7 @@ dof_add_probe(dt_idhash_t *dhp, dt_ident
 	return (0);
 }
 
-static void
+static int
 dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
 {
 	dtrace_hdl_t *dtp = ddo->ddo_hdl;
@@ -497,8 +498,12 @@ dof_add_provider(dt_dof_t *ddo, const dt
 	size_t sz;
 	id_t i;
 
-	if (pvp->pv_flags & DT_PROVIDER_IMPL)
-		return; /* ignore providers that are exported by dtrace(7D) */
+	if (pvp->pv_flags & DT_PROVIDER_IMPL) {
+		/*
+		 * ignore providers that are exported by dtrace(7D)
+		 */
+		return (0);
+	}
 
 	nxr = dt_popcb(pvp->pv_xrefs, pvp->pv_xrmax);
 	dofs = alloca(sizeof (dof_secidx_t) * (nxr + 1));
@@ -525,6 +530,9 @@ dof_add_provider(dt_dof_t *ddo, const dt
 
 	(void) dt_idhash_iter(pvp->pv_probes, dof_add_probe, ddo);
 
+	if (dt_buf_len(&ddo->ddo_probes) == 0)
+		return (dt_set_errno(dtp, EDT_NOPROBES));
+
 	dofpv.dofpv_probes = dof_add_lsect(ddo, NULL, DOF_SECT_PROBES,
 	    sizeof (uint64_t), 0, sizeof (dof_probe_t),
 	    dt_buf_len(&ddo->ddo_probes));
@@ -579,6 +587,8 @@ dof_add_provider(dt_dof_t *ddo, const dt
 		    sizeof (dof_secidx_t), 0, sizeof (dof_secidx_t),
 		    sizeof (dof_secidx_t) * (nxr + 1));
 	}
+
+	return (0);
 }
 
 static int
@@ -822,8 +832,10 @@ dtrace_dof_create(dtrace_hdl_t *dtp, dtr
 	 */
 	if (flags & DTRACE_D_PROBES) {
 		for (pvp = dt_list_next(&dtp->dt_provlist);
-		    pvp != NULL; pvp = dt_list_next(pvp))
-			dof_add_provider(ddo, pvp);
+		    pvp != NULL; pvp = dt_list_next(pvp)) {
+			if (dof_add_provider(ddo, pvp) != 0)
+				return (NULL);
+		}
 	}
 
 	/*

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c	Wed Apr  2 11:12:48 2014	(r264039)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c	Wed Apr  2 15:32:44 2014	(r264040)
@@ -26,6 +26,7 @@
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  */
 
 #include <string.h>
@@ -109,7 +110,8 @@ static const struct {
 	{ EDT_BADSTACKPC, "Invalid stack program counter size" },
 	{ EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
 	{ EDT_OVERSION,	"Client requested deprecated version of library" },
-	{ EDT_ENABLING_ERR, "Failed to enable probe" }
+	{ EDT_ENABLING_ERR, "Failed to enable probe" },
+	{ EDT_NOPROBES, "No probe sites found for declared provider" }
 };
 
 static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h	Wed Apr  2 11:12:48 2014	(r264039)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h	Wed Apr  2 15:32:44 2014	(r264040)
@@ -25,7 +25,7 @@
  */
 
 /*
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
@@ -535,7 +535,8 @@ enum {
 	EDT_BADSTACKPC,		/* invalid stack program counter size */
 	EDT_BADAGGVAR,		/* invalid aggregation variable identifier */
 	EDT_OVERSION,		/* client is requesting deprecated version */
-	EDT_ENABLING_ERR	/* failed to enable probe */
+	EDT_ENABLING_ERR,	/* failed to enable probe */
+	EDT_NOPROBES		/* no probes sites for declared provider */
 };
 
 /*

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Wed Apr  2 11:12:48 2014	(r264039)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Wed Apr  2 15:32:44 2014	(r264040)
@@ -22,9 +22,9 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved
- * Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -14635,8 +14635,8 @@ dtrace_helper_provider_add(dof_helper_t 
 	 * Check to make sure this isn't a duplicate.
 	 */
 	for (i = 0; i < help->dthps_nprovs; i++) {
-		if (dofhp->dofhp_addr ==
-		    help->dthps_provs[i]->dthp_prov.dofhp_addr)
+		if (dofhp->dofhp_dof ==
+		    help->dthps_provs[i]->dthp_prov.dofhp_dof)
 			return (EALREADY);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404021532.s32FWi4W038238>