Print this page
2917 DTrace in a zone should have limited provider access

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sparc/dtrace/sdt.c
          +++ new/usr/src/uts/sparc/dtrace/sdt.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
       26 +/*
       27 + * Copyright (c) 2012, Joyent, Inc. All rights reserved.
       28 + */
  26   29  
  27   30  #include <sys/modctl.h>
  28   31  #include <sys/sunddi.h>
  29   32  #include <sys/dtrace.h>
  30   33  #include <sys/kobj.h>
  31   34  #include <sys/stat.h>
  32   35  #include <sys/conf.h>
  33   36  #include <vm/seg_kmem.h>
  34   37  #include <sys/stack.h>
  35   38  #include <sys/sdt_impl.h>
↓ open down ↓ 330 lines elided ↑ open up ↑
 366  369          if (ddi_create_minor_node(devi, "sdt", S_IFCHR, 0,
 367  370              DDI_PSEUDO, NULL) == DDI_FAILURE) {
 368  371                  ddi_remove_minor_node(devi, NULL);
 369  372                  return (DDI_FAILURE);
 370  373          }
 371  374  
 372  375          ddi_report_dev(devi);
 373  376          sdt_devi = devi;
 374  377  
 375  378          for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
      379 +                uint32_t priv;
      380 +
      381 +                if (prov->sdtp_priv == DTRACE_PRIV_NONE) {
      382 +                        priv = DTRACE_PRIV_KERNEL;
      383 +                        sdt_pops.dtps_mode = NULL;
      384 +                } else {
      385 +                        priv = prov->sdtp_priv;
      386 +                        ASSERT(priv == DTRACE_PRIV_USER);
      387 +                        sdt_pops.dtps_mode = sdt_mode;
      388 +                }
      389 +
 376  390                  if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
 377      -                    DTRACE_PRIV_KERNEL, NULL,
 378      -                    &sdt_pops, prov, &prov->sdtp_id) != 0) {
      391 +                    priv, NULL, &sdt_pops, prov, &prov->sdtp_id) != 0) {
 379  392                          cmn_err(CE_WARN, "failed to register sdt provider %s",
 380  393                              prov->sdtp_name);
 381  394                  }
 382  395          }
 383  396  
 384  397          return (DDI_SUCCESS);
 385  398  }
 386  399  
 387  400  static int
 388  401  sdt_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
↓ open down ↓ 117 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX