diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2016-04-07 00:37:46 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2016-04-07 00:37:46 +0000 |
commit | ee60d67180572cb2ec3ee4fa4377dc525a31e2fd (patch) | |
tree | 895271b185cfd6102c636a08958a38fa5f1ca48f | |
parent | 7b1674768eb20e99f7b5a73f657ed541ff72eede (diff) | |
download | FreeBSD-src-ee60d67180572cb2ec3ee4fa4377dc525a31e2fd.zip FreeBSD-src-ee60d67180572cb2ec3ee4fa4377dc525a31e2fd.tar.gz |
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
-rw-r--r-- | sys/powerpc/powerpc/exec_machdep.c | 6 | ||||
-rw-r--r-- | sys/powerpc/powerpc/sigcode32.S | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 85d778e..d53773c 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -224,10 +224,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) */ 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); } /* diff --git a/sys/powerpc/powerpc/sigcode32.S b/sys/powerpc/powerpc/sigcode32.S index 0236182..cd4c3cf 100644 --- a/sys/powerpc/powerpc/sigcode32.S +++ b/sys/powerpc/powerpc/sigcode32.S @@ -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 |