Subject: Re: 2nd review of fixes to sig_return() and LDT's
To: Chris G. Demetriou <cgd@nobozo.CS.Berkeley.EDU>
From: John Brezak <brezak@apollo.hp.com>
List: port-i386
Date: 01/08/1994 00:21:56
> 
> 
> > > this shouldn't exist.  you shouldn't be mucking around with the
> > > process's signal mask, nor should you be insisting that the signal
> > > handler be the default one.
> > Should this be called in sendsig() then. This is where I got the idea...
> 
> *huh*?  no, leave sendsig() alone.  use trapsignal() where you detect
> the bogosity.  it's probably not "orthodox" to use trapsignal() here,
> but i'd call this a detection of a "would have been fault" -- if
> the data they provided would have caused the i[34]86 to fault, then
> deliver the signal in the way that you would if it had.  See
> .../i386/trap.c for a bit more info on what i mean.

What I mean to say is that i386/machdep.c::sendsig() uses this logic to
send a signal to the precess when a bad stack is detected.

sendsig(...)
        [...]
	if (useracc((caddr_t)fp, sizeof (struct sigframe), B_WRITE) == 0) {
		/*
		 * Process has trashed its stack; give it an illegal
		 * instruction to halt it in its tracks.
		 */
		SIGACTION(p, SIGILL) = SIG_DFL;
		sig = sigmask(SIGILL);
		p->p_sigignore &= ~sig;
		p->p_sigcatch &= ~sig;
		p->p_sigmask &= ~sig;
		psignal(p, SIGILL);
		return;
	}


> 
> > Even though it is most likely that a signal handler was the cause
> > of the error ? So I would invoke it again in this case ?
> 
> umm:
> 	(1) if it was the SIGBUS signal handler that was the cause
> 		of the error, you won't be able to deliver a sigbus,
> 		because it will be blocked (because the signal mask
> 		shouldn't have been restored yet), unless the user
> 		re-enable SIGBUS catching.
> 	(2) if the user enabled catching of SIGBUSs from within
> 		their SIGBUS handler, then by all means, give
> 		them another (and perhaps another, and another, etc.,
> 		until the exceed their stack limit!)
> 
Fine with me...

> 
> 
> chris

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 John Brezak                    UUCP:     uunet!apollo.hp!brezak
 Hewlett Packard/Apollo         Internet: brezak@ch.hp.com
 300 Apollo Drive               Phone:    (508) 436-4915
 Chelmsford, Massachusetts      Fax:      (508) 436-5103


------------------------------------------------------------------------------