Print this page
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>

@@ -21,10 +21,13 @@
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
 
 #include <sys/modctl.h>
 #include <sys/sunddi.h>
 #include <sys/dtrace.h>
 #include <sys/kobj.h>

@@ -371,13 +374,23 @@
 
         ddi_report_dev(devi);
         sdt_devi = devi;
 
         for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+                uint32_t priv;
+
+                if (prov->sdtp_priv == DTRACE_PRIV_NONE) {
+                        priv = DTRACE_PRIV_KERNEL;
+                        sdt_pops.dtps_mode = NULL;
+                } else {
+                        priv = prov->sdtp_priv;
+                        ASSERT(priv == DTRACE_PRIV_USER);
+                        sdt_pops.dtps_mode = sdt_mode;
+                }
+
                 if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
-                    DTRACE_PRIV_KERNEL, NULL,
-                    &sdt_pops, prov, &prov->sdtp_id) != 0) {
+                    priv, NULL, &sdt_pops, prov, &prov->sdtp_id) != 0) {
                         cmn_err(CE_WARN, "failed to register sdt provider %s",
                             prov->sdtp_name);
                 }
         }