Re: trouble trapping SEGV on 2.6.11.2 & 2.6.12-rc4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Clifford T. Matthews ([email protected]) 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;
> }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux