[1/2] powerpc: Remove rt_sigreturn usage on context function

Message ID 20190215141132.24404-1-adhemerval.zanella@linaro.org
State Accepted
Commit ffe8a9a8318e1db225b22da8bc067408494bac5c
Headers show
Series
  • [1/2] powerpc: Remove rt_sigreturn usage on context function
Related show

Commit Message

Adhemerval Zanella Feb. 15, 2019, 2:11 p.m.
As described in a recent glibc thread [1], the rt_sigreturn syscall
on setcontext and swapcontext is not used on default use and its
intention is no really supported since neither setcontext nor
swapcontext are async-signal-safe.

Checked on powerpc64-linux-gnu and powerpc-linux-gnu

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
	Remove rt_sigreturn call.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewie.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2019-02/msg00367.html
---
 .../powerpc/powerpc32/setcontext-common.S     | 22 -------
 .../powerpc/powerpc32/swapcontext-common.S    | 23 --------
 .../sysv/linux/powerpc/powerpc64/setcontext.S | 59 -------------------
 .../linux/powerpc/powerpc64/swapcontext.S     | 58 ------------------
 4 files changed, 162 deletions(-)

-- 
2.17.1

Comments

Adhemerval Zanella April 17, 2019, 5:09 p.m. | #1
If no one opposes I will commit this shortly.

On 15/02/2019 12:11, Adhemerval Zanella wrote:
> As described in a recent glibc thread [1], the rt_sigreturn syscall

> on setcontext and swapcontext is not used on default use and its

> intention is no really supported since neither setcontext nor

> swapcontext are async-signal-safe.

> 

> Checked on powerpc64-linux-gnu and powerpc-linux-gnu

> 

> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:

> 	Remove rt_sigreturn call.

> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:

> 	Likewise.

> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewie.

> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise.

> 

> [1] https://sourceware.org/ml/libc-alpha/2019-02/msg00367.html

> ---

>  .../powerpc/powerpc32/setcontext-common.S     | 22 -------

>  .../powerpc/powerpc32/swapcontext-common.S    | 23 --------

>  .../sysv/linux/powerpc/powerpc64/setcontext.S | 59 -------------------

>  .../linux/powerpc/powerpc64/swapcontext.S     | 58 ------------------

>  4 files changed, 162 deletions(-)

> 

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S

> index 68c6321a9d..47235dd0cb 100644

> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S

> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S

> @@ -47,21 +47,6 @@ ENTRY(__CONTEXT_FUNC_NAME)

>  	cfi_offset(r31,-4)

>  	lwz	r31,_UC_REGS_PTR(r3)

>  

> -	/*

> -	 * If this ucontext refers to the point where we were interrupted

> -	 * by a signal, we have to use the rt_sigreturn system call to

> -	 * return to the context so we get both LR and CTR restored.

> -	 *

> -	 * Otherwise, the context we are restoring is either just after

> -	 * a procedure call (getcontext/swapcontext) or at the beginning

> -	 * of a procedure call (makecontext), so we don't need to restore

> -	 * r0, xer, ctr.  We don't restore r2 since it will be used as

> -	 * the TLS pointer.

> -	 */

> -	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)

> -	cmpwi	r0,0

> -	bne	4f	/* L(do_sigret) */

> -

>  	/* Restore the signal mask */

>  	li	r5,0

>  	addi	r4,r3,_UC_SIGMASK

> @@ -296,11 +281,4 @@ ENTRY(__CONTEXT_FUNC_NAME)

>  	mtlr	r0

>  	blr

>  

> -

> -4: /* L(do_sigret): */

> -	addi	r1,r3,-0xd0

> -	li	r0,SYS_ify(rt_sigreturn)

> -	sc

> -	/* NOTREACHED */

> -

>  END (__CONTEXT_FUNC_NAME)

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S

> index 0ef0ad7e35..e0fd249615 100644

> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S

> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S

> @@ -280,23 +280,6 @@ ENTRY(__CONTEXT_FUNC_NAME)

>  	cmpwi	r3,0

>  	bne	3f	/* L(error_exit) */

>  

