Subject: sigsp's.. blah blah
To: None <port-sparc@NetBSD.ORG>
From: Jay Koski <jayk@eskimo.com>
List: port-sparc
Date: 09/14/1995 19:09:44
	On our machine isumataq.eskimo.com, which is a SPARCstation IPX
running SunOS 4.1.4c, we see these about 50 times a day.

isumataq vmunix: sendsig: bad signal stack pid=124, sig=14
isumataq vmunix: sigsp = 0xf7fff588, action = 0xf7712c28, upc = 0xf7712920

	I'm curious if anyone out there knows why this happens and
how to fix it? Will this happen if I move to to netbsd-current? I'm
not sure if it's a CPU bug, bad memory, or a buggy kernel. I may be
looking into running NetBSD over SunOS if this will fix the problem.

	When a sendsig/sigsp happen (they occur both at the same time),
it kills the process (pid 124 in this example). It generally happens
when the machine is heavily loaded, during peak hours, but have never
seen it happen in the wee hours of the morning when it ain't doin much.

>From machdep.c :

        /*
         * Make sure the current last user window has been flushed to
         * the stack save area before we change the sp.
         */
        flush_user_windows_to_stack();
        regs = u.u_ar0;
        oonstack = u.u_onstack;
        if (!u.u_onstack && (u.u_sigonstack & sigmask(sig))) {
                fp = (struct sigframe *)
                    ((int)u.u_sigsp - SA(sizeof (struct sigframe)));
                u.u_onstack = 1;
        } else {
                fp = (struct sigframe *)
                    ((int)regs[SP] - SA(sizeof (struct sigframe)));
        }
        /*
         * Allocate and validate space for the signal handler
         * context.  on_fault will catch any faults.
         */
        if (((int)fp & (STACK_ALIGN-1)) != 0 ||
            (caddr_t)fp >= (caddr_t)KERNELBASE || on_fault()) {
                /*
                 * Process has trashed its stack; give it an illegal
                 * instruction to halt it in its tracks.
                 */
                printf("sendsig: bad signal stack pid=%d, sig=%d\n",
                    u.u_procp->p_pid, sig);
                printf("sigsp = 0x%x, action = 0x%x, upc = 0x%x\n",
                    fp, p, regs[PC]);
                u.u_signal[SIGILL] = SIG_DFL;
                sig = sigmask(SIGILL);
                u.u_procp->p_sigignore &= ~sig;
                u.u_procp->p_sigcatch &= ~sig;
                u.u_procp->p_sigmask &= ~sig;
                psignal(u.u_procp, SIGILL);
                return;
        }

	Any feedback would be appreciated. 

Thanks.