Date: Tue, 2 Feb 2016 10:20:05 -0600 From: Justin Hibbits <chmeeedalf@gmail.com> To: Konstantin Belousov <kib@freebsd.org> Cc: Mark Millard <markmi@dsl-only.net>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Roman Divacky <rdivacky@vlakno.cz>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> Subject: Re: 3 quick questions about stack alignment for powerpc (32-bit) signal handlers [the change that caused misaligned] Message-ID: <CAHSQbTDWdaBM0uux7uDTSqG%2BNaeAOGzDoDK-rtzR9AX-927r6w@mail.gmail.com> In-Reply-To: <20160202161317.GB91220@kib.kiev.ua> References: <20160131140807.GA83147@vlakno.cz> <0716BE3E-B7D1-4A10-B011-C1F0245296E7@dsl-only.net> <E591AEFA-8BB0-4CD2-BD29-5B7D6C8F6D91@gmail.com> <70A66DFD-557A-4D82-813C-05EED6EAB089@dsl-only.net> <FCCE1402-A7FA-4476-9179-E88999D832A3@dsl-only.net> <1CCB483E-882A-4068-AF5B-EF43DAF0BA79@dsl-only.net> <261D8A47-3B8A-4DE6-9D2C-F536C9143E84@dsl-only.net> <CA054B3F-C915-4178-B63C-DC7D79E100B4@dsl-only.net> <8D38E67E-B798-4EFD-951F-DADFDBAEDD8A@dsl-only.net> <CAHSQbTBzC1u%2BX=xoyUa-5GwKVYOoFHEoV7jCueccJBAfM10Fpg@mail.gmail.com> <20160202161317.GB91220@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 2, 2016 at 10:13 AM, Konstantin Belousov <kib@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHSQbTDWdaBM0uux7uDTSqG%2BNaeAOGzDoDK-rtzR9AX-927r6w>