32-bit signal contexts missing dar, dsisr, trap

Peter Bergner peter at bergner.org
Thu Feb 20 06:15:05 EST 2003


Gary Byers wrote:
> I have certain stack-like data structures that have write-protected guard
> pages at their limits and use a SIGSEGV handler to detect writes to those
> guard pages.  The handler can respond to a write to a guard page more
> reliably if it knows that a DSI caused the SIGSEGV, if it knows that
> the fault involved a write, and if it knows the address being written
> to.  I suppose that it might be possible to reconstruct this information
> by disassembling the instruction at the sigcontext's PC, but using the
> dar, dsisr, and trap fields of the sigcontext seems far more reliable.

How does the attacked patch work for you?  It does seem to clean the
code up slightly and it matches better the behaviour seen on 64-bit apps.


> As far as I know, ppc32 SIGSEGV handlers don't receive siginfo arguments;
> the dar and dsisr are generally only meaningful after some synchronous,
> memory-related exception that will typically raise SIGSEGV.

If you set sa_flags = SA_SIGINFO, your SIGSEGV handler can get siginfo data.
I've attached a test program which you can use to test the attached patch.
It seems to work for me.

Peter


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: signal32.diff
Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20030219/3cd23d5f/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sigsegv.c
Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20030219/3cd23d5f/attachment-0001.txt 


More information about the Linuxppc64-dev mailing list