[parisc-linux] signal handling problems (32 bit kernel)

Richard Hirst rhirst@linuxcare.com
Tue, 21 Nov 2000 09:34:42 +0000


On Tue, Nov 21, 2000 at 06:05:36PM +1100, Alan Modra wrote:
> On Mon, 20 Nov 2000, Richard Hirst wrote:
> 
> > #warning XXX FIXME probably bogus -PB
> >         /* I think this is bogus -- it'll cause the first instn of the
> >          * signal handler to be executed twice!  Better might be to
> 
> Definitely bogus, as with quite a lot of iaoq manipulation in signal.c

As another example, if a process gets a signal as it is about to
execute the instr in the delay slot of a branch, it forgets that it
was supposed to be branching on return from the signal handler.  Try
compiling the following and sending it a SIGUSR1:

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>

void sig_handler(int sig)
{
}

int main()
{
        struct sigaction act;
        int i = 1;

        memset(&act, 0, sizeof(act));
        act.sa_handler = sig_handler;
        sigaction(SIGUSR1, &act, NULL);

        printf("I am %d\n", getpid());
        while (i++)
                ;
        printf("Escaped, i=%d!\n", i);
        return 0;
}


Oh, you have to run it with "LD_BIND_NOW=1 <progname>" to avoid one of
the other problems.

Time to try and work out what signal.c is really trying to do, I guess.

Richard