3 quick questions about stack alignment for powerpc (32-bit) signal handlers [the change that caused misaligned]

Justin Hibbits chmeeedalf at gmail.com
Tue Feb 2 16:20:06 UTC 2016


On Tue, Feb 2, 2016 at 10:13 AM, Konstantin Belousov <kib at freebsd.org> wrote:
> On Tue, Feb 02, 2016 at 10:05:16AM -0600, Justin Hibbits wrote:
>> Good catch!  I'll commit the change tonight.
> I looked once at the powerpc sigsend(), and I think that it has an
> issue. The usfp is calculated by taking the stack pointer at the time
> of signal delivery and substracting the sigframe size. This means that
> a transient misalignment during some code (e.g. leaf function) is
> transferred to the signal handler execution.
>
> Other arches explicitely realign stack pointer for the signal
> frame before the frame is formed.
>
> I am not sure if the problem reported in the thread is caused by this
> or not, but forced realignment in sendsig() is required for ABI compliance.

Good point.  Currently the assumption is that the stack will always be
16-byte aligned, which is required per ABI.

Since there's no push/pop, only full frame creation/destruction, it
hasn't bitten us yet, but it should be fixed.  It's not the cause of
this bug, though.  This bug is caused after sendsig(), in the sigcode
trampoline in user space.

- Justin


More information about the freebsd-ppc mailing list