diff options
author | jhb <jhb@FreeBSD.org> | 2001-03-07 03:37:06 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-03-07 03:37:06 +0000 |
commit | 9cd254601baefc2dc9c953abe9747717374ff8b1 (patch) | |
tree | ac4298224e8af28e8b2f904a43a2925c21dfc798 /sys | |
parent | ace71d59bf35fa6d911520ec855d0100773422a8 (diff) | |
download | FreeBSD-src-9cd254601baefc2dc9c953abe9747717374ff8b1.zip FreeBSD-src-9cd254601baefc2dc9c953abe9747717374ff8b1.tar.gz |
Grab the process lock while calling psignal and before calling psignal.
Diffstat (limited to 'sys')
36 files changed, 173 insertions, 45 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 7238cd1..ad8d116 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -1278,8 +1278,8 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -1418,8 +1418,8 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c index 7b53381..f84bd4a 100644 --- a/sys/alpha/osf1/osf1_signal.c +++ b/sys/alpha/osf1/osf1_signal.c @@ -619,8 +619,8 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 0dab6ae..87d274b 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -781,7 +781,9 @@ npx_intr(dummy) * * Treat them like a true async interrupt. */ + PROC_LOCK(curproc); psignal(curproc, SIGFPE); + PROC_UNLOCK(curproc); } mtx_unlock(&Giant); } diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0118473..5d9f8bd 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -510,8 +510,8 @@ osendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -592,7 +592,9 @@ osendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)fp; @@ -671,8 +673,8 @@ sendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -740,7 +742,9 @@ sendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)sfp; diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index 0dab6ae..87d274b 100644 --- a/sys/amd64/isa/npx.c +++ b/sys/amd64/isa/npx.c @@ -781,7 +781,9 @@ npx_intr(dummy) * * Treat them like a true async interrupt. */ + PROC_LOCK(curproc); psignal(curproc, SIGFPE); + PROC_UNLOCK(curproc); } mtx_unlock(&Giant); } diff --git a/sys/compat/linprocfs/linprocfs_vnops.c b/sys/compat/linprocfs/linprocfs_vnops.c index 55e3f52..722544a 100644 --- a/sys/compat/linprocfs/linprocfs_vnops.c +++ b/sys/compat/linprocfs/linprocfs_vnops.c @@ -300,13 +300,13 @@ linprocfs_ioctl(ap) PROC_UNLOCK(procp); return EINVAL; /* Can only start a stopped process */ } - PROC_UNLOCK(procp); if ((signo = *(int*)ap->a_data) != 0) { - if (signo >= NSIG || signo <= 0) + if (signo >= NSIG || signo <= 0) { + PROC_UNLOCK(procp); return EINVAL; + } psignal(procp, signo); } - PROC_LOCK(procp); procp->p_step = 0; PROC_UNLOCK(procp); wakeup(&procp->p_step); diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c index 87e8482..843a26b 100644 --- a/sys/compat/svr4/svr4_stream.c +++ b/sys/compat/svr4/svr4_stream.c @@ -216,8 +216,11 @@ svr4_sendit(p, s, mp, flags) if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; - if (error == EPIPE) + if (error == EPIPE) { + PROC_LOCK(p); psignal(p, SIGPIPE); + PROC_UNLOCK(p); + } } if (error == 0) p->p_retval[0] = len - auio.uio_resid; diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index 7bac404..30a983e 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -765,7 +765,9 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, cur_scp->mouse_proc = NULL; cur_scp->mouse_pid = 0; } else { + PROC_LOCK(cur_scp->mouse_proc); psignal(cur_scp->mouse_proc, cur_scp->mouse_signal); + PROC_UNLOCK(cur_scp->mouse_proc); break; } } @@ -818,7 +820,9 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, cur_scp->mouse_proc = NULL; cur_scp->mouse_pid = 0; } else { + PROC_LOCK(cur_scp->mouse_proc); psignal(cur_scp->mouse_proc, cur_scp->mouse_signal); + PROC_UNLOCK(cur_scp->mouse_proc); break; } } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 452c8e0..631daa4 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -2300,7 +2300,9 @@ signal_vt_rel(scr_stat *scp) if (scp->smode.mode != VT_PROCESS) return FALSE; scp->status |= SWITCH_WAIT_REL; + PROC_LOCK(scp->proc); psignal(scp->proc, scp->smode.relsig); + PROC_UNLOCK(scp->proc); DPRINTF(5, ("sending relsig to %d\n", scp->pid)); return TRUE; } @@ -2313,7 +2315,9 @@ signal_vt_acq(scr_stat *scp) if (scp->sc->unit == sc_console_unit) cons_unavail = TRUE; scp->status |= SWITCH_WAIT_ACQ; + PROC_LOCK(scp->proc); psignal(scp->proc, scp->smode.acqsig); + PROC_UNLOCK(scp->proc); DPRINTF(5, ("sending acqsig to %d\n", scp->pid)); return TRUE; } diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 1cdd455..f413c3b 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -366,7 +366,9 @@ uhid_intr(xfer, addr, status) selwakeup(&sc->sc_rsel); if (sc->sc_async != NULL) { DPRINTFN(3, ("uhid_intr: sending SIGIO %p\n", sc->sc_async)); + PROC_LOCK(sc->sc_async); psignal(sc->sc_async, SIGIO); + PROC_UNLOCK(sc->sc_async); } } diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index f917d1f..5382ec0 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -51,13 +51,13 @@ #if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/device.h> #include <sys/kthread.h> -#include <sys/proc.h> #elif defined(__FreeBSD__) #include <sys/module.h> #include <sys/bus.h> #include <sys/filio.h> #include <sys/uio.h> #endif +#include <sys/proc.h> #include <sys/conf.h> #include <sys/poll.h> #if __FreeBSD_version >= 500014 @@ -683,8 +683,11 @@ usbd_add_event(type, dev) SIMPLEQ_INSERT_TAIL(&usb_events, ueq, next); wakeup(&usb_events); selwakeup(&usb_selevent); - if (usb_async_proc != NULL) + if (usb_async_proc != NULL) { + PROC_LOCK(usb_async_proc); psignal(usb_async_proc, SIGIO); + PROC_UNLOCK(usb_async_proc); + } splx(s); } diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index fb7b83d..8ed27a0 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -654,7 +654,9 @@ msdosfs_write(ap) if (p && ((uoff_t)uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur)) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index 116b0d9..f6344e0 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -237,7 +237,9 @@ nwfs_writevnode(vp, uiop, cred, ioflag) } if (uiop->uio_resid == 0) return 0; if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cred); diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c index 64065c3..62bc27a 100644 --- a/sys/gnu/ext2fs/ext2_readwrite.c +++ b/sys/gnu/ext2fs/ext2_readwrite.c @@ -222,7 +222,9 @@ WRITE(ap) if (vp->v_type == VREG && p && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index 64065c3..62bc27a 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -222,7 +222,9 @@ WRITE(ap) if (vp->v_type == VREG && p && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 0118473..5d9f8bd 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -510,8 +510,8 @@ osendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -592,7 +592,9 @@ osendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)fp; @@ -671,8 +673,8 @@ sendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -740,7 +742,9 @@ sendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)sfp; diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 0dab6ae..87d274b 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -781,7 +781,9 @@ npx_intr(dummy) * * Treat them like a true async interrupt. */ + PROC_LOCK(curproc); psignal(curproc, SIGFPE); + PROC_UNLOCK(curproc); } mtx_unlock(&Giant); } diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c index 50ded4e..3f0e954 100644 --- a/sys/i386/isa/pcvt/pcvt_ext.c +++ b/sys/i386/isa/pcvt/pcvt_ext.c @@ -2294,11 +2294,17 @@ vgapage(int new_screen) /* Try resignaling uncooperative X-window servers */ if (vsp->smode.mode == VT_PROCESS) { if (vsp->vt_status & VT_WAIT_REL) { - if(vsp->smode.relsig) + if(vsp->smode.relsig) { + PROC_LOCK(vsp->proc); psignal(vsp->proc, vsp->smode.relsig); + PROC_UNLOCK(vsp->proc); + } } else if (vsp->vt_status & VT_WAIT_ACK) { - if(vsp->smode.acqsig) + if(vsp->smode.acqsig) { + PROC_LOCK(vsp->proc); psignal(vsp->proc, vsp->smode.acqsig); + PROC_UNLOCK(vsp->proc); + } } } return EAGAIN; @@ -2310,8 +2316,11 @@ vgapage(int new_screen) { /* we cannot switch immediately here */ vsp->vt_status |= VT_WAIT_REL; - if(vsp->smode.relsig) + if(vsp->smode.relsig) { + PROC_LOCK(vsp->proc); psignal(vsp->proc, vsp->smode.relsig); + PROC_UNLOCK(vsp->proc); + } } else { @@ -2341,8 +2350,11 @@ vgapage(int new_screen) { /* if _new_ vt is under process control... */ vsp->vt_status |= VT_WAIT_ACK; - if(vsp->smode.acqsig) + if(vsp->smode.acqsig) { + PROC_LOCK(vsp->proc); psignal(vsp->proc, vsp->smode.acqsig); + PROC_UNLOCK(vsp->proc); + } } else { @@ -2502,9 +2514,12 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) */ vsp->vt_status |= VT_WAIT_ACK; - if(vsp->smode.acqsig) + if(vsp->smode.acqsig) { + PROC_LOCK(vsp->proc); psignal(vsp->proc, vsp->smode.acqsig); + PROC_UNLOCK(vsp->proc); + } } else { diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 4c638d5..96272df 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -266,8 +266,11 @@ spigintr(int unit) { struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit]; - if(ss->p && ss->signal_num) + if(ss->p && ss->signal_num) { + PROC_LOCK(ss->p); psignal(ss->p, ss->signal_num); + PROC_UNLOCK(ss->p); + } } static int diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index dc20e07..8050392 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -246,13 +246,13 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); #ifdef DEBUG if (ldebug(sigreturn)) printf(LMSG("rt_sendsig: bad stack %p, oonstack=%x"), fp, oonstack); #endif psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -320,6 +320,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); sigexit(p, SIGILL); /* NOTREACHED */ } @@ -404,8 +405,8 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -454,6 +455,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); sigexit(p, SIGILL); /* NOTREACHED */ } diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c index 00bb45a..1541835 100644 --- a/sys/i386/svr4/svr4_machdep.c +++ b/sys/i386/svr4/svr4_machdep.c @@ -467,6 +467,7 @@ svr4_sendsig(catcher, sig, mask, code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); sigexit(p, SIGILL); /* NOTREACHED */ } diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 0b8ccae..08452ca 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -843,8 +843,8 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index b5a9c41..a779711 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -411,8 +411,11 @@ dofilewrite(p, fp, fd, buf, nbyte, offset, flags) if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; - if (error == EPIPE) + if (error == EPIPE) { + PROC_LOCK(p); psignal(p, SIGPIPE); + PROC_UNLOCK(p); + } } cnt -= auio.uio_resid; #ifdef KTRACE @@ -504,8 +507,11 @@ writev(p, uap) if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; - if (error == EPIPE) + if (error == EPIPE) { + PROC_LOCK(p); psignal(p, SIGPIPE); + PROC_UNLOCK(p); + } } cnt -= auio.uio_resid; #ifdef KTRACE diff --git a/sys/kern/tty.c b/sys/kern/tty.c index a7ba12d..d57135d 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1467,8 +1467,14 @@ ttymodem(tp, flag) !ISSET(tp->t_cflag, CLOCAL)) { SET(tp->t_state, TS_ZOMBIE); CLR(tp->t_state, TS_CONNECTED); - if (tp->t_session && tp->t_session->s_leader) - psignal(tp->t_session->s_leader, SIGHUP); + if (tp->t_session && tp->t_session->s_leader) { + struct proc *p; + + p = tp->t_session->s_leader; + PROC_LOCK(p); + psignal(p, SIGHUP); + PROC_UNLOCK(p); + } ttyflush(tp, FREAD | FWRITE); return (0); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 6aed023..c46b7ea 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -593,8 +593,11 @@ sendit(p, s, mp, flags) if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; - if (error == EPIPE) + if (error == EPIPE) { + PROC_LOCK(p); psignal(p, SIGPIPE); + PROC_UNLOCK(p); + } } if (error == 0) p->p_retval[0] = len - auio.uio_resid; diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index f9d93a5..c8c2da8 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -609,8 +609,11 @@ aio_process(struct aiocblist *aiocbe) if ((error) && (auio.uio_resid != cnt)) { if (error == ERESTART || error == EINTR || error == EWOULDBLOCK) error = 0; - if ((error == EPIPE) && (cb->aio_lio_opcode == LIO_WRITE)) + if ((error == EPIPE) && (cb->aio_lio_opcode == LIO_WRITE)) { + PROC_LOCK(userp); psignal(userp, SIGPIPE); + PROC_UNLOCK(userp); + } } cnt -= auio.uio_resid; @@ -800,10 +803,11 @@ aio_daemon(void *uproc) lj->lioj_queue_count) && (lj->lioj_buffer_finished_count == lj->lioj_buffer_count)) { - psignal(userp, - lj->lioj_signal.sigev_signo); - lj->lioj_flags |= - LIOJ_SIGNAL_POSTED; + PROC_LOCK(userp); + psignal(userp, + lj->lioj_signal.sigev_signo); + PROC_UNLOCK(userp); + lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } splx(s); @@ -834,7 +838,9 @@ aio_daemon(void *uproc) } if (cb->aio_sigevent.sigev_notify == SIGEV_SIGNAL) { + PROC_LOCK(userp); psignal(userp, cb->aio_sigevent.sigev_signo); + PROC_UNLOCK(userp); } } @@ -1695,8 +1701,11 @@ aio_cancel(struct proc *p, struct aio_cancel_args *uap) cancelled++; /* XXX cancelled, knote? */ if (cbe->uaiocb.aio_sigevent.sigev_notify == - SIGEV_SIGNAL) + SIGEV_SIGNAL) { + PROC_LOCK(cbe->userproc); psignal(cbe->userproc, cbe->uaiocb.aio_sigevent.sigev_signo); + PROC_UNLOCK(cbe->userproc); + } if (uap->aiocbp) break; } @@ -1734,8 +1743,11 @@ aio_cancel(struct proc *p, struct aio_cancel_args *uap) cbe->uaiocb._aiocb_private.error = ECANCELED; /* XXX cancelled, knote? */ if (cbe->uaiocb.aio_sigevent.sigev_notify == - SIGEV_SIGNAL) + SIGEV_SIGNAL) { + PROC_LOCK(cbe->userproc); psignal(cbe->userproc, cbe->uaiocb.aio_sigevent.sigev_signo); + PROC_UNLOCK(cbe->userproc); + } } else { notcancelled++; } @@ -2050,13 +2062,18 @@ process_signal(void *aioj) struct aiocb *cb = &aiocbe->uaiocb; if ((lj) && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL) && - (lj->lioj_queue_count == lj->lioj_queue_finished_count)) { + (lj->lioj_queue_count == lj->lioj_queue_finished_count)) { + PROC_LOCK(lj->lioj_ki->kaio_p); psignal(lj->lioj_ki->kaio_p, lj->lioj_signal.sigev_signo); + PROC_UNLOCK(lj->lioj_ki->kaio_p); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } - if (cb->aio_sigevent.sigev_notify == SIGEV_SIGNAL) + if (cb->aio_sigevent.sigev_notify == SIGEV_SIGNAL) { + PROC_LOCK(aiocbe->userproc); psignal(aiocbe->userproc, cb->aio_sigevent.sigev_signo); + PROC_UNLOCK(aiocbe->userproc); + } } /* diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index fb7b83d..8ed27a0 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -654,7 +654,9 @@ msdosfs_write(ap) if (p && ((uoff_t)uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur)) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 09585bf..0c30ca3 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -823,7 +823,9 @@ restart: */ if (p && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); if (haverslock) nfs_rsunlock(np, p); return (EFBIG); @@ -1440,8 +1442,10 @@ nfs_doio(bp, cr, p) (!(nmp->nm_flag & NFSMNT_NQNFS) && np->n_mtime != np->n_vattr.va_mtime.tv_sec))) { uprintf("Process killed due to text file modification\n"); + PROC_LOCK(p); psignal(p, SIGKILL); - PHOLD(p); + _PHOLD(p); + PROC_UNLOCK(p); } break; case VLNK: diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 09585bf..0c30ca3 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -823,7 +823,9 @@ restart: */ if (p && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); if (haverslock) nfs_rsunlock(np, p); return (EFBIG); @@ -1440,8 +1442,10 @@ nfs_doio(bp, cr, p) (!(nmp->nm_flag & NFSMNT_NQNFS) && np->n_mtime != np->n_vattr.va_mtime.tv_sec))) { uprintf("Process killed due to text file modification\n"); + PROC_LOCK(p); psignal(p, SIGKILL); - PHOLD(p); + _PHOLD(p); + PROC_UNLOCK(p); } break; case VLNK: diff --git a/sys/nwfs/nwfs_io.c b/sys/nwfs/nwfs_io.c index 116b0d9..f6344e0 100644 --- a/sys/nwfs/nwfs_io.c +++ b/sys/nwfs/nwfs_io.c @@ -237,7 +237,9 @@ nwfs_writevnode(vp, uiop, cred, ioflag) } if (uiop->uio_resid == 0) return 0; if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); return (EFBIG); } error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cred); diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index ab2e253..ffbfd04 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -523,8 +523,8 @@ osendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -605,7 +605,9 @@ osendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)fp; @@ -684,8 +686,8 @@ sendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -753,7 +755,9 @@ sendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)sfp; diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index ab2e253..ffbfd04 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -523,8 +523,8 @@ osendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -605,7 +605,9 @@ osendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)fp; @@ -684,8 +686,8 @@ sendsig(catcher, sig, mask, code) SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); - PROC_UNLOCK(p); psignal(p, SIGILL); + PROC_UNLOCK(p); return; } @@ -753,7 +755,9 @@ sendsig(catcher, sig, mask, code) * Something is wrong with the stack pointer. * ...Kill the process. */ + PROC_LOCK(p); sigexit(p, SIGILL); + /* NOTREACHED */ } regs->tf_esp = (int)sfp; diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index 75176b3..e31e308 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -835,7 +835,9 @@ npx_intr(dummy) * * Treat them like a true async interrupt. */ + PROC_LOCK(p); psignal(curproc, SIGFPE); + PROC_UNLOCK(p); } mtx_unlock(&Giant); } diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index adb0e7c..b157f4a 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -2314,7 +2314,9 @@ signal_vt_rel(scr_stat *scp) if (scp->smode.mode != VT_PROCESS) return FALSE; scp->status |= SWITCH_WAIT_REL; + PROC_LOCK(scp->proc); psignal(scp->proc, scp->smode.relsig); + PROC_UNLOCK(scp->proc); DPRINTF(5, ("sending relsig to %d\n", scp->pid)); return TRUE; } @@ -2327,7 +2329,9 @@ signal_vt_acq(scr_stat *scp) if (scp->sc->unit == sc_console_unit) cons_unavail = TRUE; scp->status |= SWITCH_WAIT_ACQ; + PROC_LOCK(scp->proc); psignal(scp->proc, scp->smode.acqsig); + PROC_UNLOCK(scp->proc); DPRINTF(5, ("sending acqsig to %d\n", scp->pid)); return TRUE; } diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index d9fe31a..088ca7c 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -649,8 +649,11 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the field is complete. */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) + if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) { + PROC_LOCK(mtr->proc); psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + PROC_UNLOCK(mtr->proc); + } } if (status & 0x2) { /* odd field */ mtr->odd_fields_captured++; @@ -663,8 +666,11 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the field is complete. */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) + if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) { + PROC_LOCK(mtr->proc); psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + PROC_UNLOCK(mtr->proc); + } } /* @@ -696,8 +702,11 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the frame is complete. */ - if(mtr->proc && !(mtr->signal & METEOR_SIG_MODE_MASK)) + if(mtr->proc && !(mtr->signal & METEOR_SIG_MODE_MASK)) { + PROC_LOCK(mtr->proc); psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + PROC_UNLOCK(mtr->proc); + } /* * Reset the want flags if in continuous or * synchronous capture mode. diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 62ec9e3..27e1d69 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -440,7 +440,9 @@ WRITE(ap) if (vp->v_type == VREG && p && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(p); psignal(p, SIGXFSZ); + PROC_UNLOCK(p); if (object) vm_object_vndeallocate(object); return (EFBIG); |