linux-mips
[Top] [All Lists]

Re: Silly 100% CPU behavior on a SIG_IGN-ored SIGBUS.

To: Kaz Kylheku <KKylheku@zeugmasystems.com>
Subject: Re: Silly 100% CPU behavior on a SIG_IGN-ored SIGBUS.
From: "Kevin D. Kissell" <kevink@paralogos.com>
Date: Tue, 23 Jun 2009 15:44:29 -0700
Cc: linux-mips@linux-mips.org
In-reply-to: <DDFD17CC94A9BD49A82147DDF7D545C501C35128@exchange.ZeugmaSystems.local>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <DDFD17CC94A9BD49A82147DDF7D545C501C35128@exchange.ZeugmaSystems.local>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090318)
Kaz Kylheku wrote:
Hi all,

On kernel 2.6.26, glibc 2.5 (n32), SiByte SB-1 core, the following
program goes into 100% CPU, chewing up about 80% kernel time and
20% user.

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

int main(void)
{
  int *deadbeef = (int *) 0xdeadbeef;
  signal(SIGBUS, SIG_IGN);
  printf("*deadbeef == %d\n", *deadbeef);
  return 0;
}

If any fatal exception is ignored, the program should be killed
if that exception happens. 100% CPU is not a useful response.
It's not a useful program, so what did you expect? One might argue that it would be more useful or correct to have the kernel advance the PC to not endlessly repeat the doomed load, but ignoring SIG_IGN and silently killing the thread violates the signal API as I've always understood it.

         Regards,

         Kevin K.


<Prev in Thread] Current Thread [Next in Thread>