32-bit signal contexts missing dar, dsisr, trap

Gary Byers gb at clozure.com
Wed Feb 19 10:07:41 EST 2003


On Wed, 19 Feb 2003, Paul Mackerras wrote:

> Gary Byers writes:
>
> > When setting up the signal frame for a 32-bit signal handler, current
> > versions (2.5.61 from kernel.org, 2.4.21-pre4 with recent patches from
> > penguinppc64.org) of the ppc64 kernel neglect to copy the dar, dsisr,
> > and trap fields (at least) from the 64-bit register context to the
> > handler's 32-bit context.
>
> Hmmm, these fields aren't needed for restoring the state of the
> process when the signal handler returns, and the information in them
> should mostly be available in a more portable form in the siginfo
> struct (for a "real-time" signal handler, at least).
>
> Why do you need dar, dsisr, and trap?

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.

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.

> Paul.
>
>

Gary Byers
gb at clozure.com


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list