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.
This commit is contained in:
Alan Cox 2002-04-05 00:52:15 +00:00
parent 1bbfb90c3c
commit aa4d062142
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93847
4 changed files with 44 additions and 69 deletions

View file

@ -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,

View file

@ -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.
*/

View file

@ -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.

View file

@ -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);