> -	/*

> -	 * If the new ucontext refers to the point where we were interrupted

> -	 * by a signal, we have to use the rt_sigreturn system call to

> -	 * return to the context so we get both LR and CTR restored.

> -	 *

> -	 * Otherwise, the context we are restoring is either just after

> -	 * a procedure call (getcontext/swapcontext) or at the beginning

> -	 * of a procedure call (makecontext), so we don't need to restore

> -	 * r0, xer, ctr.  We don't restore r2 since it will be used as

> -	 * the TLS pointer.

> -	 */

> -	lwz	r4,_FRAME_PARM_SAVE2(r1)

> -	lwz	r31,_UC_REGS_PTR(r4)

> -	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)

> -	cmpwi	r0,0

> -	bne	4f	/* L(do_sigret) */

> -

>  #ifdef __CONTEXT_ENABLE_FPRS

>  # ifdef __CONTEXT_ENABLE_VRS

>  

> @@ -520,10 +503,4 @@ ENTRY(__CONTEXT_FUNC_NAME)

>  	mtlr	r0

>  	blr

>  

> -4:/*L(do_sigret):*/

> -	addi	r1,r4,-0xd0

> -	li	r0,SYS_ify(rt_sigreturn)

> -	sc

> -	/* NOTREACHED */

> -

>  END(__CONTEXT_FUNC_NAME)

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S

> index 4e3ab6647a..d311a22c58 100644

> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S

> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S

> @@ -46,20 +46,6 @@ ENTRY(__novec_setcontext)

>    cfi_adjust_cfa_offset (128)

>    mr    r31,r3

>  

> -/*

> - * If this ucontext refers to the point where we were interrupted

> - * by a signal, we have to use the rt_sigreturn system call to

> - * return to the context so we get both LR and CTR restored.

> - *

> - * Otherwise, the context we are restoring is either just after

> - * a procedure call (getcontext/swapcontext) or at the beginning

> - * of a procedure call (makecontext), so we don't need to restore

> - * msr and ctr.  We don't restore r13 since it will be used as

> - * the TLS pointer.  */

> -  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)

> -  cmpdi r0,0

> -  bne	  L(nv_do_sigret)

> -

>    li    r5,0

>    addi  r4,r3,UCONTEXT_SIGMASK

>    li    r3,SIG_SETMASK

> @@ -200,22 +186,6 @@ L(nv_error_exit):

>    mtlr r0

>  	ld   r31,-8(r1)

>    blr

> -

> -  /* At this point we assume that the ucontext was created by a

> -     rt_signal and we should use rt_sigreturn to restore the original

> -     state.  As of the 2.4.21 kernel the ucontext is the first thing

> -     (offset 0) in the rt_signal frame and rt_sigreturn expects the

> -     ucontext address in R1.  Normally the rt-signal trampoline handles

> -     this by popping dummy frame before the rt_signal syscall.  In our

> -     case the stack may not be in its original (signal handler return with

> -     R1 pointing at the dummy frame) state.  We do have the ucontext

> -     address in R3, so simply copy R3 to R1 before the syscall.  */

> -L(nv_do_sigret):

> -  mr   r1,r3,

> -  li   r0,SYS_ify(rt_sigreturn)

> -  sc

> -  /* No return.  */

> -

>  PSEUDO_END(__novec_setcontext)

>  

>  compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3)

> @@ -235,20 +205,6 @@ ENTRY(__setcontext)

>    cfi_adjust_cfa_offset (128)

>    mr    r31,r3

>  

> -/*

> - * If this ucontext refers to the point where we were interrupted

> - * by a signal, we have to use the rt_sigreturn system call to

> - * return to the context so we get both LR and CTR restored.

> - *

> - * Otherwise, the context we are restoring is either just after

> - * a procedure call (getcontext/swapcontext) or at the beginning

> - * of a procedure call (makecontext), so we don't need to restore

> - * msr and ctr.  We don't restore r13 since it will be used as

> - * the TLS pointer.  */

> -  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)

> -  cmpdi r0,0

> -  bne	  L(do_sigret)

> -

>    li    r5,0

>    addi  r4,r3,UCONTEXT_SIGMASK

>    li    r3,SIG_SETMASK

> @@ -493,21 +449,6 @@ L(error_exit):

>  	ld   r31,-8(r1)

>    blr

>  

