Subject: Re: signal(SIGSEGV, SIG_IGN) -> 100% CPU
To: Darren Reed <>
From: Ignatios Souvatzis <>
List: tech-kern
Date: 06/10/1999 12:32:57
On Thu, Jun 10, 1999 at 01:36:18PM +1000, Darren Reed wrote:
> When using signal(SIGSEGV, SIG_IGN), should one expect CPU usage to
> sky rocket to ~100% of that process ?  I posted earlier re. pipe(2)
> causing a segmentation fault rather than returning EFAULT, HOWEVER,
> I attempted to bypass this with ignoring SEGV, except that has not
> worked as planned.  If this is a bug somewhere, I'll file a PR.  If
> not, it seems pretty damn stupid.  FWIW, this is being tested on a
> SHARK.  Test program below.
> Darren
> #include <signal.h>
> main(){signal(SIGSEGV, SIG_IGN);pipe(0xdeadbeaf);perror("pipe");}


using pipe is just a detail that should not change behaviour, IMO.
If you use this program instead:

#include <signal.h>
main(){signal(SIGSEGV, SIG_IGN);int i; i = *(int *)0xdeadbeef;exit(0);}

you would expect a tight loop, wouldn't you?
Why should this be different for a system call?

As mentioned by other(s), maybe pipe(2) should return an error code instead
of signalling, but generally, IGNoring SEGV simply doesn't work (well, it
works for artificial SEGVs, but not for the real thing).

You would need to install a signal handler instead.


 * Progress (n.): The process through which Usenet has evolved from
   smart people in front of dumb terminals to dumb people in front of
   smart terminals.  -- (obscurity)