diff mbox

Make soft-float powerpc swapcontext restore the signal mask (bug 21045)

Message ID alpine.DEB.2.20.1701122238210.12673@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Jan. 12, 2017, 10:39 p.m. UTC
The soft-float powerpc version of swapcontext does not restore the
signal mask, resulting in stdlib/tst-setcontext2 failing:

after getcontext
after setcontext
after swapcontext
FAIL: SIGUSR2 is blocked after swapcontext.

This patch fixes this by adjusting the arguments passed to
__sigprocmask so that it restores the saved signal mask as well as
saving the existing one.  (For hard-float, this code is only used for
a compat symbol, not for the current version of swapcontext.)

Tested for soft-float powerpc.  Any comments?

2017-01-12  Joseph Myers  <joseph@codesourcery.com>

	[BZ #21045]
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
	(__CONTEXT_FUNC_NAME): Pass address of signal mask to be restored
	to __sigprocmask.

Comments

Tulio Magno Quites Machado Filho Jan. 16, 2017, 7 p.m. UTC | #1
Joseph Myers <joseph@codesourcery.com> writes:

> The soft-float powerpc version of swapcontext does not restore the
> signal mask, resulting in stdlib/tst-setcontext2 failing:
>
> after getcontext
> after setcontext
> after swapcontext
> FAIL: SIGUSR2 is blocked after swapcontext.
>
> This patch fixes this by adjusting the arguments passed to
> __sigprocmask so that it restores the saved signal mask as well as
> saving the existing one.  (For hard-float, this code is only used for
> a compat symbol, not for the current version of swapcontext.)
>
> Tested for soft-float powerpc.  Any comments?
>
> 2017-01-12  Joseph Myers  <joseph@codesourcery.com>
>
> 	[BZ #21045]
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
> 	(__CONTEXT_FUNC_NAME): Pass address of signal mask to be restored
> 	to __sigprocmask.

LGTM.
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index a0bcbf1..6696d54 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -271,7 +271,8 @@  ENTRY(__CONTEXT_FUNC_NAME)
 
 /* Restore ucontext (parm1) from stack.  */
 	lwz	r12,_FRAME_PARM_SAVE1(r1)
-	li	r4,0
+	lwz	r4,_FRAME_PARM_SAVE2(r1)
+	addi	r4,r4,_UC_SIGMASK
 	stw	r3,_UC_REGS_PTR(r12)
 	addi	r5,r12,_UC_SIGMASK
 	li	r3,SIG_SETMASK