> -  /* At this point we assume that the ucontext was created by a

> -     rt_signal and we should use rt_sigreturn to restore the original

> -     state.  As of the 2.4.21 kernel the ucontext is the first thing

> -     (offset 0) in the rt_signal frame and rt_sigreturn expects the

> -     ucontext address in R1.  Normally the rt-signal trampoline handles

> -     this by popping dummy frame before the rt_signal syscall.  In our

> -     case the stack may not be in its original (signal handler return with

> -     R1 pointing at the dummy frame) state.  We do have the ucontext

> -     address in R3, so simply copy R3 to R1 before the syscall.  */

> -L(do_sigret):

> -  mr   r1,r3,

> -  li   r0,SYS_ify(rt_sigreturn)

> -  sc

> -  /* No return.  */

> -

>  PSEUDO_END(__setcontext)

>  

>  versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S

> index af5b108e8c..6d07b1c36b 100644

> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S

> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S

> @@ -149,20 +149,6 @@ ENTRY(__novec_swapcontext)

>    cmpdi  r3,0

>    bne   L(nv_error_exit)

>  

> -/*

> - * If this new ucontext refers to the point where we were interrupted

> - * by a signal, we have to use the rt_sigreturn system call to

> - * return to the context so we get both LR and CTR restored.

> - *

> - * Otherwise, the context we are restoring is either just after

> - * a procedure call (getcontext/swapcontext) or at the beginning

> - * of a procedure call (makecontext), so we don't need to restore

> - * msr and ctr.  We don't restore r13 since it will be used as

> - * the TLS pointer.  */

> -  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)

> -  cmpdi r0,0

> -  bne	  L(nv_do_sigret)

> -

>    ld	r8,.LC__dl_hwcap@toc(r2)

>  # ifdef SHARED

>  /* Load _rtld-global._dl_hwcap.  */

> @@ -288,21 +274,6 @@ L(nv_error_exit):

>    ld    r31,-8(r1)

>    blr

>  

> -  /* At this point we assume that the ucontext was created by a

> -     rt_signal and we should use rt_sigreturn to restore the original

> -     state.  As of the 2.4.21 kernel the ucontext is the first thing

> -     (offset 0) in the rt_signal frame and rt_sigreturn expects the

> -     ucontext address in R1.  Normally the rt-signal trampoline handles

> -     this by popping dummy frame before the rt_signal syscall.  In our

> -     case the stack may not be in its original (signal handler return with

> -     R1 pointing at the dummy frame) state.  We do have the ucontext

> -     address in R3, so simply copy R3 to R1 before the syscall.  */

> -L(nv_do_sigret):

> -  mr   r1,r3,

> -  li   r0,SYS_ify(rt_sigreturn)

> -  sc

> -  /* No return.  */

> -

>  PSEUDO_END(__novec_swapcontext)

>  

>  compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3)

> @@ -535,20 +506,6 @@ L(has_no_vec):

>    cmpdi  r3,0

>    bne   L(error_exit)

>  

> -/*

> - * If this new ucontext refers to the point where we were interrupted

> - * by a signal, we have to use the rt_sigreturn system call to

> - * return to the context so we get both LR and CTR restored.

> - *

> - * Otherwise, the context we are restoring is either just after

> - * a procedure call (getcontext/swapcontext) or at the beginning

> - * of a procedure call (makecontext), so we don't need to restore

> - * msr and ctr.  We don't restore r13 since it will be used as

> - * the TLS pointer.  */

> -  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)

> -  cmpdi r0,0

> -  bne	  L(do_sigret)

> -

>    ld    r8,.LC__dl_hwcap@toc(r2)

>    ld    r10,(SIGCONTEXT_V_REGS_PTR)(r31)

>  # ifdef SHARED

> @@ -777,21 +734,6 @@ L(error_exit):

>    ld    r31,-8(r1)

>    blr

>  

> -  /* At this point we assume that the ucontext was created by a

> -     rt_signal and we should use rt_sigreturn to restore the original

> -     state.  As of the 2.4.21 kernel the ucontext is the first thing

> -     (offset 0) in the rt_signal frame and rt_sigreturn expects the

> -     ucontext address in R1.  Normally the rt-signal trampoline handles

> -     this by popping dummy frame before the rt_signal syscall.  In our

> -     case the stack may not be in its original (signal handler return with

> -     R1 pointing at the dummy frame) state.  We do have the ucontext

> -     address in R3, so simply copy R3 to R1 before the syscall.  */

> -L(do_sigret):

> -  mr   r1,r3,

> -  li   r0,SYS_ify(rt_sigreturn)

> -  sc

