Print this page
OS-4437 lxbrand ptrace turns harmless signals deadly
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-3742 lxbrand add support for signalfd
OS-4382 remove obsolete brand hooks added during lx development
OS-4306 lxbrand setsockopt(IP_MULTICAST_TTL) handles optlen poorly
OS-4303 lxbrand ltp ptrace05 fails
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-3820 lxbrand ptrace(2): the next generation
OS-3685 lxbrand PTRACE_O_TRACEFORK race condition
OS-3834 lxbrand 64-bit strace(1) reports 64-bit process as using x32 ABI
OS-3794 lxbrand panic on init signal death
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
OS-3642 failed assert when exiting zlogin due to OS-3140 fix
OS-3140 In LX zone 'ps fax' does not show all processes
OS-2844 lx brand should support 64-bit user-land

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/sig.c
          +++ new/usr/src/uts/common/os/sig.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25      - * Copyright (c) 2014, Joyent, Inc.  All rights reserved.
       25 + * Copyright 2015, Joyent, Inc.
  26   26   */
  27   27  
  28   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   29  /*        All Rights Reserved   */
  30   30  
  31   31  #include <sys/param.h>
  32   32  #include <sys/types.h>
  33   33  #include <sys/bitmap.h>
  34   34  #include <sys/sysmacros.h>
  35   35  #include <sys/systm.h>
↓ open down ↓ 18 lines elided ↑ open up ↑
  54   54  #include <vm/as.h>
  55   55  #include <sys/bitmap.h>
  56   56  #include <c2/audit.h>
  57   57  #include <sys/core.h>
  58   58  #include <sys/schedctl.h>
  59   59  #include <sys/contract/process_impl.h>
  60   60  #include <sys/cyclic.h>
  61   61  #include <sys/dtrace.h>
  62   62  #include <sys/sdt.h>
  63   63  #include <sys/signalfd.h>
       64 +#include <sys/brand.h>
  64   65  
  65   66  const k_sigset_t nullsmask = {0, 0, 0};
  66   67  
  67   68  const k_sigset_t fillset =      /* MUST be contiguous */
  68   69          {FILLSET0, FILLSET1, FILLSET2};
  69   70  
  70   71  const k_sigset_t cantmask =
  71   72          {CANTMASK0, CANTMASK1, CANTMASK2};
  72   73  
  73   74  const k_sigset_t cantreset =
↓ open down ↓ 67 lines elided ↑ open up ↑
 141  142  }
 142  143  
 143  144  int
 144  145  signal_is_blocked(kthread_t *t, int sig)
 145  146  {
 146  147          return (sigismember(&t->t_hold, sig) ||
 147  148              (schedctl_sigblock(t) && !sigismember(&cantmask, sig)));
 148  149  }
 149  150  
 150  151  /*
      152 + * Return true if the signal can safely be ignored.
      153 + * That is, if the signal is included in the p_ignore mask and doing so is not
      154 + * forbidden by any process branding.
      155 + */
      156 +static int
      157 +sig_ignorable(proc_t *p, klwp_t *lwp, int sig)
      158 +{
      159 +        return (sigismember(&p->p_ignore, sig) &&       /* sig in ignore mask */
      160 +            !(PROC_IS_BRANDED(p) &&                     /* allowed by brand */
      161 +            BROP(p)->b_sig_ignorable != NULL &&
      162 +            BROP(p)->b_sig_ignorable(p, lwp, sig) == B_FALSE));
      163 +
      164 +}
      165 +
      166 +/*
 151  167   * Return true if the signal can safely be discarded on generation.
 152  168   * That is, if there is no need for the signal on the receiving end.
 153  169   * The answer is true if the process is a zombie or
 154  170   * if all of these conditions are true:
 155  171   *      the signal is being ignored
 156  172   *      the process is single-threaded
 157  173   *      the signal is not being traced by /proc
 158  174   *      the signal is not blocked by the process
 159  175   *      the signal is not being accepted via sigwait()
 160  176   */
 161  177  static int
 162      -sig_discardable(proc_t *p, int sig)
      178 +sig_discardable(proc_t *p, kthread_t *tp, int sig)
 163  179  {
 164  180          kthread_t *t = p->p_tlist;
      181 +        klwp_t *lwp = (tp == NULL) ? NULL : tp->t_lwp;
 165  182  
 166  183          return (t == NULL ||            /* if zombie or ... */
 167      -            (sigismember(&p->p_ignore, sig) &&  /* signal is ignored */
      184 +            (sig_ignorable(p, lwp, sig) &&              /* signal is ignored */
 168  185              t->t_forw == t &&                   /* and single-threaded */
 169  186              !tracing(p, sig) &&                 /* and no /proc tracing */
 170  187              !signal_is_blocked(t, sig) &&       /* and signal not blocked */
 171  188              !sigismember(&t->t_sigwait, sig))); /* and not being accepted */
 172  189  }
 173  190  
 174  191  /*
 175  192   * Return true if this thread is going to eat this signal soon.
 176  193   * Note that, if the signal is SIGKILL, we force stopped threads to be
 177  194   * set running (to make SIGKILL be a sure kill), but only if the process
↓ open down ↓ 15 lines elided ↑ open up ↑
 193  210           */
 194  211          if (!signal_is_blocked(t, sig)) {
 195  212                  t->t_sig_check = 1;     /* have thread do an issig */
 196  213                  if (ISWAKEABLE(t) || ISWAITING(t)) {
 197  214                          setrun_locked(t);
 198  215                          rval = 1;
 199  216                  } else if (t->t_state == TS_STOPPED && sig == SIGKILL &&
 200  217                      !(ttoproc(t)->p_proc_flag & P_PR_LOCK)) {
 201  218                          ttoproc(t)->p_stopsig = 0;
 202  219                          t->t_dtrace_stop = 0;
 203      -                        t->t_schedflag |= TS_XSTART | TS_PSTART;
      220 +                        t->t_schedflag |= TS_XSTART | TS_PSTART | TS_BSTART;
 204  221                          setrun_locked(t);
 205  222                  } else if (t != curthread && t->t_state == TS_ONPROC) {
 206  223                          aston(t);       /* make it do issig promptly */
 207  224                          if (t->t_cpu != CPU)
 208  225                                  poke_cpu(t->t_cpu->cpu_id);
 209  226                          rval = 1;
 210  227                  } else if (t->t_state == TS_RUN) {
 211  228                          rval = 1;
 212  229                  }
 213  230          }
↓ open down ↓ 76 lines elided ↑ open up ↑
 290  307                  sigdelset(&p->p_extsig, SIGCONT);
 291  308                  if ((tt = p->p_tlist) != NULL) {
 292  309                          do {
 293  310                                  sigdelq(p, tt, SIGCONT);
 294  311                                  sigdelset(&tt->t_sig, SIGCONT);
 295  312                                  sigdelset(&tt->t_extsig, SIGCONT);
 296  313                          } while ((tt = tt->t_forw) != p->p_tlist);
 297  314                  }
 298  315          }
 299  316  
 300      -        if (sig_discardable(p, sig)) {
      317 +        if (sig_discardable(p, t, sig)) {
 301  318                  DTRACE_PROC3(signal__discard, kthread_t *, p->p_tlist,
 302  319                      proc_t *, p, int, sig);
 303  320                  return;
 304  321          }
 305  322  
 306  323          if (t != NULL) {
 307  324                  /*
 308  325                   * This is a directed signal, wake up the lwp.
 309  326                   */
 310  327                  sigaddset(&t->t_sig, sig);
↓ open down ↓ 179 lines elided ↑ open up ↑
 490  507          if (p->p_flag & SVFORK)
 491  508                  sigdiffset(&set, &holdvfork);
 492  509  
 493  510          if (!sigisempty(&set)) {
 494  511                  int sig;
 495  512  
 496  513                  for (sig = 1; sig < NSIG; sig++) {
 497  514                          if (sigismember(&set, sig) &&
 498  515                              (tracing(p, sig) ||
 499  516                              sigismember(&t->t_sigwait, sig) ||
 500      -                            !sigismember(&p->p_ignore, sig))) {
      517 +                            !sig_ignorable(p, lwp, sig))) {
 501  518                                  /*
 502  519                                   * Don't promote a signal that will stop
 503  520                                   * the process when lwp_nostop is set.
 504  521                                   */
 505  522                                  if (!lwp->lwp_nostop ||
 506  523                                      PTOU(p)->u_signal[sig-1] != SIG_DFL ||
 507  524                                      !sigismember(&stopdefault, sig))
 508  525                                          return (1);
 509  526                          }
 510  527                  }
↓ open down ↓ 105 lines elided ↑ open up ↑
 616  633                   * Again, go back to top of loop to check if an exit
 617  634                   * or hold event has occurred while stopped.
 618  635                   */
 619  636                  if (((p->p_flag & (SHOLDFORK1|SHOLDWATCH)) ||
 620  637                      (t->t_proc_flag & TP_HOLDLWP)) && !lwp->lwp_nostop) {
 621  638                          stop(PR_SUSPENDED, SUSPEND_NORMAL);
 622  639                          continue;
 623  640                  }
 624  641  
 625  642                  /*
      643 +                 * Allow the brand the chance to alter (or suppress) delivery
      644 +                 * of this signal.
      645 +                 */
      646 +                if (PROC_IS_BRANDED(p) && BROP(p)->b_issig_stop != NULL) {
      647 +                        /*
      648 +                         * The brand hook will return 0 if it would like
      649 +                         * us to drive on, or -1 if we should restart
      650 +                         * the loop to check other conditions.
      651 +                         */
      652 +                        if (BROP(p)->b_issig_stop(p, lwp) != 0) {
      653 +                                continue;
      654 +                        }
      655 +                }
      656 +
      657 +                /*
 626  658                   * Honor requested stop before dealing with the
 627  659                   * current signal; a debugger may change it.
 628  660                   * Do not want to go back to loop here since this is a special
 629  661                   * stop that means: make incremental progress before the next
 630  662                   * stop. The danger is that returning to top of loop would most
 631  663                   * likely drop the thread right back here to stop soon after it
 632  664                   * was continued, violating the incremental progress request.
 633  665                   */
 634  666                  if ((t->t_proc_flag & TP_PRSTOP) && !lwp->lwp_nostop)
 635  667                          stop(PR_REQUESTED, 0);
↓ open down ↓ 13 lines elided ↑ open up ↑
 649  681                   * If the current thread is accepting the signal
 650  682                   * (via sigwait(), sigwaitinfo(), or sigtimedwait()),
 651  683                   * we allow the signal to be accepted, even if it is
 652  684                   * being ignored, and without causing a job control stop.
 653  685                   */
 654  686                  if ((sig = lwp->lwp_cursig) != 0) {
 655  687                          ext = lwp->lwp_extsig;
 656  688                          lwp->lwp_cursig = 0;
 657  689                          lwp->lwp_extsig = 0;
 658  690                          if (sigismember(&t->t_sigwait, sig) ||
 659      -                            (!sigismember(&p->p_ignore, sig) &&
      691 +                            (!sig_ignorable(p, lwp, sig) &&
 660  692                              !isjobstop(sig))) {
 661  693                                  if (p->p_flag & (SEXITLWPS|SKILLED)) {
 662  694                                          sig = SIGKILL;
 663  695                                          ext = (p->p_flag & SEXTKILLED) != 0;
 664  696                                  }
 665  697                                  lwp->lwp_cursig = (uchar_t)sig;
 666  698                                  lwp->lwp_extsig = (uchar_t)ext;
 667  699                                  break;
 668  700                          }
 669  701                          /*
↓ open down ↓ 31 lines elided ↑ open up ↑
 701  733                   * Loop on the pending signals until we find a
 702  734                   * non-held signal that is traced or not ignored.
 703  735                   * First check the signals pending for the lwp,
 704  736                   * then the signals pending for the process as a whole.
 705  737                   */
 706  738                  for (;;) {
 707  739                          if ((sig = fsig(&t->t_sig, t)) != 0) {
 708  740                                  toproc = 0;
 709  741                                  if (tracing(p, sig) ||
 710  742                                      sigismember(&t->t_sigwait, sig) ||
 711      -                                    !sigismember(&p->p_ignore, sig)) {
      743 +                                    !sig_ignorable(p, lwp, sig)) {
 712  744                                          if (sigismember(&t->t_extsig, sig))
 713  745                                                  ext = 1;
 714  746                                          break;
 715  747                                  }
 716  748                                  sigdelset(&t->t_sig, sig);
 717  749                                  sigdelset(&t->t_extsig, sig);
 718  750                                  sigdelq(p, t, sig);
 719  751                          } else if ((sig = fsig(&p->p_sig, t)) != 0) {
 720  752                                  if (sig == SIGCLD)
 721  753                                          sigcld_found = 1;
 722  754                                  toproc = 1;
 723  755                                  if (tracing(p, sig) ||
 724  756                                      sigismember(&t->t_sigwait, sig) ||
 725      -                                    !sigismember(&p->p_ignore, sig)) {
      757 +                                    !sig_ignorable(p, lwp, sig)) {
 726  758                                          if (sigismember(&p->p_extsig, sig))
 727  759                                                  ext = 1;
 728  760                                          break;
 729  761                                  }
 730  762                                  sigdelset(&p->p_sig, sig);
 731  763                                  sigdelset(&p->p_extsig, sig);
 732  764                                  sigdelq(p, NULL, sig);
 733  765                          } else {
 734  766                                  /* no signal was found */
 735  767                                  break;
↓ open down ↓ 211 lines elided ↑ open up ↑
 947  979                           * when we reach the top of the kernel stack.
 948  980                           */
 949  981                          if (lwp->lwp_asleep && (p->p_flag & SHOLDFORK)) {
 950  982                                  t->t_proc_flag &= ~TP_STOPPING;
 951  983                                  return;
 952  984                          }
 953  985                          flags &= ~TS_CSTART;
 954  986                  }
 955  987                  break;
 956  988  
      989 +        case PR_BRAND:
      990 +                /*
      991 +                 * We have been stopped by the brand code for a brand-private
      992 +                 * reason.  This is an asynchronous stop affecting only this
      993 +                 * LWP.
      994 +                 */
      995 +                VERIFY(PROC_IS_BRANDED(p));
      996 +                flags &= ~TS_BSTART;
      997 +                break;
      998 +
 957  999          default:        /* /proc stop */
 958 1000                  flags &= ~TS_PSTART;
 959 1001                  /*
 960 1002                   * Do synchronous stop unless the async-stop flag is set.
 961 1003                   * If why is PR_REQUESTED and t->t_dtrace_stop flag is set,
 962 1004                   * then no debugger is present and we also do synchronous stop.
 963 1005                   */
 964 1006                  if ((why != PR_REQUESTED || t->t_dtrace_stop) &&
 965 1007                      !(p->p_proc_flag & P_PR_ASYNC)) {
 966 1008                          int notify;
↓ open down ↓ 91 lines elided ↑ open up ↑
1058 1100                          pokelwps(p);
1059 1101                          /*
1060 1102                           * We do this just in case one of the threads we asked
1061 1103                           * to stop is in holdlwps() (called from cfork()) or
1062 1104                           * lwp_suspend().
1063 1105                           */
1064 1106                          cv_broadcast(&p->p_holdlwps);
1065 1107                  }
1066 1108          }
1067 1109  
1068      -        if (why != PR_JOBCONTROL && why != PR_CHECKPOINT) {
     1110 +        if (why != PR_JOBCONTROL && why != PR_CHECKPOINT && why != PR_BRAND) {
1069 1111                  /*
1070 1112                   * Do process-level notification when all lwps are
1071 1113                   * either stopped on events of interest to /proc
1072 1114                   * or are stopped showing PR_SUSPENDED or are zombies.
1073 1115                   */
1074 1116                  procstop = 1;
1075 1117                  for (tx = t->t_forw; procstop && tx != t; tx = tx->t_forw) {
1076 1118                          if (VSTOPPED(tx))
1077 1119                                  continue;
1078 1120                          thread_lock(tx);
↓ open down ↓ 85 lines elided ↑ open up ↑
1164 1206  
1165 1207          }
1166 1208  
1167 1209          /*
1168 1210           * Need to do this here (rather than after the thread is officially
1169 1211           * stopped) because we can't call mutex_enter from a stopped thread.
1170 1212           */
1171 1213          if (why == PR_CHECKPOINT)
1172 1214                  del_one_utstop();
1173 1215  
     1216 +        /*
     1217 +         * Allow the brand to post notification of this stop condition.
     1218 +         */
     1219 +        if (PROC_IS_BRANDED(p) && BROP(p)->b_stop_notify != NULL) {
     1220 +                BROP(p)->b_stop_notify(p, lwp, why, what);
     1221 +        }
     1222 +
1174 1223          thread_lock(t);
1175 1224          ASSERT((t->t_schedflag & TS_ALLSTART) == 0);
1176 1225          t->t_schedflag |= flags;
1177 1226          t->t_whystop = (short)why;
1178 1227          t->t_whatstop = (short)what;
1179 1228          CL_STOP(t, why, what);
1180 1229          (void) new_mstate(t, LMS_STOPPED);
1181 1230          thread_stop(t);                 /* set stop state and drop lock */
1182 1231  
1183 1232          if (why != PR_SUSPENDED && why != PR_CHECKPOINT) {
↓ open down ↓ 1 lines elided ↑ open up ↑
1185 1234                   * We may have gotten a SIGKILL or a SIGCONT when
1186 1235                   * we released p->p_lock; make one last check.
1187 1236                   * Also check for a /proc run-on-last-close.
1188 1237                   */
1189 1238                  if (sigismember(&t->t_sig, SIGKILL) ||
1190 1239                      sigismember(&p->p_sig, SIGKILL) ||
1191 1240                      (t->t_proc_flag & TP_LWPEXIT) ||
1192 1241                      (p->p_flag & (SEXITLWPS|SKILLED))) {
1193 1242                          p->p_stopsig = 0;
1194 1243                          thread_lock(t);
1195      -                        t->t_schedflag |= TS_XSTART | TS_PSTART;
     1244 +                        t->t_schedflag |= TS_XSTART | TS_PSTART | TS_BSTART;
1196 1245                          setrun_locked(t);
1197 1246                          thread_unlock_nopreempt(t);
1198 1247                  } else if (why == PR_JOBCONTROL) {
1199 1248                          if (p->p_flag & SSCONT) {
1200 1249                                  /*
1201 1250                                   * This resulted from a SIGCONT posted
1202 1251                                   * while we were not holding p->p_lock.
1203 1252                                   */
1204 1253                                  p->p_stopsig = 0;
1205 1254                                  thread_lock(t);
↓ open down ↓ 114 lines elided ↑ open up ↑
1320 1369                  mutex_exit(&p->p_lock);
1321 1370                  return;
1322 1371          }
1323 1372          func = PTOU(curproc)->u_signal[sig-1];
1324 1373  
1325 1374          /*
1326 1375           * The signal disposition could have changed since we promoted
1327 1376           * this signal from pending to current (we dropped p->p_lock).
1328 1377           * This can happen only in a multi-threaded process.
1329 1378           */
1330      -        if (sigismember(&p->p_ignore, sig) ||
     1379 +        if (sig_ignorable(p, lwp, sig) ||
1331 1380              (func == SIG_DFL && sigismember(&stopdefault, sig))) {
1332 1381                  lwp->lwp_cursig = 0;
1333 1382                  lwp->lwp_extsig = 0;
1334 1383                  if (lwp->lwp_curinfo) {
1335 1384                          siginfofree(lwp->lwp_curinfo);
1336 1385                          lwp->lwp_curinfo = NULL;
1337 1386                  }
1338 1387                  if (t->t_flag & T_TOMASK) {     /* sigsuspend or pollsys */
1339 1388                          t->t_flag &= ~T_TOMASK;
1340 1389                          t->t_hold = lwp->lwp_sigoldmask;
↓ open down ↓ 423 lines elided ↑ open up ↑
1764 1813           * to receive it or accept it, if ever.
1765 1814           */
1766 1815          if (sigismember(&pp->p_sig, SIGCLD)) {
1767 1816                  cp->p_pidflag |= CLDPEND;
1768 1817          } else {
1769 1818                  cp->p_pidflag &= ~CLDPEND;
1770 1819                  if (sqp == NULL) {
1771 1820                          /*
1772 1821                           * This can only happen when the parent is init.
1773 1822                           * (See call to sigcld(q, NULL) in exit().)
1774      -                         * Use KM_NOSLEEP to avoid deadlock.
     1823 +                         * Use KM_NOSLEEP to avoid deadlock. The child procs
     1824 +                         * initpid can be 1 for zlogin.
1775 1825                           */
1776      -                        ASSERT(pp == proc_init);
     1826 +                        ASSERT(pp->p_pidp->pid_id ==
     1827 +                            cp->p_zone->zone_proc_initpid ||
     1828 +                            pp->p_pidp->pid_id == 1);
1777 1829                          winfo(cp, &info, 0);
1778 1830                          sigaddq(pp, NULL, &info, KM_NOSLEEP);
1779 1831                  } else {
1780 1832                          winfo(cp, &sqp->sq_info, 0);
1781 1833                          sigaddqa(pp, NULL, sqp);
1782 1834                          sqp = NULL;
1783 1835                  }
1784 1836          }
1785 1837  
1786 1838          mutex_exit(&pp->p_lock);
↓ open down ↓ 10 lines elided ↑ open up ↑
1797 1849   */
1798 1850  void
1799 1851  sigcld_repost()
1800 1852  {
1801 1853          proc_t *pp = curproc;
1802 1854          proc_t *cp;
1803 1855          sigqueue_t *sqp;
1804 1856  
1805 1857          sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
1806 1858          mutex_enter(&pidlock);
     1859 +        if (PROC_IS_BRANDED(pp) && BROP(pp)->b_sigcld_repost != NULL) {
     1860 +                /*
     1861 +                 * Allow the brand to inject synthetic SIGCLD signals.
     1862 +                 */
     1863 +                if (BROP(pp)->b_sigcld_repost(pp, sqp) == 0) {
     1864 +                        mutex_exit(&pidlock);
     1865 +                        return;
     1866 +                }
     1867 +        }
1807 1868          for (cp = pp->p_child; cp; cp = cp->p_sibling) {
1808 1869                  if (cp->p_pidflag & CLDPEND) {
1809 1870                          post_sigcld(cp, sqp);
1810 1871                          mutex_exit(&pidlock);
1811 1872                          return;
1812 1873                  }
1813 1874          }
1814 1875          mutex_exit(&pidlock);
1815 1876          kmem_free(sqp, sizeof (sigqueue_t));
1816 1877  }
↓ open down ↓ 291 lines elided ↑ open up ↑
2108 2169   * It is called from sigqueue() and other places.
2109 2170   */
2110 2171  void
2111 2172  sigaddqa(proc_t *p, kthread_t *t, sigqueue_t *sigqp)
2112 2173  {
2113 2174          int sig = sigqp->sq_info.si_signo;
2114 2175  
2115 2176          ASSERT(MUTEX_HELD(&p->p_lock));
2116 2177          ASSERT(sig >= 1 && sig < NSIG);
2117 2178  
2118      -        if (sig_discardable(p, sig))
     2179 +        if (sig_discardable(p, t, sig))
2119 2180                  siginfofree(sigqp);
2120 2181          else
2121 2182                  sigaddqins(p, t, sigqp);
2122 2183  
2123 2184          sigtoproc(p, t, sig);
2124 2185  }
2125 2186  
2126 2187  /*
2127 2188   * Allocate the sigqueue_t structure and call sigaddqins().
2128 2189   */
↓ open down ↓ 5 lines elided ↑ open up ↑
2134 2195  
2135 2196          ASSERT(MUTEX_HELD(&p->p_lock));
2136 2197          ASSERT(sig >= 1 && sig < NSIG);
2137 2198  
2138 2199          /*
2139 2200           * If the signal will be discarded by sigtoproc() or
2140 2201           * if the process isn't requesting siginfo and it isn't
2141 2202           * blocking the signal (it *could* change it's mind while
2142 2203           * the signal is pending) then don't bother creating one.
2143 2204           */
2144      -        if (!sig_discardable(p, sig) &&
     2205 +        if (!sig_discardable(p, t, sig) &&
2145 2206              (sigismember(&p->p_siginfo, sig) ||
2146 2207              (curproc->p_ct_process != p->p_ct_process) ||
2147 2208              (sig == SIGCLD && SI_FROMKERNEL(infop))) &&
2148 2209              ((sqp = kmem_alloc(sizeof (sigqueue_t), km_flags)) != NULL)) {
2149 2210                  bcopy(infop, &sqp->sq_info, sizeof (k_siginfo_t));
2150 2211                  sqp->sq_func = NULL;
2151 2212                  sqp->sq_next = NULL;
2152 2213                  sigaddqins(p, t, sqp);
2153 2214          }
2154 2215          sigtoproc(p, t, sig);
↓ open down ↓ 735 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX