Subject: Re: Incorrect sigcontext when signal handler called??
To: Roger Brown <rogerhb@xtra.co.nz>
From: Sanjay Lal <sanjayl@iqmail.net>
List: port-macppc
Date: 04/03/2000 21:23:35
Found the bug. sigsend() in machdep.c was passing the pointer to the
kernel's local variable representing
the sigcontext instead of the actual pointer in the process's address
space. works like a charm now!
Regards
Sanjay
>
> ----------
> >From: Sanjay Lal <sanjayl@iqmail.net>
> >To: port-macppc@netbsd.org
> >Subject: Incorrect sigcontext when signal handler called??
> >Date: Mon, Apr 3, 2000, 8:19 pm
> >
>
> >I am running NetBSD 1.4.1 for the mac/ppc. There might be a bug here, I
> >am not sure.
> >The sigconext parameter (scp) passed
> >as parameter 3 to the signal handler might be incorrect. Any access to
> >this space,
> >(copying it, printing etc) hangs the process completely.
> >Has anyone else seen this or am I doing something completely wrong here?
> >
> >Any help would be greatly appreciated.
> >
> >Thanks in advance,
> >
> >Sanjay
> >sanjayl@iqmail.net
> >
> >
> >The small program below reproduces it:
> >#include <stdio.h>
> >#include <signal.h>
> >
> >void
> >sig_handler (int sig, int code, struct sigcontext * scp);
> >
> >int main (void)
> >{
> > struct sigaction act;
> >
> > /* Initialise the global signal action structure: */
> > sigfillset(&act.sa_mask);
> > act.sa_handler = (void (*) ()) sig_handler;
> > act.sa_flags = 0;
> >
> > if (sigaction (SIGINT, &act, NULL) != 0)
> > printf("sigaction failed\n");
> >
> >
> > sleep(100);
> >}
> >
> >void
> >sig_handler (int sig, int code, struct sigcontext * scp)
> >{
> > printf("sig: %d\tcode: %d\tscp: 0x%X\n", sig, code, scp);
> > printf("scp.sc_frame[r1]: 0x%X\n", scp->sc_frame.fixreg[1]);
> >}
> >