> -  /* No return.  */

> -

>  PSEUDO_END(__swapcontext)

>  

>  versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)

>

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
index 68c6321a9d..47235dd0cb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -47,21 +47,6 @@  ENTRY(__CONTEXT_FUNC_NAME)
 	cfi_offset(r31,-4)
 	lwz	r31,_UC_REGS_PTR(r3)
 
-	/*
-	 * If this ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	4f	/* L(do_sigret) */
-
 	/* Restore the signal mask */
 	li	r5,0
 	addi	r4,r3,_UC_SIGMASK
@@ -296,11 +281,4 @@  ENTRY(__CONTEXT_FUNC_NAME)
 	mtlr	r0
 	blr
 
-
-4: /* L(do_sigret): */
-	addi	r1,r3,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
 END (__CONTEXT_FUNC_NAME)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index 0ef0ad7e35..e0fd249615 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -280,23 +280,6 @@  ENTRY(__CONTEXT_FUNC_NAME)
 	cmpwi	r3,0
 	bne	3f	/* L(error_exit) */
 
-	/*
-	 * If the new ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r4,_FRAME_PARM_SAVE2(r1)
-	lwz	r31,_UC_REGS_PTR(r4)
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	4f	/* L(do_sigret) */
-
 #ifdef __CONTEXT_ENABLE_FPRS
 # ifdef __CONTEXT_ENABLE_VRS
 
@@ -520,10 +503,4 @@  ENTRY(__CONTEXT_FUNC_NAME)
 	mtlr	r0
 	blr
 
-4:/*L(do_sigret):*/
-	addi	r1,r4,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
 END(__CONTEXT_FUNC_NAME)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
index 4e3ab6647a..d311a22c58 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
@@ -46,20 +46,6 @@  ENTRY(__novec_setcontext)
   cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
-/*
- * If this ucontext refers to the point where we were interrupted
- * by a signal, we have to use the rt_sigreturn system call to
- * return to the context so we get both LR and CTR restored.
- *
- * Otherwise, the context we are restoring is either just after
- * a procedure call (getcontext/swapcontext) or at the beginning
- * of a procedure call (makecontext), so we don't need to restore
- * msr and ctr.  We don't restore r13 since it will be used as
- * the TLS pointer.  */
-  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
-  cmpdi r0,0
-  bne	  L(nv_do_sigret)
-
   li    r5,0
   addi  r4,r3,UCONTEXT_SIGMASK
   li    r3,SIG_SETMASK
@@ -200,22 +186,6 @@  L(nv_error_exit):
   mtlr r0
 	ld   r31,-8(r1)
   blr
-
-  /* At this point we assume that the ucontext was created by a
-     rt_signal and we should use rt_sigreturn to restore the original
-     state.  As of the 2.4.21 kernel the ucontext is the first thing
-     (offset 0) in the rt_signal frame and rt_sigreturn expects the
-     ucontext address in R1.  Normally the rt-signal trampoline handles
-     this by popping dummy frame before the rt_signal syscall.  In our
-     case the stack may not be in its original (signal handler return with
-     R1 pointing at the dummy frame) state.  We do have the ucontext
-     address in R3, so simply copy R3 to R1 before the syscall.  */
-L(nv_do_sigret):
-  mr   r1,r3,
-  li   r0,SYS_ify(rt_sigreturn)
-  sc
-  /* No return.  */
-
 PSEUDO_END(__novec_setcontext)
 
 compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3)
@@ -235,20 +205,6 @@  ENTRY(__setcontext)
   cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
-/*
- * If this ucontext refers to the point where we were interrupted
- * by a signal, we have to use the rt_sigreturn system call to
- * return to the context so we get both LR and CTR restored.
- *
- * Otherwise, the context we are restoring is either just after
- * a procedure call (getcontext/swapcontext) or at the beginning
- * of a procedure call (makecontext), so we don't need to restore
- * msr and ctr.  We don't restore r13 since it will be used as
- * the TLS pointer.  */
-  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
-  cmpdi r0,0
-  bne	  L(do_sigret)
-
   li    r5,0
   addi  r4,r3,UCONTEXT_SIGMASK
   li    r3,SIG_SETMASK
@@ -493,21 +449,6 @@  L(error_exit):
 	ld   r31,-8(r1)
   blr
 
