[Bug 206810] 11.0-CURRENT/clang380-import for powerpc (32-bit): signal handlers given insufficient stack alignment

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 2 09:29:32 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206810

--- Comment #1 from Mark Millard <markmi at dsl-only.net> ---
I tried the following change on/for the powerpc (32-bit) PowerMac that I use

Index: /usr/src/sys/powerpc/powerpc/sigcode32.S
===================================================================
--- /usr/src/sys/powerpc/powerpc/sigcode32.S    (revision 294962)
+++ /usr/src/sys/powerpc/powerpc/sigcode32.S    (working copy)
@@ -45,9 +45,9 @@
  */
        .globl  CNAME(sigcode32),CNAME(szsigcode32)
 CNAME(sigcode32):
-       addi    1,1,-20                 /* reserved space for callee */
+       addi    1,1,-32                 /* reserved space for callee */
        blrl
-       addi    3,1,20+SF_UC            /* restore sp, and get &frame->sf_uc */
+       addi    3,1,32+SF_UC            /* restore sp, and get &frame->sf_uc */
        li      0,SYS_sigreturn
        sc                              /* sigreturn(scp) */
        li      0,SYS_exit


and the results were:

A) "info frame" in gdb shows signal handlers are now started with 16-byte
aligned stack frames.

and

B) The clang 3.8.0 compiled __vfprintf segmentation faults in libc/stdio
library code during signal handlers no longer happen because the alignment
matches the code requirements.

(Before 2014 it was -16 and 16 instead of -20 and 20, but 16 was too small of a
space. The change to -20 and 20 fixed that but no longer produced aligned stack
frames: It should have gone from -16 and 16 to -32 and 32 to maintain 16 byte
stack alignment while allocating more space.)

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list