From owner-svn-src-stable@freebsd.org Tue Feb 13 22:43:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B80F07BA9; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98731765BB; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93589271CD; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DMh8kc054407; Tue, 13 Feb 2018 22:43:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DMh7IY054400; Tue, 13 Feb 2018 22:43:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802132243.w1DMh7IY054400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Feb 2018 22:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329249 - in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/d... X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/dtrace/tests/tools sys/cdd... X-SVN-Commit-Revision: 329249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:43:09 -0000 Author: markj Date: Tue Feb 13 22:43:07 2018 New Revision: 329249 URL: https://svnweb.freebsd.org/changeset/base/329249 Log: MFC r327888, r327972, r327973: Add "jid" and "jailname" variables to DTrace. Added: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d - copied unchanged from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d - copied unchanged from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Directory Properties: stable/11/ (props changed) Copied: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d (from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d Tue Feb 13 22:43:07 2018 (r329249, copy of r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d) @@ -0,0 +1,44 @@ +/* + * 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 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. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jailname at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jailname] = count(); +} + +profile-4999hz +{ + @a[jailname] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Copied: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d (from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Tue Feb 13 22:43:07 2018 (r329249, copy of r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d) @@ -0,0 +1,44 @@ +/* + * 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 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. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jid at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jid] = count(); +} + +profile-4999hz +{ + @a[jid] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Feb 13 22:43:07 2018 (r329249) @@ -311,6 +311,12 @@ static const dt_ident_t _dtrace_globals[] = { DT_VERS_1_5, &dt_idops_func, "string(int, void *)" }, { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint_t" }, +#ifdef __FreeBSD__ +{ "jailname", DT_IDENT_SCALAR, 0, DIF_VAR_JAILNAME, + DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" }, +{ "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13, + &dt_idops_type, "int" }, +#endif { "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11, &dt_idops_func, "string(const char *, const char *)" }, { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -530,10 +536,8 @@ static const dt_ident_t _dtrace_globals[] = { { "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "int64_t" }, -#ifdef illumos { "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, -#endif #ifndef illumos { "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU, Modified: stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Tue Feb 13 22:43:07 2018 (r329249) @@ -19,6 +19,8 @@ ${PACKAGE}FILES= \ tst.gid.d \ tst.hton.d \ tst.index.d \ + tst.jailname.d \ + tst.jid.d \ tst.msgdsize.d \ tst.msgsize.d \ tst.null.d \ Modified: stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Feb 13 22:43:07 2018 (r329249) @@ -41,7 +41,6 @@ exclude EXFAIL common/misc/tst.include.ksh exclude EXFAIL common/safety/tst.copyin2.d exclude EXFAIL common/safety/tst.msgdsize.d exclude EXFAIL common/safety/tst.msgsize.d -exclude EXFAIL common/safety/tst.zonename.d exclude EXFAIL common/scalars/tst.misc.d exclude EXFAIL common/scalars/tst.selfarray2.d exclude EXFAIL common/sched/tst.enqueue.d Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 13 22:43:07 2018 (r329249) @@ -3537,6 +3537,24 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_st return (dtrace_dif_varstr( (uintptr_t)curthread->t_procp->p_zone->zone_name, state, mstate)); +#elif defined(__FreeBSD__) + /* + * On FreeBSD, we introduce compatibility to zonename by falling through + * into jailname. + */ + case DIF_VAR_JAILNAME: + if (!dtrace_priv_kernel(state)) + return (0); + + return (dtrace_dif_varstr( + (uintptr_t)curthread->td_ucred->cr_prison->pr_name, + state, mstate)); + + case DIF_VAR_JID: + if (!dtrace_priv_kernel(state)) + return (0); + + return ((uint64_t)curthread->td_ucred->cr_prison->pr_id); #else return (0); #endif Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Feb 13 22:43:07 2018 (r329249) @@ -254,6 +254,8 @@ typedef enum dtrace_probespec { #define DIF_VAR_GID 0x011f /* process group ID */ #define DIF_VAR_ERRNO 0x0120 /* thread errno */ #define DIF_VAR_EXECARGS 0x0121 /* process arguments */ +#define DIF_VAR_JID 0x0122 /* process jail id */ +#define DIF_VAR_JAILNAME 0x0123 /* process jail name */ #ifndef illumos #define DIF_VAR_CPU 0x0200