mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: "Clifford T. Matthews" <ctm@ardi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: trouble trapping SEGV on 2.6.11.2 & 2.6.12-rc4
Date: Tue, 24 May 2005 13:43:10 -0700	[thread overview]
Message-ID: <20050524204310.GJ23013@shell0.pdx.osdl.net> (raw)
In-Reply-To: <17043.36668.164277.860295@newbie.ardi.com>

* Clifford T. Matthews (ctm@ardi.com) wrote:
> The included program dies with a SEGV under 2.6.11.2 and 2.6.12-rc4.
> It doesn't die under 2.4.25.  I compiled the kernels myself.  The
> distribution is Fedora Core release 3, with glibc 2.3.5.

2.6 has been fixed...  So your program (which happens to be slightly
buggy) no longer works as you expected.  See below.

> #include <stdio.h>
> #include <unistd.h>
> #include <sys/mman.h>
> #include <stdbool.h>
> #include <assert.h>
> #include <setjmp.h>
> #include <signal.h>
> 
> static jmp_buf segv_return;
> 
> static void
> segv_handler (int signum_ignored __attribute__((unused)))
> {
>   longjmp (segv_return, 1);

siglongjmp

> }
> 
> int
> main (void)
> {
>   volatile char *volatile addr;
>   volatile int n_failures;
> 
>   addr = (void *) 0x10000L;
>   n_failures = 0;
> 
>   signal (SIGSEGV, segv_handler);
>   if (setjmp (segv_return) != 0)

sigsetjmp

>     ++n_failures;
>   else
>     *addr;
> 
>   printf ("n_failures = %d\n", n_failures);
> 
>   if (setjmp (segv_return) != 0)

sigsetjmp

>     ++n_failures;
>   else
>     *addr;
> 
>   printf ("n_failures = %d\n", n_failures);
> 
>   return 0;
> }

  reply	other threads:[~2005-05-24 20:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-24 20:31 Clifford T. Matthews
2005-05-24 20:43 ` Chris Wright [this message]
2005-05-24 21:23   ` Clifford T. Matthews
2005-05-24 21:14 ` Richard B. Johnson

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=20050524204310.GJ23013@shell0.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=ctm@ardi.com \
    --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®