From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Jamie Lokier <jamie@shareable.org>
Cc: Chris Friesen <cfriesen@nortelnetworks.com>,
bero@arklinux.org, Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Catching SIGSEGV with signal() in 2.6
Date: Mon, 5 Apr 2004 16:59:04 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.53.0404051644440.2948@chaos> (raw)
In-Reply-To: <20040405204028.GA21649@mail.shareable.org>
On Mon, 5 Apr 2004, Jamie Lokier wrote:
> Chris Friesen wrote:
> > SA_SIGINFO implies sigaction(). The original poster was talking about
> > signal().
> >
> > That said, it seems to work with 2.6.4 on ppc32.
>
> Just tried it with 2.6.3, x86 and signal(). Works fine.
>
> -- Jamie
Are you using a longjump to get out of the signal handler?
You may find that you can trap SIGSEGV, but you can't exit
from it because it will return to the instruction that
caused the trap!!!
#include <stdio.h>
#include <signal.h>
void handler(int sig) {
fprintf(stderr, "Caught %d\n", sig);
}
int main() {
char *foo = NULL;
signal(SIGSEGV, handler);
fprintf(stderr, "Send a signal....\n");
kill(0, SIGSEGV);
fprintf(stderr, "Okay! That worked!\n");
// *foo = 0;
return 0;
}
Just un-comment the null-pointer de-reference and watch!
Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.
next prev parent reply other threads:[~2004-04-05 20:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-05 15:25 bero
2004-04-05 18:17 ` Jamie Lokier
2004-04-05 19:16 ` Chris Friesen
2004-04-05 20:40 ` Jamie Lokier
2004-04-05 20:59 ` Richard B. Johnson [this message]
2004-04-05 21:11 ` Chris Friesen
2004-04-05 21:12 ` Jamie Lokier
2004-04-05 21:23 ` bero
2004-04-06 0:40 Kevin B. Hendricks
2004-04-06 2:04 ` Ulrich Drepper
2004-04-06 3:01 ` Kevin B. Hendricks
2004-04-06 4:08 ` Ulrich Drepper
2004-04-06 12:02 ` Kevin B. Hendricks
2004-04-06 15:53 ` Edgar Toernig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.53.0404051644440.2948@chaos \
--to=root@chaos.analogic.com \
--cc=bero@arklinux.org \
--cc=cfriesen@nortelnetworks.com \
--cc=jamie@shareable.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®