-  /* At this point we assume that the ucontext was created by a
-     rt_signal and we should use rt_sigreturn to restore the original
-     state.  As of the 2.4.21 kernel the ucontext is the first thing
-     (offset 0) in the rt_signal frame and rt_sigreturn expects the
-     ucontext address in R1.  Normally the rt-signal trampoline handles
-     this by popping dummy frame before the rt_signal syscall.  In our
-     case the stack may not be in its original (signal handler return with
-     R1 pointing at the dummy frame) state.  We do have the ucontext
-     address in R3, so simply copy R3 to R1 before the syscall.  */
-L(do_sigret):
-  mr   r1,r3,
-  li   r0,SYS_ify(rt_sigreturn)
-  sc
-  /* No return.  */
-
 PSEUDO_END(__setcontext)
 
 versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index af5b108e8c..6d07b1c36b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -149,20 +149,6 @@  ENTRY(__novec_swapcontext)
   cmpdi  r3,0
   bne   L(nv_error_exit)
 
-/*
- * If this new ucontext refers to the point where we were interrupted
- * by a signal, we have to use the rt_sigreturn system call to
- * return to the context so we get both LR and CTR restored.
- *
- * Otherwise, the context we are restoring is either just after
- * a procedure call (getcontext/swapcontext) or at the beginning
- * of a procedure call (makecontext), so we don't need to restore
- * msr and ctr.  We don't restore r13 since it will be used as
- * the TLS pointer.  */
-  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
-  cmpdi r0,0
-  bne	  L(nv_do_sigret)
-
   ld	r8,.LC__dl_hwcap@toc(r2)
 # ifdef SHARED
 /* Load _rtld-global._dl_hwcap.  */
@@ -288,21 +274,6 @@  L(nv_error_exit):
   ld    r31,-8(r1)
   blr
 
-  /* At this point we assume that the ucontext was created by a
-     rt_signal and we should use rt_sigreturn to restore the original
-     state.  As of the 2.4.21 kernel the ucontext is the first thing
-     (offset 0) in the rt_signal frame and rt_sigreturn expects the
-     ucontext address in R1.  Normally the rt-signal trampoline handles
-     this by popping dummy frame before the rt_signal syscall.  In our
-     case the stack may not be in its original (signal handler return with
-     R1 pointing at the dummy frame) state.  We do have the ucontext
-     address in R3, so simply copy R3 to R1 before the syscall.  */
-L(nv_do_sigret):
-  mr   r1,r3,
-  li   r0,SYS_ify(rt_sigreturn)
-  sc
-  /* No return.  */
-
 PSEUDO_END(__novec_swapcontext)
 
 compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3)
@@ -535,20 +506,6 @@  L(has_no_vec):
   cmpdi  r3,0
   bne   L(error_exit)
 
-/*
- * If this new ucontext refers to the point where we were interrupted
- * by a signal, we have to use the rt_sigreturn system call to
- * return to the context so we get both LR and CTR restored.
- *
- * Otherwise, the context we are restoring is either just after
- * a procedure call (getcontext/swapcontext) or at the beginning
- * of a procedure call (makecontext), so we don't need to restore
- * msr and ctr.  We don't restore r13 since it will be used as
- * the TLS pointer.  */
-  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
-  cmpdi r0,0
-  bne	  L(do_sigret)
-
   ld    r8,.LC__dl_hwcap@toc(r2)
   ld    r10,(SIGCONTEXT_V_REGS_PTR)(r31)
 # ifdef SHARED
@@ -777,21 +734,6 @@  L(error_exit):
   ld    r31,-8(r1)
   blr
 
-  /* At this point we assume that the ucontext was created by a
-     rt_signal and we should use rt_sigreturn to restore the original
-     state.  As of the 2.4.21 kernel the ucontext is the first thing
-     (offset 0) in the rt_signal frame and rt_sigreturn expects the
-     ucontext address in R1.  Normally the rt-signal trampoline handles
-     this by popping dummy frame before the rt_signal syscall.  In our
-     case the stack may not be in its original (signal handler return with
-     R1 pointing at the dummy frame) state.  We do have the ucontext
-     address in R3, so simply copy R3 to R1 before the syscall.  */
-L(do_sigret):
-  mr   r1,r3,
-  li   r0,SYS_ify(rt_sigreturn)
-  sc
-  /* No return.  */
-
 PSEUDO_END(__swapcontext)
 
 versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)