Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Apr 2016 00:37:47 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297630 - stable/10/sys/powerpc/powerpc
Message-ID:  <201604070037.u370blhd050825@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604070037.u370blhd050825>