svn commit: r240106 - in vendor/illumos/dist:
cmd/dtrace/test/tst/common/drops cmd/dtrace/test/tst/common/pid
cmd/dtrace/test/tst/common/usdt lib/libdtrace/common
Martin Matuska
mm at FreeBSD.org
Tue Sep 4 21:38:32 UTC 2012
Author: mm
Date: Tue Sep 4 21:38:31 2012
New Revision: 240106
URL: http://svn.freebsd.org/changeset/base/240106
Log:
Update vendor/illumos to illumos-gate 13788:0cb9e2232ae0
(dtrace changes, illumos issue #3123)
Added:
vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/lazyprobe.d
vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe.c
vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe1.ksh
vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe2.ksh
vendor/illumos/dist/lib/libdtrace/common/dlink.h
vendor/illumos/dist/lib/libdtrace/common/dlink_audit.c
vendor/illumos/dist/lib/libdtrace/common/dlink_init.c
Deleted:
vendor/illumos/dist/lib/libdtrace/common/drti.c
Modified:
vendor/illumos/dist/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d Tue Sep 4 21:06:53 2012 (r240105)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d Tue Sep 4 21:38:31 2012 (r240106)
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
#pragma D option destructive
#pragma D option jstackstrsize=1
@@ -32,7 +34,13 @@
BEGIN
{
- system("java -version");
+ /*
+ * Since some java versions are erroneously compiled with -xlazyload
+ * and therefore don't activate their ustack() helper by default, we
+ * use the DTrace helper audit library to activate it.
+ */
+ system("LD_AUDIT_32=/usr/lib/dtrace/libdtrace_forceload.so %s",
+ "java -version");
}
syscall:::entry
Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
==============================================================================
Binary file (source and/or target). No diff available.
Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/lazyprobe.d
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/lazyprobe.d Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,22 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+provider lazyprobe {
+ probe fire();
+};
Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe.c Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+#include "lazyprobe.h"
+
+int
+main(int argc, char **argv)
+{
+ for (;;) {
+ LAZYPROBE_FIRE();
+ }
+
+ return (0);
+}
Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe1.ksh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe1.ksh Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,63 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+
+#
+# Verify that USDT objects built with -xlazyload don't fire by default.
+#
+
+./tst.lazyprobe.exe &
+id=$!
+
+ret=1
+
+$dtrace -Z -s /dev/stdin <<-EOF
+ lazyprobe*:::fire
+ {
+ exit(1);
+ }
+ tick-10hz
+ /i++ > 20/
+ {
+ exit(0);
+ }
+EOF
+ret=$?
+
+kill -9 $id
+
+exit $ret
Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe2.ksh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.lazyprobe2.ksh Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,64 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+
+#
+# Verify that USDT objects built with -xlazyload fire by default when using
+# the DTrace audit library.
+#
+
+LD_AUDIT_32=/usr/lib/dtrace/libdtrace_forceload.so ./tst.lazyprobe.exe &
+id=$!
+
+ret=1
+
+$dtrace -Z -s /dev/stdin <<-EOF
+ lazyprobe*:::fire
+ {
+ exit(0);
+ }
+ tick-10hz
+ /i++ > 20/
+ {
+ exit(1);
+ }
+EOF
+ret=$?
+
+kill -9 $id
+
+exit $ret
Added: vendor/illumos/dist/lib/libdtrace/common/dlink.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/lib/libdtrace/common/dlink.h Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+#ifndef _DLINK_H
+#define _DLINK_H
+
+#include <link.h>
+#include <sys/dtrace.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char *devname;
+
+extern void dprintf(int, const char *, ...);
+extern void dtrace_link_init(void);
+extern void dtrace_link_dof(dof_hdr_t *, Lmid_t, const char *, uintptr_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DLINK_H */
Added: vendor/illumos/dist/lib/libdtrace/common/dlink_audit.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/lib/libdtrace/common/dlink_audit.c Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * This file implements an audit library that can be used to force the loading
+ * of helper providers. The default disposition for a helper provider -- USDT
+ * and ustack helpers -- is to load itself from it's containing object's .init
+ * section. In cases where startup time is deemed critical, USDT authors can
+ * use the -xlazyload option to dtrace(1M) to disable automatic loading (it's
+ * difficult to make the case for the utility of this feature for anything
+ * other than libc which, indeed, was the sole motivation). If a binary has
+ * been compiled with automatic loading disabled, this audit library may be
+ * used to force automatic loading:
+ *
+ * LD_AUDIT_32=/usr/lib/dtrace/libdaudit.so
+ * LD_AUDIT_64=/usr/lib/dtrace/64/libdaudit.so
+ */
+
+#include <link.h>
+#include <stdio.h>
+#include <libproc.h>
+#include <strings.h>
+
+#include <dlink.h>
+
+typedef struct obj_list {
+ struct obj_list *ol_next;
+ char *ol_name;
+ uintptr_t ol_addr;
+ Lmid_t ol_lmid;
+} obj_list_t;
+
+static obj_list_t *list;
+
+#pragma init(dtrace_daudit_init)
+static void
+dtrace_daudit_init(void)
+{
+ dtrace_link_init();
+}
+
+/*ARGSUSED*/
+uint_t
+la_version(uint_t version)
+{
+ return (LAV_CURRENT);
+}
+
+/*
+ * Record objects into our linked list as they're loaded.
+ */
+/*ARGSUSED*/
+uint_t
+la_objopen(Link_map *lmp, Lmid_t lmid, uintptr_t *cookie)
+{
+ obj_list_t *node;
+
+ /*
+ * If we can't allocate the next node in our list, we'll try to emit a
+ * message, but it's possible that might fail as well.
+ */
+ if ((node = malloc(sizeof (obj_list_t))) == NULL) {
+ dprintf(0, "libdaudit: failed to allocate");
+ return (0);
+ }
+ node->ol_next = list;
+ node->ol_name = strdup(lmp->l_name);
+ node->ol_addr = lmp->l_addr;
+ node->ol_lmid = lmid;
+ list = node;
+
+ return (0);
+}
+
+/*
+ * Once the link maps have reached a consistent state, process the list of
+ * objects that were loaded. We need to use libproc to search for the
+ * ___SUNW_dof symbol rather than dlsym(3C) since the symbol is not in the
+ * dynamic (run-time) symbol table (though it is, of course, in the symtab).
+ * Once we find it, we ioctl(2) it to the kernel just as we would have from
+ * the .init section if automatic loading were enabled.
+ */
+/*ARGSUSED*/
+void
+la_activity(uintptr_t *cookie, uint_t flags)
+{
+ struct ps_prochandle *P;
+ int err, ret;
+ GElf_Sym sym;
+
+ if (flags != LA_ACT_CONSISTENT)
+ return;
+
+ while (list != NULL) {
+ obj_list_t *node = list;
+ char *name = node->ol_name;
+
+ list = node->ol_next;
+
+ P = Pgrab(getpid(), PGRAB_RDONLY, &err);
+ ret = Plookup_by_name(P, name, "___SUNW_dof", &sym);
+ Prelease(P, 0);
+
+ if (ret == 0) {
+ dtrace_link_dof((void *)(uintptr_t)sym.st_value,
+ node->ol_lmid, node->ol_name, node->ol_addr);
+ }
+
+ free(node->ol_name);
+ free(node);
+ }
+}
Added: vendor/illumos/dist/lib/libdtrace/common/dlink_init.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/illumos/dist/lib/libdtrace/common/dlink_init.c Tue Sep 4 21:38:31 2012 (r240106)
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * This is the basis for drti.o which dt_link.c links into the object file
+ * generated by dtrace(1M) -G by default (note that -xlazyload disables this).
+ */
+
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dlink.h>
+
+static int gen; /* DOF helper generation */
+extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */
+
+#pragma init(dtrace_drti_init)
+static void
+dtrace_drti_init(void)
+{
+ Link_map *lmp;
+ Lmid_t lmid;
+
+ dtrace_link_init();
+
+ if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lmp) == -1 || lmp == NULL) {
+ dprintf(1, "couldn't discover module name or address\n");
+ return;
+ }
+
+ if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) {
+ dprintf(1, "couldn't discover link map ID\n");
+ return;
+ }
+
+ dtrace_link_dof(&__SUNW_dof, lmid, lmp->l_name, lmp->l_addr);
+}
+
+#pragma fini(dtrace_drti_fini)
+static void
+dtrace_drti_fini(void)
+{
+ int fd;
+
+ if ((fd = open64(devname, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devname);
+ return;
+ }
+
+ if ((gen = ioctl(fd, DTRACEHIOC_REMOVE, gen)) == -1)
+ dprintf(1, "DTrace ioctl failed to remove DOF (%d)\n", gen);
+ else
+ dprintf(1, "DTrace ioctl removed DOF (%d)\n", gen);
+
+ (void) close(fd);
+}
More information about the svn-src-vendor
mailing list