Print this page
3830 SIGQUEUE_MAX's limit of 32 is too low
Reviewed by: Cedric Blancher <cedric.blancher@gmail.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Irek Szczesniak <iszczesniak@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/rctl_proc.c
          +++ new/usr/src/uts/common/os/rctl_proc.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 2006 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28   26  #include <sys/types.h>
  29   27  #include <sys/cmn_err.h>
  30   28  #include <sys/sysmacros.h>
  31   29  #include <sys/proc.h>
  32   30  #include <sys/rctl.h>
  33   31  #include <sys/rctl_impl.h>
  34   32  #include <sys/port_kernel.h>
       33 +#include <sys/signal.h>
       34 +#include <sys/var.h>
  35   35  
  36   36  #include <sys/vmparam.h>
  37   37  #include <sys/machparam.h>
  38   38  
  39   39  /*
  40   40   * Process-based resource controls
  41   41   *   The structure of the kernel leaves us no particular place where the process
  42   42   *   abstraction can be declared--it is intertwined with the growth of the Unix
  43   43   *   kernel.  Accordingly, we place all of the resource control logic associated
  44   44   *   with processes, both existing and future, in this file.
↓ open down ↓ 13 lines elided ↑ open up ↑
  58   58          SIGXCPU,                                /* RLIMIT_CPU   */
  59   59          SIGXFSZ,                                /* RLIMIT_FSIZE */
  60   60          0, 0, 0, 0, 0                           /* remainder do not signal */
  61   61  };
  62   62  
  63   63  rctl_hndl_t rc_process_msgmnb;
  64   64  rctl_hndl_t rc_process_msgtql;
  65   65  rctl_hndl_t rc_process_semmsl;
  66   66  rctl_hndl_t rc_process_semopm;
  67   67  rctl_hndl_t rc_process_portev;
       68 +rctl_hndl_t rc_process_sigqueue;
  68   69  
  69   70  /*
  70   71   * process.max-cpu-time / RLIMIT_CPU
  71   72   */
  72   73  /*ARGSUSED*/
  73   74  static int
  74   75  proc_cpu_time_test(struct rctl *rctl, struct proc *p, rctl_entity_p_t *e,
  75   76      rctl_val_t *rval, rctl_qty_t inc, uint_t flags)
  76   77  {
  77   78          return (inc >= rval->rcv_value);
↓ open down ↓ 203 lines elided ↑ open up ↑
 281  282  
 282  283  /*
 283  284   * void rctlproc_init()
 284  285   *
 285  286   * Overview
 286  287   *   Register the various resource controls associated with process entities.
 287  288   *   The historical rlim_infinity_map and rlim_infinity32_map are now encoded
 288  289   *   here as the native and ILP32 infinite values for each resource control.
 289  290   */
 290  291  void
 291      -rctlproc_init()
      292 +rctlproc_init(void)
 292  293  {
 293  294          rctl_set_t *set;
 294  295          rctl_alloc_gp_t *gp;
 295  296          rctl_entity_p_t e;
 296  297  
 297  298          rctlproc_legacy[RLIMIT_CPU] = rctl_register("process.max-cpu-time",
 298  299              RCENTITY_PROCESS, RCTL_GLOBAL_LOWERABLE | RCTL_GLOBAL_DENY_NEVER |
 299  300              RCTL_GLOBAL_CPU_TIME | RCTL_GLOBAL_INFINITE | RCTL_GLOBAL_SECONDS,
 300  301              UINT64_MAX, UINT64_MAX, &proc_cpu_time_ops);
 301  302          rctlproc_legacy[RLIMIT_FSIZE] = rctl_register("process.max-file-size",
↓ open down ↓ 60 lines elided ↑ open up ↑
 362  363          rctl_add_legacy_limit("process.max-msg-messages", "msgsys",
 363  364              "msginfo_msgtql", 8192, UINT_MAX);
 364  365  
 365  366          rc_process_portev = rctl_register("process.max-port-events",
 366  367              RCENTITY_PROCESS, RCTL_GLOBAL_DENY_ALWAYS | RCTL_GLOBAL_COUNT,
 367  368              PORT_MAX_EVENTS, PORT_MAX_EVENTS, &rctl_absolute_ops);
 368  369          rctl_add_default_limit("process.max-port-events", PORT_DEFAULT_EVENTS,
 369  370              RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
 370  371  
 371  372          /*
      373 +         * We set the upper limit to the maximum number of processes per user
      374 +         * to make it theoretical possible to deliver all SIGCHILD signals on
      375 +         * child termination, but at least to 8k.
      376 +         */
      377 +        rc_process_sigqueue = rctl_register("process.max-sigqueue-size",
      378 +            RCENTITY_PROCESS, RCTL_GLOBAL_LOWERABLE | RCTL_GLOBAL_DENY_ALWAYS |
      379 +            RCTL_GLOBAL_COUNT, MAX(v.v_maxup, 8192), MAX(v.v_maxup, 8192),
      380 +            &rctl_absolute_ops);
      381 +        rctl_add_default_limit("process.max-sigqueue-size",
      382 +            _SIGQUEUE_SIZE_BASIC, RCPRIV_BASIC, RCTL_LOCAL_DENY);
      383 +        rctl_add_default_limit("process.max-sigqueue-size",
      384 +            _SIGQUEUE_SIZE_PRIVILEGED, RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
      385 +
      386 +        /*
 372  387           * Place minimal set of controls on "sched" process for inheritance by
 373  388           * processes created via newproc().
 374  389           */
 375  390          set = rctl_set_create();
 376  391          gp = rctl_set_init_prealloc(RCENTITY_PROCESS);
 377  392          mutex_enter(&curproc->p_lock);
 378  393          e.rcep_p.proc = curproc;
 379  394          e.rcep_t = RCENTITY_PROCESS;
 380  395          curproc->p_rctls = rctl_set_init(RCENTITY_PROCESS, curproc, &e,
 381  396              set, gp);
 382  397          mutex_exit(&curproc->p_lock);
 383  398          rctl_prealloc_destroy(gp);
 384  399  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX