Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Feb 2016 09:29:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 206810] 11.0-CURRENT/clang380-import for powerpc (32-bit): signal handlers given insufficient stack alignment
Message-ID:  <bug-206810-8-HGIHUQiQnZ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-206810-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-206810-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206810

--- Comment #1 from Mark Millard <markmi@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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /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_u=
c */
+       addi    3,1,32+SF_UC            /* restore sp, and get &frame->sf_u=
c */
        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 s=
tack
frames: It should have gone from -16 and 16 to -32 and 32 to maintain 16 by=
te
stack alignment while allocating more space.)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206810-8-HGIHUQiQnZ>