Re: SIGSEGV handler

From: Kip Macy (kip@eventdriven.org)
Date: Wed May 31 2000 - 21:35:19 EST


I don't know the precise details but this is a known shortcoming in
2.2.x - this has been fixed for most platforms in 2.3.x.

Mohammad Banikazemi wrote:
>
> I am trying to write a handler for SIGSEGV.
> My handler is of the following form:
>
> void segv_handler(sig, scs)
> int sig;
> struct sigcontext_struct scs;
> {
>
> ...
>
> }
>
> I expect to find the virtual address which caused the SIGSEGV
> in scs.cr2 and based on that my handler is supposed to take an action.
>
> However, in *some* of my programs, this field of scs doesn't contain
> the correct virtual address. Inside my segv_handler routine, I print the
>
> contents of different fields of scs. I have noticed that the virtual
> address
> is sometimes in one of the following fields: scs.esp_at_signal and
> scs.eflags.
>
> The linux kernel version is 2.2.5.
>
> Does anyone know what is going on?
> Any help is greatly appreciated.
>
> -M.
>
> P.S. I posted the same question in comp.os.linux.development.apps and
> some
> one suggested that I use a handler of the following form
>
> void segv_handler(iSig, pSigInfo, pContext)
> int iSig;
> struct siginfo *pSigInfo;
> void *pContext;
> {
> segv_address = pSigInfo->si_addr;
> :
> :
> }
>
> I assume that I have to set the sa_flags to SA_SIGINFO when I set my
> segv_handler to be the segv handler by using the sigaction call. I have
> done this
> but the address I find in pSigInfo->si_addr is incorrect. I am pretty
> sure
> about the address which causes the execution of my segv_handler.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:11 EST