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/syscall/sigqueue.c
          +++ new/usr/src/uts/common/syscall/sigqueue.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   28  
  29      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  30      -
  31   29  #include <sys/param.h>
  32   30  #include <sys/types.h>
  33   31  #include <sys/sysmacros.h>
  34   32  #include <sys/systm.h>
  35   33  #include <sys/errno.h>
  36   34  #include <sys/proc.h>
  37   35  #include <sys/procset.h>
  38   36  #include <sys/fault.h>
  39   37  #include <sys/signal.h>
  40   38  #include <sys/siginfo.h>
  41   39  #include <sys/debug.h>
  42   40  
       41 +extern rctl_hndl_t rc_process_sigqueue;
       42 +
  43   43  static int
  44   44  sigqkill(pid_t pid, sigsend_t *sigsend)
  45   45  {
  46   46          proc_t *p;
  47   47          int error;
  48   48  
  49   49          if ((uint_t)sigsend->sig >= NSIG)
  50   50                  return (EINVAL);
  51   51  
  52   52          if (pid == -1) {
↓ open down ↓ 61 lines elided ↑ open up ↑
 114  114  
 115  115  /*
 116  116   * The handling of small unions, like the sigval argument to sigqueue,
 117  117   * is architecture dependent.  We have adopted the convention that the
 118  118   * value itself is passed in the storage which crosses the kernel
 119  119   * protection boundary.  This procedure will accept a scalar argument,
 120  120   * and store it in the appropriate value member of the sigsend_t structure.
 121  121   */
 122  122  int
 123  123  sigqueue(pid_t pid, int sig, /* union sigval */ void *value,
 124      -        int si_code, int block)
      124 +    int si_code, int block)
 125  125  {
 126  126          int error;
 127  127          sigsend_t v;
 128  128          sigqhdr_t *sqh;
 129  129          proc_t *p = curproc;
 130  130  
 131  131          /* The si_code value must indicate the signal will be queued */
 132  132          if (pid <= 0 || !sigwillqueue(sig, si_code))
 133  133                  return (set_errno(EINVAL));
 134  134  
 135  135          if ((sqh = p->p_sigqhdr) == NULL) {
      136 +                rlim64_t sigqsz_max;
      137 +
      138 +                mutex_enter(&p->p_lock);
      139 +                sigqsz_max = rctl_enforced_value(rc_process_sigqueue,
      140 +                    p->p_rctls, p);
      141 +                mutex_exit(&p->p_lock);
      142 +
 136  143                  /* Allocate sigqueue pool first time */
 137      -                sqh = sigqhdralloc(sizeof (sigqueue_t), _SIGQUEUE_MAX);
      144 +                sqh = sigqhdralloc(sizeof (sigqueue_t), (uint_t)sigqsz_max);
 138  145                  mutex_enter(&p->p_lock);
 139  146                  if (p->p_sigqhdr == NULL) {
 140  147                          /* hang the pool head on proc */
 141  148                          p->p_sigqhdr = sqh;
 142  149                  } else {
 143  150                          /* another lwp allocated the pool, free ours */
 144  151                          sigqhdrfree(sqh);
 145  152                          sqh = p->p_sigqhdr;
 146  153                  }
 147  154                  mutex_exit(&p->p_lock);
↓ open down ↓ 54 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX