[2/4] ia64: Remove sigprocmask/sigblock objects from libpthread

Message ID 20200313194827.4467-2-adhemerval.zanella@linaro.org
State Accepted, archived
Delegated to: Adhemerval Zanella Netto
Headers
Series [v2,1/4] nptl: Move pthread_sigmask implementation to libc |

Commit Message

Adhemerval Zanella March 13, 2020, 7:48 p.m. UTC
  It is required because __libc_unwind_longjmp (used on thread
cancellation) calls __sigprocmask.  Replace with a direct call.

The sigblock was never exported and thus unused.

Checked on cross build for ia64-linux-gnu.
---
 sysdeps/ia64/nptl/Makefile                    | 4 ++--
 sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
  

Comments

Adhemerval Zanella April 17, 2020, 1:25 p.m. UTC | #1
Ping.

On 13/03/2020 16:48, Adhemerval Zanella wrote:
> It is required because __libc_unwind_longjmp (used on thread
> cancellation) calls __sigprocmask.  Replace with a direct call.
> 
> The sigblock was never exported and thus unused.
> 
> Checked on cross build for ia64-linux-gnu.
> ---
>  sysdeps/ia64/nptl/Makefile                    | 4 ++--
>  sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile
> index b7d87c37c8..d34cb27699 100644
> --- a/sysdeps/ia64/nptl/Makefile
> +++ b/sysdeps/ia64/nptl/Makefile
> @@ -20,6 +20,6 @@ gen-as-const-headers += tcb-offsets.sym
>  endif
>  
>  ifeq ($(subdir),nptl)
> -libpthread-routines += sysdep sigblock sigprocmask
> -libpthread-shared-only-routines += sysdep sigblock sigprocmask
> +libpthread-routines += sysdep
> +libpthread-shared-only-routines += sysdep
>  endif
> diff --git a/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c b/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
> index 93d1d66dd0..d9ed942963 100644
> --- a/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
> +++ b/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
> @@ -34,8 +34,7 @@ __libc_unwind_longjmp (sigjmp_buf env, int val)
>  
>    if (env[0].__mask_was_saved)
>      /* Restore the saved signal mask.  */
> -    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
> -			  (sigset_t *) NULL);
> +    __libc_signal_restore_set (&env[0].__saved_mask);
>  
>    /* Call the machine-dependent function to restore machine state.  */
>    __sigstack_longjmp (env[0].__jmpbuf, val ?: 1);
>
  
Florian Weimer April 21, 2020, 11:56 a.m. UTC | #2
* Adhemerval Zanella via Libc-alpha:

> It is required because __libc_unwind_longjmp (used on thread
> cancellation) calls __sigprocmask.  Replace with a direct call.
>
> The sigblock was never exported and thus unused.

Perhaps:

They are required because __libc_unwind_longjmp (used for thread
cancellation) calls __sigprocmask.  Replace this with a direct call.

The sigblock function is not exported and is not used internally, so
it can be removed.


> Checked on cross build for ia64-linux-gnu.

I can put this through a build-many-glibcs.py run just to be sure
(once the first patch is ready as well), but change itself looks good
to me.
  
Adhemerval Zanella April 21, 2020, 12:06 p.m. UTC | #3
On 21/04/2020 08:56, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
> 
>> It is required because __libc_unwind_longjmp (used on thread
>> cancellation) calls __sigprocmask.  Replace with a direct call.
>>
>> The sigblock was never exported and thus unused.
> 
> Perhaps:
> 
> They are required because __libc_unwind_longjmp (used for thread
> cancellation) calls __sigprocmask.  Replace this with a direct call.
> 
> The sigblock function is not exported and is not used internally, so
> it can be removed.

Ack, I have changed the commit message.

> 
> 
>> Checked on cross build for ia64-linux-gnu.
> 
> I can put this through a build-many-glibcs.py run just to be sure
> (once the first patch is ready as well), but change itself looks good
> to me.
> 

I will double check with a full build-many-glibcs.py as well.
  

Patch

diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile
index b7d87c37c8..d34cb27699 100644
--- a/sysdeps/ia64/nptl/Makefile
+++ b/sysdeps/ia64/nptl/Makefile
@@ -20,6 +20,6 @@  gen-as-const-headers += tcb-offsets.sym
 endif
 
 ifeq ($(subdir),nptl)
-libpthread-routines += sysdep sigblock sigprocmask
-libpthread-shared-only-routines += sysdep sigblock sigprocmask
+libpthread-routines += sysdep
+libpthread-shared-only-routines += sysdep
 endif
diff --git a/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c b/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
index 93d1d66dd0..d9ed942963 100644
--- a/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
+++ b/sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
@@ -34,8 +34,7 @@  __libc_unwind_longjmp (sigjmp_buf env, int val)
 
   if (env[0].__mask_was_saved)
     /* Restore the saved signal mask.  */
-    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
-			  (sigset_t *) NULL);
+    __libc_signal_restore_set (&env[0].__saved_mask);
 
   /* Call the machine-dependent function to restore machine state.  */
   __sigstack_longjmp (env[0].__jmpbuf, val ?: 1);