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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/dtrace/sdt.c
          +++ new/usr/src/uts/intel/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/frame.h>
↓ open down ↓ 376 lines elided ↑ open up ↑
 412  415  
 413  416          if (sdt_probetab_size == 0)
 414  417                  sdt_probetab_size = SDT_PROBETAB_SIZE;
 415  418  
 416  419          sdt_probetab_mask = sdt_probetab_size - 1;
 417  420          sdt_probetab =
 418  421              kmem_zalloc(sdt_probetab_size * sizeof (sdt_probe_t *), KM_SLEEP);
 419  422          dtrace_invop_add(sdt_invop);
 420  423  
 421  424          for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
      425 +                uint32_t priv;
      426 +
      427 +                if (prov->sdtp_priv == DTRACE_PRIV_NONE) {
      428 +                        priv = DTRACE_PRIV_KERNEL;
      429 +                        sdt_pops.dtps_mode = NULL;
      430 +                } else {
      431 +                        priv = prov->sdtp_priv;
      432 +                        ASSERT(priv == DTRACE_PRIV_USER);
      433 +                        sdt_pops.dtps_mode = sdt_mode;
      434 +                }
      435 +
 422  436                  if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
 423      -                    DTRACE_PRIV_KERNEL, NULL,
 424      -                    &sdt_pops, prov, &prov->sdtp_id) != 0) {
      437 +                    priv, NULL, &sdt_pops, prov, &prov->sdtp_id) != 0) {
 425  438                          cmn_err(CE_WARN, "failed to register sdt provider %s",
 426  439                              prov->sdtp_name);
 427  440                  }
 428  441          }
 429  442  
 430  443          return (DDI_SUCCESS);
 431  444  }
 432  445  
 433  446  /*ARGSUSED*/
 434  447  static int
↓ open down ↓ 123 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX