reformat
[unix-history] / usr / src / sys / kern / kern_proc.c
index e08ed2f..16ab001 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_proc.c     3.5     %H%     */
+/*     kern_proc.c     3.7     %H%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -356,14 +356,10 @@ setregs()
 
                default:
                        /*
 
                default:
                        /*
-                        * Normal or deferring catch.
-                        * If deferred, now hold it, else
-                        * revert to default.
+                        * Normal or deferring catch; revert to default.
                         */
                         */
-                       if (SIGISDEFER(*rp))
-                               *rp = SIG_HOLD;
-                       else
-                               *rp = SIG_DFL;
+                       (void) spl6();
+                       *rp = SIG_DFL;
                        if ((int)*rp & 1)
                                u.u_procp->p_siga0 |= sigmask;
                        else
                        if ((int)*rp & 1)
                                u.u_procp->p_siga0 |= sigmask;
                        else
@@ -372,6 +368,7 @@ setregs()
                                u.u_procp->p_siga1 |= sigmask;
                        else
                                u.u_procp->p_siga1 &= ~sigmask;
                                u.u_procp->p_siga1 |= sigmask;
                        else
                                u.u_procp->p_siga1 &= ~sigmask;
+                       (void) spl0();
                        continue;
                }
        }
                        continue;
                }
        }
@@ -437,7 +434,7 @@ exit(rv)
        if ((int)SIG_IGN & 2)
                p->p_siga1 = ~0;
        else
        if ((int)SIG_IGN & 2)
                p->p_siga1 = ~0;
        else
-               p->p_siga0 = 0;
+               p->p_siga1 = 0;
        (void) spl0();
        rate.v_pgin -= p->p_aveflt;
        p->p_aveflt = 0;
        (void) spl0();
        rate.v_pgin -= p->p_aveflt;
        p->p_aveflt = 0;
@@ -496,12 +493,25 @@ done:
                        q->p_ppid = 1;
                        wakeup((caddr_t)&proc[1]);
                        /*
                        q->p_ppid = 1;
                        wakeup((caddr_t)&proc[1]);
                        /*
-                        * Stopped or traced processes are killed
+                        * Traced processes are killed
                         * since their existence means someone is screwing up.
                         * since their existence means someone is screwing up.
+                        * Traced processes are sent a hangup and a continue.
+                        * This is designed to be ``safe'' for setuid
+                        * processes since they must be willing to tolerate
+                        * hangups anyways.
                         */
                         */
-                       if (q->p_stat == SSTOP || q->p_flag&STRC) {
+                       if (q->p_flag&STRC) {
                                q->p_flag &= ~STRC;
                                psignal(q, SIGKILL);
                                q->p_flag &= ~STRC;
                                psignal(q, SIGKILL);
+                       } else if (q->p_stat == SSTOP) {
+                               psignal(q, SIGHUP);
+                               psignal(q, SIGCONT);
+                               /*
+                                * Protect this process from future
+                                * tty signals, and clear TSTP if pending.
+                                */
+                               q->p_pgrp = 0;
+                               q->p_sig &= ~(1<<(SIGTSTP-1));
                        }
                }
        wakeup((caddr_t)p->p_pptr);
                        }
                }
        wakeup((caddr_t)p->p_pptr);
@@ -581,10 +591,12 @@ loop:
                u.u_r.r_val1 = 0;
                return;
        }
                u.u_r.r_val1 = 0;
                return;
        }
+/*
        if (setjmp(u.u_qsav)) {
                u.u_eosys = RESTARTSYS;
                return;
        }
        if (setjmp(u.u_qsav)) {
                u.u_eosys = RESTARTSYS;
                return;
        }
+*/
        sleep((caddr_t)u.u_procp, PWAIT);
        goto loop;
 }
        sleep((caddr_t)u.u_procp, PWAIT);
        goto loop;
 }