X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/bdfe5b0f835721d7641bc6cafbcaca40ce03beb9..8a80d25019850d64899971ff4cc0900d186a0c76:/usr/src/sys/kern/kern_proc.c diff --git a/usr/src/sys/kern/kern_proc.c b/usr/src/sys/kern/kern_proc.c index e08ed2f63e..1c72a95e44 100644 --- a/usr/src/sys/kern/kern_proc.c +++ b/usr/src/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* kern_proc.c 3.5 %H% */ +/* kern_proc.c 3.14 %G% */ #include "../h/param.h" #include "../h/systm.h" @@ -12,7 +12,7 @@ #include "../h/inode.h" #include "../h/seg.h" #include "../h/acct.h" -#include +#include "/usr/include/wait.h" #include "../h/pte.h" #include "../h/vm.h" #include "../h/text.h" @@ -61,7 +61,7 @@ exece() ne = 0; nc = 0; uap = (struct execa *)u.u_ap; - if ((bno = malloc(swapmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) { + if ((bno = malloc(argmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) { swkill(u.u_procp, "exece"); goto bad; } @@ -99,7 +99,8 @@ exece() if ((nc&BMASK) == 0) { if (bp) bdwrite(bp); - bp = getblk(swapdev, (daddr_t)(dbtofsb(swplo+bno)+(nc>>BSHIFT))); + bp = getblk(argdev, + (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT))); cp = bp->b_un.b_addr; } nc++; @@ -113,7 +114,7 @@ exece() if (getxfile(ip, nc) || u.u_error) { badarg: for (c = 0; c < nc; c += BSIZE) - if (bp = baddr(swapdev, dbtofsb(swplo+bno)+(c>>BSHIFT))) { + if (bp = baddr(argdev, dbtofsb(bno)+(c>>BSHIFT))) { bp->b_flags |= B_AGE; /* throw away */ bp->b_flags &= ~B_DELWRI; /* cancel io */ brelse(bp); @@ -144,7 +145,8 @@ badarg: if ((nc&BMASK) == 0) { if (bp) brelse(bp); - bp = bread(swapdev, (daddr_t)(dbtofsb(swplo+bno)+(nc>>BSHIFT))); + bp = bread(argdev, + (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT))); bp->b_flags |= B_AGE; /* throw away */ bp->b_flags &= ~B_DELWRI; /* cancel io */ cp = bp->b_un.b_addr; @@ -160,7 +162,7 @@ bad: if (bp) brelse(bp); if (bno) - mfree(swapmap, ctod(clrnd((int) btoc(NCARGS))), bno); + mfree(argmap, ctod(clrnd((int) btoc(NCARGS))), bno); iput(ip); } @@ -253,7 +255,8 @@ register struct inode *ip; ds = clrnd(btoc((u.u_exdata.ux_dsize+u.u_exdata.ux_bsize))); ss = clrnd(SSIZE + btoc(nargc)); if (overlay) { - if ((u.u_procp->p_flag & SPAGI) || u.u_sep==0 && ctos(ts) != ctos(u.u_tsize) || nargc) { + if ((u.u_procp->p_flag & SPAGI) || + u.u_sep==0 && ctos(ts) != ctos(u.u_tsize) || nargc) { u.u_error = ENOMEM; goto bad; } @@ -312,7 +315,7 @@ register struct inode *ip; 1 + ts/CLSIZE, (int)btoc(u.u_exdata.ux_dsize)); /* THIS SHOULD BE DONE AT A LOWER LEVEL, IF AT ALL */ - mtpr(TBIA,1); + mtpr(TBIA, 0); /* * set SUID/SGID protections, if no tracing @@ -356,14 +359,10 @@ setregs() 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 @@ -372,6 +371,7 @@ setregs() u.u_procp->p_siga1 |= sigmask; else u.u_procp->p_siga1 &= ~sigmask; + (void) spl0(); continue; } } @@ -437,9 +437,8 @@ exit(rv) 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; for(i=0; ip_stat = SZOMB; i = PIDHASH(p->p_pid); x = p - proc; @@ -494,15 +494,28 @@ done: if(q->p_pptr == p) { q->p_pptr = &proc[1]; q->p_ppid = 1; + q->p_flag |= SDETACH; wakeup((caddr_t)&proc[1]); /* - * Stopped or traced processes are killed + * Traced processes are killed * 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); + } else if (q->p_stat == SSTOP) { + psignal(q, SIGHUP); + psignal(q, SIGCONT); } + /* + * Protect this process from future + * tty signals, and clear TSTP/TTIN/TTOU if pending. + */ + spgrp(q, -1); } wakeup((caddr_t)p->p_pptr); psignal(p->p_pptr, SIGCHLD); @@ -581,10 +594,12 @@ loop: u.u_r.r_val1 = 0; return; } +/* if (setjmp(u.u_qsav)) { u.u_eosys = RESTARTSYS; return; } +*/ sleep((caddr_t)u.u_procp, PWAIT); goto loop; }