svn commit: r297630 - stable/10/sys/powerpc/powerpc

Justin Hibbits jhibbits at FreeBSD.org
Thu Apr 7 00:37:48 UTC 2016


Author: jhibbits
Date: Thu Apr  7 00:37:46 2016
New Revision: 297630
URL: https://svnweb.freebsd.org/changeset/base/297630

Log:
  MFC r295186
  
  Align signal stack pointer to 16 bytes.
  
  The stack must be aligned to 16 bytes at all times.  Clang 3.8 is especially
  adamant about this, and causes strange behavior and segmentation faults if it is
  not the case.
  
  PR:             kern/206810

Modified:
  stable/10/sys/powerpc/powerpc/exec_machdep.c
  stable/10/sys/powerpc/powerpc/sigcode32.S
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- stable/10/sys/powerpc/powerpc/exec_machdep.c	Wed Apr  6 23:21:44 2016	(r297629)
+++ stable/10/sys/powerpc/powerpc/exec_machdep.c	Thu Apr  7 00:37:46 2016	(r297630)
@@ -224,10 +224,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	 */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
 	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
-		usfp = (void *)(td->td_sigstk.ss_sp +
-		   td->td_sigstk.ss_size - rndfsize);
+		usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp +
+		   td->td_sigstk.ss_size - rndfsize) & ~0xFul);
 	} else {
-		usfp = (void *)(tf->fixreg[1] - rndfsize);
+		usfp = (void *)((tf->fixreg[1] - rndfsize) & ~0xFul);
 	}
 
 	/*

Modified: stable/10/sys/powerpc/powerpc/sigcode32.S
==============================================================================
--- stable/10/sys/powerpc/powerpc/sigcode32.S	Wed Apr  6 23:21:44 2016	(r297629)
+++ stable/10/sys/powerpc/powerpc/sigcode32.S	Thu Apr  7 00:37:46 2016	(r297630)
@@ -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


More information about the svn-src-all mailing list