diff options
author | alc <alc@FreeBSD.org> | 2002-04-05 00:52:15 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-04-05 00:52:15 +0000 |
commit | e18fd6050bf300b0ac49c9c8f7fb14fd66b24c0b (patch) | |
tree | 947cd1208f44955f307ee130a546fdd3f815f9d1 /sys | |
parent | 4fc12f7b6d1d2d00449fa0d0b802ab7af56c9b94 (diff) | |
download | FreeBSD-src-e18fd6050bf300b0ac49c9c8f7fb14fd66b24c0b.zip FreeBSD-src-e18fd6050bf300b0ac49c9c8f7fb14fd66b24c0b.tar.gz |
o Eliminate the use of grow_stack() and useracc() from sendsig(), osendsig(),
and osf1_sendsig().
o Eliminate the prototype for the MD grow_stack() now that it has been removed
from all platforms.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/machdep.c | 68 | ||||
-rw-r--r-- | sys/alpha/alpha/vm_machdep.c | 15 | ||||
-rw-r--r-- | sys/alpha/osf1/osf1_signal.c | 29 | ||||
-rw-r--r-- | sys/vm/vm_extern.h | 1 |
4 files changed, 44 insertions, 69 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index a8b1abf..2b8f8b5 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -1204,21 +1204,6 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); PROC_UNLOCK(p); - (void)grow_stack(p, (u_long)sip); - if (!useracc((caddr_t)sip, fsize, VM_PROT_WRITE)) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - SIGACTION(p, SIGILL) = SIG_DFL; - SIGDELSET(p->p_sigignore, SIGILL); - SIGDELSET(p->p_sigcatch, SIGILL); - SIGDELSET(p->p_sigmask, SIGILL); - psignal(p, SIGILL); - return; - } - /* * Build the signal context to be used by sigreturn. */ @@ -1255,7 +1240,19 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) /* * copy the frame out to userland. */ - (void) copyout((caddr_t)&ksi, (caddr_t)sip, fsize); + if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) { + /* + * Process has trashed its stack; give it an illegal + * instruction to halt it in its tracks. + */ + PROC_LOCK(p); + SIGACTION(p, SIGILL) = SIG_DFL; + SIGDELSET(p->p_sigignore, SIGILL); + SIGDELSET(p->p_sigcatch, SIGILL); + SIGDELSET(p->p_sigmask, SIGILL); + psignal(p, SIGILL); + return; + } /* * Set up the registers to return to sigcode. @@ -1338,31 +1335,11 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) sfp = (struct sigframe *)(alpha_pal_rdusp() - rndfsize); PROC_UNLOCK(p); - (void)grow_stack(p, (u_long)sfp); #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid, sig, &sf, sfp); #endif - if (!useracc((caddr_t)sfp, sizeof(sf), VM_PROT_WRITE)) { -#ifdef DEBUG - if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("sendsig(%d): useracc failed on sig %d\n", - p->p_pid, sig); -#endif - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - SIGACTION(p, SIGILL) = SIG_DFL; - SIGDELSET(p->p_sigignore, SIGILL); - SIGDELSET(p->p_sigcatch, SIGILL); - SIGDELSET(p->p_sigmask, SIGILL); - psignal(p, SIGILL); - return; - } - /* save the floating-point state, if necessary, then copy it. */ alpha_fpstate_save(td, 1); sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDP_FPUSED; @@ -1380,7 +1357,24 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) /* * copy the frame out to userland. */ - (void) copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)); + if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) { +#ifdef DEBUG + if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) + printf("sendsig(%d): copyout failed on sig %d\n", + p->p_pid, sig); +#endif + /* + * Process has trashed its stack; give it an illegal + * instruction to halt it in its tracks. + */ + PROC_LOCK(p); + SIGACTION(p, SIGILL) = SIG_DFL; + SIGDELSET(p->p_sigignore, SIGILL); + SIGDELSET(p->p_sigcatch, SIGILL); + SIGDELSET(p->p_sigmask, SIGILL); + psignal(p, SIGILL); + return; + } #ifdef DEBUG if (sigdebug & SDB_FOLLOW) printf("sendsig(%d): sig %d sfp %p code %lx\n", p->p_pid, sig, diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 467f4fa..4209cce 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -352,21 +352,6 @@ cpu_reset() prom_halt(0); } -int -grow_stack(p, sp) - struct proc *p; - size_t sp; -{ - int rv; - - rv = vm_map_growstack (p, sp); - if (rv != KERN_SUCCESS) - return (0); - - return (1); -} - - /* * Software interrupt handler for queued VM system processing. */ diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c index 61803e7..67ae47d 100644 --- a/sys/alpha/osf1/osf1_signal.c +++ b/sys/alpha/osf1/osf1_signal.c @@ -616,21 +616,6 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); PROC_UNLOCK(p); - (void)grow_stack(p, (u_long)sip); - if (useracc((caddr_t)sip, fsize, VM_PROT_WRITE) == 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - SIGACTION(p, SIGILL) = SIG_DFL; - SIGDELSET(p->p_sigignore, SIGILL); - SIGDELSET(p->p_sigcatch, SIGILL); - SIGDELSET(p->p_sigmask, SIGILL); - psignal(p, SIGILL); - return; - } - /* * Build the signal context to be used by sigreturn. */ @@ -667,7 +652,19 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) /* * copy the frame out to userland. */ - (void) copyout((caddr_t)&ksi, (caddr_t)sip, fsize); + if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) { + /* + * Process has trashed its stack; give it an illegal + * instruction to halt it in its tracks. + */ + PROC_LOCK(p); + SIGACTION(p, SIGILL) = SIG_DFL; + SIGDELSET(p->p_sigignore, SIGILL); + SIGDELSET(p->p_sigcatch, SIGILL); + SIGDELSET(p->p_sigmask, SIGILL); + psignal(p, SIGILL); + return; + } /* * Set up the registers to return to sigcode. diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index da72708..b841329 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -59,7 +59,6 @@ int sstk(struct thread *, void *, int *); int swapon(struct thread *, void *, int *); #endif /* TYPEDEF_FOR_UAP */ -int grow_stack(struct proc *, size_t); int kernacc(caddr_t, int, int); vm_offset_t kmem_alloc(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); |