AW: Questionable SIGSEGV signal handling bug concerning siginfo.si_addr on i386-linux 2.4.2

Hugo Mildenberger (milden@dialup.nacamar.de)
Tue, 26 Jun 2001 18:19:44 +0200


Dear Brian,

it is hard to admit, but you are right even if a structure was not directly
involved. The corresponding high level statements were

double guarded_log( double *arg ) {
try {
return log( *arg ); // e.g. arg==0 or arg==0x1234.
} catch ( s2e::SCN(SIGSGEV)*e ) {
// [...]
} catch ( s2e::SCN(SIGFPE)*e ) {
// [...]
}
}

... but your supposed structure access is really there - because a double
value allocates 8 bytes and the gcc-3.0 developers obviously changed code
generation. They access at least FPU parameters now differently and highest
long-word first; that explains the difference in program behavior. Your
suggestion of testing against the whole occupied address range is the
general solution which I already used intuitively if I was dealing with
structs and arrays - but I did not realize that also a double value is a
certain kind of struct if seen from the processor?s point of view, which is
(at the time of writing usually) only 32 bits wide.

Thank you for your exact analysis and your quick response.

Hugo Mildenberger

>Von: Brian Gerst [mailto:bgerst@didntduck.org]
>What you are seeing is the correct behavior. The address in si_addr is
>the exact address that caused the page fault (from register %cr2). It
>appears that you were trying to access an element of a structure, where
>the structure pointer was in %eax and the offset of the element within
>the structure is 4 bytes. I suggest that if you are trying to find out
>if a fault happened inside a structure you check the whole range of
>addresses in that structure, because any of them could have faulted.
>
>--
>
> Brian Gerst

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