summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2012-06-04 06:54:42 +0000
committerRichard Lowe <richlowe@richlowe.net>2014-02-25 12:53:02 -0500
commitb0f673c4626e4cb1db7785287eaeed2731dfefe8 (patch)
treed75fad195a057999974278cf1742080d6eebf350 /usr/src/uts/common/sys
parent3c7284bd3243d42a710edac3a15f6019b4c849be (diff)
downloadillumos-joyent-b0f673c4626e4cb1db7785287eaeed2731dfefe8.tar.gz
2915 DTrace in a zone should see "cpu", "curpsinfo", et al
2916 DTrace in a zone should be able to access fds[] 2917 DTrace in a zone should have limited provider access Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Reviewed by: Adam Leventhal <ahl@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r--usr/src/uts/common/sys/dtrace.h28
-rw-r--r--usr/src/uts/common/sys/dtrace_impl.h2
-rw-r--r--usr/src/uts/common/sys/sdt_impl.h8
-rw-r--r--usr/src/uts/common/sys/zone.h5
4 files changed, 32 insertions, 11 deletions
diff --git a/usr/src/uts/common/sys/dtrace.h b/usr/src/uts/common/sys/dtrace.h
index fd7612f88a..5da41b409b 100644
--- a/usr/src/uts/common/sys/dtrace.h
+++ b/usr/src/uts/common/sys/dtrace.h
@@ -25,7 +25,7 @@
*/
/*
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -288,8 +288,9 @@ typedef enum dtrace_probespec {
#define DIF_SUBR_INET_NTOA6 43
#define DIF_SUBR_TOUPPER 44
#define DIF_SUBR_TOLOWER 45
+#define DIF_SUBR_GETF 46
-#define DIF_SUBR_MAX 45 /* max subroutine value */
+#define DIF_SUBR_MAX 46 /* max subroutine value */
typedef uint32_t dif_instr_t;
@@ -1649,13 +1650,20 @@ typedef struct dof_helper {
*
* A bitwise OR that encapsulates both the mode (either DTRACE_MODE_KERNEL
* or DTRACE_MODE_USER) and the policy when the privilege of the enabling
- * is insufficient for that mode (either DTRACE_MODE_NOPRIV_DROP or
- * DTRACE_MODE_NOPRIV_RESTRICT). If the policy is DTRACE_MODE_NOPRIV_DROP,
- * insufficient privilege will result in the probe firing being silently
- * ignored for the enabling; if the policy is DTRACE_NODE_NOPRIV_RESTRICT,
- * insufficient privilege will not prevent probe processing for the
- * enabling, but restrictions will be in place that induce a UPRIV fault
- * upon attempt to examine probe arguments or current process state.
+ * is insufficient for that mode (a combination of DTRACE_MODE_NOPRIV_DROP,
+ * DTRACE_MODE_NOPRIV_RESTRICT, and DTRACE_MODE_LIMITEDPRIV_RESTRICT). If
+ * DTRACE_MODE_NOPRIV_DROP bit is set, insufficient privilege will result
+ * in the probe firing being silently ignored for the enabling; if the
+ * DTRACE_NODE_NOPRIV_RESTRICT bit is set, insufficient privilege will not
+ * prevent probe processing for the enabling, but restrictions will be in
+ * place that induce a UPRIV fault upon attempt to examine probe arguments
+ * or current process state. If the DTRACE_MODE_LIMITEDPRIV_RESTRICT bit
+ * is set, similar restrictions will be placed upon operation if the
+ * privilege is sufficient to process the enabling, but does not otherwise
+ * entitle the enabling to all zones. The DTRACE_MODE_NOPRIV_DROP and
+ * DTRACE_MODE_NOPRIV_RESTRICT are mutually exclusive (and one of these
+ * two policies must be specified), but either may be combined (or not)
+ * with DTRACE_MODE_LIMITEDPRIV_RESTRICT.
*
* 1.10.4 Caller's context
*
@@ -2054,6 +2062,7 @@ typedef struct dtrace_pops {
#define DTRACE_MODE_USER 0x02
#define DTRACE_MODE_NOPRIV_DROP 0x10
#define DTRACE_MODE_NOPRIV_RESTRICT 0x20
+#define DTRACE_MODE_LIMITEDPRIV_RESTRICT 0x40
typedef uintptr_t dtrace_provider_id_t;
@@ -2268,6 +2277,7 @@ extern void (*dtrace_helpers_cleanup)();
extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child);
extern void (*dtrace_cpustart_init)();
extern void (*dtrace_cpustart_fini)();
+extern void (*dtrace_closef)();
extern void (*dtrace_debugger_init)();
extern void (*dtrace_debugger_fini)();
diff --git a/usr/src/uts/common/sys/dtrace_impl.h b/usr/src/uts/common/sys/dtrace_impl.h
index d780082137..f79bf1e42e 100644
--- a/usr/src/uts/common/sys/dtrace_impl.h
+++ b/usr/src/uts/common/sys/dtrace_impl.h
@@ -924,6 +924,7 @@ typedef struct dtrace_mstate {
uintptr_t dtms_strtok; /* saved strtok() pointer */
uint32_t dtms_access; /* memory access rights */
dtrace_difo_t *dtms_difo; /* current dif object */
+ file_t *dtms_getf; /* cached rval of getf() */
} dtrace_mstate_t;
#define DTRACE_COND_OWNER 0x1
@@ -1144,6 +1145,7 @@ struct dtrace_state {
dtrace_optval_t dts_options[DTRACEOPT_MAX]; /* options */
dtrace_cred_t dts_cred; /* credentials */
size_t dts_nretained; /* number of retained enabs */
+ int dts_getf; /* number of getf() calls */
};
struct dtrace_provider {
diff --git a/usr/src/uts/common/sys/sdt_impl.h b/usr/src/uts/common/sys/sdt_impl.h
index cbe95f7c66..f7cc683f2f 100644
--- a/usr/src/uts/common/sys/sdt_impl.h
+++ b/usr/src/uts/common/sys/sdt_impl.h
@@ -24,11 +24,13 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _SYS_SDT_IMPL_H
#define _SYS_SDT_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -45,6 +47,7 @@ typedef struct sdt_provider {
char *sdtp_name; /* name of provider */
char *sdtp_prefix; /* prefix for probe names */
dtrace_pattr_t *sdtp_attr; /* stability attributes */
+ uint32_t sdtp_priv; /* privilege, if any */
dtrace_provider_id_t sdtp_id; /* provider ID */
} sdt_provider_t;
@@ -75,6 +78,7 @@ typedef struct sdt_argdesc {
} sdt_argdesc_t;
extern void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
+extern int sdt_mode(void *, dtrace_id_t, void *);
#ifdef __cplusplus
}
diff --git a/usr/src/uts/common/sys/zone.h b/usr/src/uts/common/sys/zone.h
index cc2a9f0e24..4419144f2b 100644
--- a/usr/src/uts/common/sys/zone.h
+++ b/usr/src/uts/common/sys/zone.h
@@ -538,6 +538,11 @@ typedef struct zone {
rctl_qty_t zone_nprocs_ctl; /* current limit protected by */
/* zone_rctls->rcs_lock */
kstat_t *zone_nprocs_kstat;
+
+ /*
+ * DTrace-private per-zone state
+ */
+ int zone_dtrace_getf; /* # of unprivileged getf()s */
} zone_t;
/*