o Kill the MD grow_stack(). Call the MI vm_map_growstack()

in its place.
 o Eliminate the use of useracc() and grow_stack() from sendsig().

Reviewed by:	peter
This commit is contained in:
Alan Cox 2002-04-04 06:59:18 +00:00
parent 56f2a75b76
commit 09d30f2c8d
3 changed files with 21 additions and 37 deletions

View File

@ -864,30 +864,11 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
sfp = (struct sigframe *)(frame->tf_r[FRAME_SP] - 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;
}
#if 0
/* save the floating-point state, if necessary, then copy it. */
@ -902,7 +883,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

@ -587,13 +587,13 @@ trap(int vector, int imm, struct trapframe *framep)
/*
* Grow the stack if necessary
*/
/* grow_stack returns false only if va falls into
/* vm_map_growstack fails only if va falls into
* a growable stack region and the stack growth
* fails. It returns true if va was not within
* fails. It succeeds if va was not within
* a growable stack region, or if the stack
* growth succeeded.
*/
if (!grow_stack (p, va))
if (vm_map_growstack(p, va) != KERN_SUCCESS)
rv = KERN_FAILURE;
else
/* Fault in the user page: */

View File

@ -418,20 +418,6 @@ cpu_reset()
cpu_boot(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.
*/