Re: signal(SIGFPE,SIG_IGN) causes endless loop

Linus Torvalds (torvalds@cs.helsinki.fi)
Sat, 20 Apr 1996 12:05:05 +0300 (EET DST)


On Sat, 20 Apr 1996, Bryn Paul Arnold Jones wrote:
>
> On 19 Apr 1996, Thomas Koenig wrote:
>
> > The following program loops endlessly, with repeated SIGFPE's, as
> > repeated by strace.
> >
> > This is an old, old bug, but maybe fixable before 2.0?
> >
> > #include <stdio.h>
> > #include <signal.h>
> >
> > int main()
> > {
> > int a,b,c;
> >
> > signal(SIGFPE,SIG_IGN);
> > a = 1;
> > b = 0;
> > c = a/b;
> > return 0;
> > }
> >
> Hmm, gdb sais it's restarting on line 11 (c=a/b), after the signal.
> Perhaps it should ignore the signal, and carry on on the next line ....
> (you know what I mean).

Can't be done, at least not without doing something overly complex (like
disassembling the faulting instruction and jumping over it "by hand" in
the kernel).

The thing that sends SIGFPE might check if SIGFPE is ignored/blocked, and
just kill the process forcibly if so (same for SIGSEGV etc, I guess).
That process _deserves_ to die ("My name is Linus Torvalds, prepare to
die").

Linus