Re: Catching SIGSEGV with signal() in 2.6

From: Ulrich Drepper
Date: Mon Apr 05 2004 - 21:05:19 EST


Kevin B. Hendricks wrote:

> For some reason, the segfault generated by trying to write to address 0 can
> not be properly caught anymore (or at least it appears that way to me).

If the code would be correct you'd see the expected behavior.

> void SignalHdl( int sig )
> {
> bSignal = 1;
> longjmp( check_env, sig );
> }

Since you jump out of a signal handling you must use siglongmp


> int check( TestFunc func, void* p )
> {
> int result;
> bSignal = 0;
> if ( !setjmp( check_env ) )

And sigsetjmp(check_env, 1) here.

--
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/