public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl
@ 2020-12-07 21:27 Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 2/8] nptl: Move pthread_kill to libc Adhemerval Zanella
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

The nptl already expects a Linux syscall internally.  Also
__is_internal_signal is used and the DEBUGGING_P check is removed.

Checked on x86_64-linux-gnu.
---
 nptl/pthread_kill.c                    | 28 ++++++++-----
 sysdeps/unix/sysv/linux/pthread_kill.c | 57 --------------------------
 2 files changed, 18 insertions(+), 67 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/pthread_kill.c

diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index 73144a07ec..7ef68d1572 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -1,4 +1,4 @@
-/* Send a signal to a specific pthread.  Stub version.
+/* Send a signal to a specific pthread.  Linux version.
    Copyright (C) 2014-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,23 +16,31 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
+#include <unistd.h>
 #include <pthreadP.h>
 
-
 int
 __pthread_kill (pthread_t threadid, int signo)
 {
+  /* Disallow sending the signal we use for cancellation, timers,
+     for the setxid implementation.  */
+  if (__is_internal_signal (signo))
+    return EINVAL;
+
+  /* Force load of pd->tid into local variable or register.  Otherwise
+     if a thread exits between ESRCH test and tgkill, we might return
+     EINVAL, because pd->tid would be cleared by the kernel.  */
   struct pthread *pd = (struct pthread *) threadid;
-
-  /* Make sure the descriptor is valid.  */
-  if (DEBUGGING_P && INVALID_TD_P (pd))
+  pid_t tid = atomic_forced_read (pd->tid);
+  if (__glibc_unlikely (tid <= 0))
     /* Not a valid thread handle.  */
     return ESRCH;
 
-  return ENOSYS;
+  /* We have a special syscall to do the work.  */
+  pid_t pid = __getpid ();
+
+  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
+  return (INTERNAL_SYSCALL_ERROR_P (val)
+	  ? INTERNAL_SYSCALL_ERRNO (val) : 0);
 }
 strong_alias (__pthread_kill, pthread_kill)
-
-stub_warning (pthread_kill)
diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c
deleted file mode 100644
index 4dfe08ffcd..0000000000
--- a/sysdeps/unix/sysv/linux/pthread_kill.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <pthreadP.h>
-#include <tls.h>
-#include <sysdep.h>
-#include <unistd.h>
-
-
-int
-__pthread_kill (pthread_t threadid, int signo)
-{
-  struct pthread *pd = (struct pthread *) threadid;
-
-  /* Make sure the descriptor is valid.  */
-  if (DEBUGGING_P && INVALID_TD_P (pd))
-    /* Not a valid thread handle.  */
-    return ESRCH;
-
-  /* Force load of pd->tid into local variable or register.  Otherwise
-     if a thread exits between ESRCH test and tgkill, we might return
-     EINVAL, because pd->tid would be cleared by the kernel.  */
-  pid_t tid = atomic_forced_read (pd->tid);
-  if (__glibc_unlikely (tid <= 0))
-    /* Not a valid thread handle.  */
-    return ESRCH;
-
-  /* Disallow sending the signal we use for cancellation, timers,
-     for the setxid implementation.  */
-  if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
-    return EINVAL;
-
-  /* We have a special syscall to do the work.  */
-  pid_t pid = __getpid ();
-
-  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
-  return (INTERNAL_SYSCALL_ERROR_P (val)
-	  ? INTERNAL_SYSCALL_ERRNO (val) : 0);
-}
-strong_alias (__pthread_kill, pthread_kill)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/8] nptl: Move pthread_kill to libc
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 3/8] nptl: Make pthread_kill async-signal-safe Adhemerval Zanella
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version:

  * Removed __libpthread_version_placeholder for GLIBC 2.0

--

Checke on x86_64-linux-gnu.
---
 nptl/Makefile                                                  | 3 ++-
 nptl/Versions                                                  | 1 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist                   | 1 +
 sysdeps/unix/sysv/linux/aarch64/libpthread.abilist             | 1 -
 sysdeps/unix/sysv/linux/alpha/libc.abilist                     | 1 +
 sysdeps/unix/sysv/linux/alpha/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/arc/libc.abilist                       | 1 +
 sysdeps/unix/sysv/linux/arc/libpthread.abilist                 | 1 -
 sysdeps/unix/sysv/linux/arm/be/libc.abilist                    | 1 +
 sysdeps/unix/sysv/linux/arm/be/libpthread.abilist              | 1 -
 sysdeps/unix/sysv/linux/arm/le/libc.abilist                    | 1 +
 sysdeps/unix/sysv/linux/arm/le/libpthread.abilist              | 1 -
 sysdeps/unix/sysv/linux/csky/libc.abilist                      | 1 +
 sysdeps/unix/sysv/linux/csky/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/hppa/libc.abilist                      | 1 +
 sysdeps/unix/sysv/linux/hppa/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/i386/libc.abilist                      | 1 +
 sysdeps/unix/sysv/linux/i386/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/ia64/libc.abilist                      | 1 +
 sysdeps/unix/sysv/linux/ia64/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist             | 1 +
 sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist               | 1 +
 sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/microblaze/be/libc.abilist             | 1 +
 sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/microblaze/le/libc.abilist             | 1 +
 sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist           | 1 +
 sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist         | 1 +
 sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist           | 1 +
 sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist           | 1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist                     | 1 +
 sysdeps/unix/sysv/linux/nios2/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist     | 1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist   | 1 -
 sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist   | 1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist      | 1 +
 .../unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist    | 1 -
 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist      | 1 +
 .../unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist    | 1 -
 sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist                | 1 +
 sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist          | 1 -
 sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist                | 1 +
 sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist          | 1 -
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist              | 1 +
 sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist        | 1 -
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist              | 1 +
 sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist        | 1 -
 sysdeps/unix/sysv/linux/sh/be/libc.abilist                     | 1 +
 sysdeps/unix/sysv/linux/sh/be/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/sh/le/libc.abilist                     | 1 +
 sysdeps/unix/sysv/linux/sh/le/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist             | 1 +
 sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist             | 1 +
 sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/x86_64/64/libc.abilist                 | 1 +
 sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist           | 1 -
 sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist                | 1 +
 sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist          | 1 -
 63 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/nptl/Makefile b/nptl/Makefile
index ddd83dfbdd..3f6e77f63f 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -65,6 +65,7 @@ routines = \
   pthread_getaffinity \
   pthread_getattr_np \
   pthread_getschedparam \
+  pthread_kill \
   pthread_self \
   pthread_setschedparam \
   pthread_sigmask \
@@ -131,7 +132,7 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      pthread_barrierattr_setpshared \
 		      pthread_key_create pthread_key_delete \
 		      pthread_getspecific pthread_setspecific \
-		      pthread_kill pthread_sigqueue \
+		      pthread_sigqueue \
 		      pthread_cancel pthread_testcancel \
 		      pthread_setcancelstate pthread_setcanceltype \
 		      pthread_once \
diff --git a/nptl/Versions b/nptl/Versions
index 02650fe91c..7cfe39a91c 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -12,6 +12,7 @@ libc {
     pthread_cond_timedwait;
     pthread_equal; pthread_exit;
     pthread_getschedparam; pthread_setschedparam;
+    pthread_kill;
     pthread_mutex_destroy; pthread_mutex_init;
     pthread_mutex_lock; pthread_mutex_unlock;
     pthread_self;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 4cc1c6a591..9bd30091b2 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -1442,6 +1442,7 @@ GLIBC_2.17 pthread_exit F
 GLIBC_2.17 pthread_getaffinity_np F
 GLIBC_2.17 pthread_getattr_np F
 GLIBC_2.17 pthread_getschedparam F
+GLIBC_2.17 pthread_kill F
 GLIBC_2.17 pthread_mutex_destroy F
 GLIBC_2.17 pthread_mutex_init F
 GLIBC_2.17 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index c6b4ea2dc1..18f2b38dca 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.17 pthread_getspecific F
 GLIBC_2.17 pthread_join F
 GLIBC_2.17 pthread_key_create F
 GLIBC_2.17 pthread_key_delete F
-GLIBC_2.17 pthread_kill F
 GLIBC_2.17 pthread_kill_other_threads_np F
 GLIBC_2.17 pthread_mutex_consistent F
 GLIBC_2.17 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 26ad9845e4..8d0d149380 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -883,6 +883,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index 390b6384d0..a05379d8d7 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index bb9dfd4daf..59e73552a9 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1369,6 +1369,7 @@ GLIBC_2.32 pthread_exit F
 GLIBC_2.32 pthread_getaffinity_np F
 GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_getschedparam F
+GLIBC_2.32 pthread_kill F
 GLIBC_2.32 pthread_mutex_destroy F
 GLIBC_2.32 pthread_mutex_init F
 GLIBC_2.32 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
index 1adcbecc2e..9a5a035490 100644
--- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
@@ -113,7 +113,6 @@ GLIBC_2.32 pthread_getspecific F
 GLIBC_2.32 pthread_join F
 GLIBC_2.32 pthread_key_create F
 GLIBC_2.32 pthread_key_delete F
-GLIBC_2.32 pthread_kill F
 GLIBC_2.32 pthread_kill_other_threads_np F
 GLIBC_2.32 pthread_mutex_clocklock F
 GLIBC_2.32 pthread_mutex_consistent F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 3b0a47e967..fb76fc2a9e 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -1534,6 +1534,7 @@ GLIBC_2.4 pthread_exit F
 GLIBC_2.4 pthread_getaffinity_np F
 GLIBC_2.4 pthread_getattr_np F
 GLIBC_2.4 pthread_getschedparam F
+GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_mutex_destroy F
 GLIBC_2.4 pthread_mutex_init F
 GLIBC_2.4 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index b6c26c7a50..fc7343bae9 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -136,7 +136,6 @@ GLIBC_2.4 pthread_getspecific F
 GLIBC_2.4 pthread_join F
 GLIBC_2.4 pthread_key_create F
 GLIBC_2.4 pthread_key_delete F
-GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_kill_other_threads_np F
 GLIBC_2.4 pthread_mutex_consistent_np F
 GLIBC_2.4 pthread_mutex_destroy F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 9ab3924888..a8199f5de9 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -1531,6 +1531,7 @@ GLIBC_2.4 pthread_exit F
 GLIBC_2.4 pthread_getaffinity_np F
 GLIBC_2.4 pthread_getattr_np F
 GLIBC_2.4 pthread_getschedparam F
+GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_mutex_destroy F
 GLIBC_2.4 pthread_mutex_init F
 GLIBC_2.4 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index b6c26c7a50..fc7343bae9 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -136,7 +136,6 @@ GLIBC_2.4 pthread_getspecific F
 GLIBC_2.4 pthread_join F
 GLIBC_2.4 pthread_key_create F
 GLIBC_2.4 pthread_key_delete F
-GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_kill_other_threads_np F
 GLIBC_2.4 pthread_mutex_consistent_np F
 GLIBC_2.4 pthread_mutex_destroy F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 14a84dac8f..7f038c4e6f 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -1430,6 +1430,7 @@ GLIBC_2.29 pthread_exit F
 GLIBC_2.29 pthread_getaffinity_np F
 GLIBC_2.29 pthread_getattr_np F
 GLIBC_2.29 pthread_getschedparam F
+GLIBC_2.29 pthread_kill F
 GLIBC_2.29 pthread_mutex_destroy F
 GLIBC_2.29 pthread_mutex_init F
 GLIBC_2.29 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index 6ce59276a7..d82933bab8 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -111,7 +111,6 @@ GLIBC_2.29 pthread_getspecific F
 GLIBC_2.29 pthread_join F
 GLIBC_2.29 pthread_key_create F
 GLIBC_2.29 pthread_key_delete F
-GLIBC_2.29 pthread_kill F
 GLIBC_2.29 pthread_kill_other_threads_np F
 GLIBC_2.29 pthread_mutex_consistent F
 GLIBC_2.29 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 5c8502f3d3..4afe849736 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1266,6 +1266,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index cabc5af858..041f965447 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 4f0d3c1eb5..4d4e4bca71 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -860,6 +860,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index 18177307c8..8875b14ad1 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index e3b345b803..1fd9df36d2 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1287,6 +1287,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index 335f486cb5..998d7d2d99 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 25f2d1c08f..38b379a876 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -1514,6 +1514,7 @@ GLIBC_2.4 pthread_exit F
 GLIBC_2.4 pthread_getaffinity_np F
 GLIBC_2.4 pthread_getattr_np F
 GLIBC_2.4 pthread_getschedparam F
+GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_mutex_destroy F
 GLIBC_2.4 pthread_mutex_init F
 GLIBC_2.4 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index b6c26c7a50..fc7343bae9 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -136,7 +136,6 @@ GLIBC_2.4 pthread_getspecific F
 GLIBC_2.4 pthread_join F
 GLIBC_2.4 pthread_key_create F
 GLIBC_2.4 pthread_key_delete F
-GLIBC_2.4 pthread_kill F
 GLIBC_2.4 pthread_kill_other_threads_np F
 GLIBC_2.4 pthread_mutex_consistent_np F
 GLIBC_2.4 pthread_mutex_destroy F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index c4891479d3..0704160e7c 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -859,6 +859,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index 18177307c8..8875b14ad1 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 143b0163b4..f4ded90314 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -1445,6 +1445,7 @@ GLIBC_2.18 pthread_exit F
 GLIBC_2.18 pthread_getaffinity_np F
 GLIBC_2.18 pthread_getattr_np F
 GLIBC_2.18 pthread_getschedparam F
+GLIBC_2.18 pthread_kill F
 GLIBC_2.18 pthread_mutex_destroy F
 GLIBC_2.18 pthread_mutex_init F
 GLIBC_2.18 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index 60397187b6..6a26159353 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -103,7 +103,6 @@ GLIBC_2.18 pthread_getspecific F
 GLIBC_2.18 pthread_join F
 GLIBC_2.18 pthread_key_create F
 GLIBC_2.18 pthread_key_delete F
-GLIBC_2.18 pthread_kill F
 GLIBC_2.18 pthread_kill_other_threads_np F
 GLIBC_2.18 pthread_mutex_consistent F
 GLIBC_2.18 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 13d374a031..fac0b0f773 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -1445,6 +1445,7 @@ GLIBC_2.18 pthread_exit F
 GLIBC_2.18 pthread_getaffinity_np F
 GLIBC_2.18 pthread_getattr_np F
 GLIBC_2.18 pthread_getschedparam F
+GLIBC_2.18 pthread_kill F
 GLIBC_2.18 pthread_mutex_destroy F
 GLIBC_2.18 pthread_mutex_init F
 GLIBC_2.18 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index 60397187b6..6a26159353 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -103,7 +103,6 @@ GLIBC_2.18 pthread_getspecific F
 GLIBC_2.18 pthread_join F
 GLIBC_2.18 pthread_key_create F
 GLIBC_2.18 pthread_key_delete F
-GLIBC_2.18 pthread_kill F
 GLIBC_2.18 pthread_kill_other_threads_np F
 GLIBC_2.18 pthread_mutex_consistent F
 GLIBC_2.18 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index b2295f1937..18492fce28 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -856,6 +856,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index b35d7f19ca..42112cee49 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 4c786070d0..1d1e9e0d90 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -856,6 +856,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index b35d7f19ca..42112cee49 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index aa9c6a4dca..364f58a555 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -856,6 +856,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 5939588ad5..69c1dfc372 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -854,6 +854,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 92556c4237..dc26597034 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -1487,6 +1487,7 @@ GLIBC_2.21 pthread_exit F
 GLIBC_2.21 pthread_getaffinity_np F
 GLIBC_2.21 pthread_getattr_np F
 GLIBC_2.21 pthread_getschedparam F
+GLIBC_2.21 pthread_kill F
 GLIBC_2.21 pthread_mutex_destroy F
 GLIBC_2.21 pthread_mutex_init F
 GLIBC_2.21 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index 924ad6e451..b1061cdbdd 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -103,7 +103,6 @@ GLIBC_2.21 pthread_getspecific F
 GLIBC_2.21 pthread_join F
 GLIBC_2.21 pthread_key_create F
 GLIBC_2.21 pthread_key_delete F
-GLIBC_2.21 pthread_kill F
 GLIBC_2.21 pthread_kill_other_threads_np F
 GLIBC_2.21 pthread_mutex_consistent F
 GLIBC_2.21 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 26c93dff05..ca1ccde821 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -867,6 +867,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index 13b41dafb6..abb726e354 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index f04b167788..b3334d5e07 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -867,6 +867,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index c2ca00709e..64c4634b3b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -1373,6 +1373,7 @@ GLIBC_2.3 pthread_equal F
 GLIBC_2.3 pthread_exit F
 GLIBC_2.3 pthread_getattr_np F
 GLIBC_2.3 pthread_getschedparam F
+GLIBC_2.3 pthread_kill F
 GLIBC_2.3 pthread_mutex_destroy F
 GLIBC_2.3 pthread_mutex_init F
 GLIBC_2.3 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index e9477a3584..7edba91681 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -120,7 +120,6 @@ GLIBC_2.3 pthread_getspecific F
 GLIBC_2.3 pthread_join F
 GLIBC_2.3 pthread_key_create F
 GLIBC_2.3 pthread_key_delete F
-GLIBC_2.3 pthread_kill F
 GLIBC_2.3 pthread_kill_other_threads_np F
 GLIBC_2.3 pthread_mutex_destroy F
 GLIBC_2.3 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 0ea50dc851..588436eadf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -1531,6 +1531,7 @@ GLIBC_2.17 pthread_exit F
 GLIBC_2.17 pthread_getaffinity_np F
 GLIBC_2.17 pthread_getattr_np F
 GLIBC_2.17 pthread_getschedparam F
+GLIBC_2.17 pthread_kill F
 GLIBC_2.17 pthread_mutex_destroy F
 GLIBC_2.17 pthread_mutex_init F
 GLIBC_2.17 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index c6b4ea2dc1..18f2b38dca 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.17 pthread_getspecific F
 GLIBC_2.17 pthread_join F
 GLIBC_2.17 pthread_key_create F
 GLIBC_2.17 pthread_key_delete F
-GLIBC_2.17 pthread_kill F
 GLIBC_2.17 pthread_kill_other_threads_np F
 GLIBC_2.17 pthread_mutex_consistent F
 GLIBC_2.17 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 0263e284d4..5d471b76dd 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -1371,6 +1371,7 @@ GLIBC_2.33 pthread_exit F
 GLIBC_2.33 pthread_getaffinity_np F
 GLIBC_2.33 pthread_getattr_np F
 GLIBC_2.33 pthread_getschedparam F
+GLIBC_2.33 pthread_kill F
 GLIBC_2.33 pthread_mutex_destroy F
 GLIBC_2.33 pthread_mutex_init F
 GLIBC_2.33 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
index 61b3c4ff7a..0023fa95df 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
@@ -113,7 +113,6 @@ GLIBC_2.33 pthread_getspecific F
 GLIBC_2.33 pthread_join F
 GLIBC_2.33 pthread_key_create F
 GLIBC_2.33 pthread_key_delete F
-GLIBC_2.33 pthread_kill F
 GLIBC_2.33 pthread_kill_other_threads_np F
 GLIBC_2.33 pthread_mutex_clocklock F
 GLIBC_2.33 pthread_mutex_consistent F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 1626c5351f..a851e6e26a 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -1433,6 +1433,7 @@ GLIBC_2.27 pthread_exit F
 GLIBC_2.27 pthread_getaffinity_np F
 GLIBC_2.27 pthread_getattr_np F
 GLIBC_2.27 pthread_getschedparam F
+GLIBC_2.27 pthread_kill F
 GLIBC_2.27 pthread_mutex_destroy F
 GLIBC_2.27 pthread_mutex_init F
 GLIBC_2.27 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index 894c474fcb..faeb8dd7b6 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.27 pthread_getspecific F
 GLIBC_2.27 pthread_join F
 GLIBC_2.27 pthread_key_create F
 GLIBC_2.27 pthread_key_delete F
-GLIBC_2.27 pthread_kill F
 GLIBC_2.27 pthread_kill_other_threads_np F
 GLIBC_2.27 pthread_mutex_consistent F
 GLIBC_2.27 pthread_mutex_consistent_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index a66426eb4d..8ca57937b4 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -858,6 +858,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index 0a60f1cca2..41f7d4371b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index ab351873ae..45eb1b4878 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1284,6 +1284,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index 0e99688824..dca95c3126 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 22ceaa3d87..7cb0df1c3b 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -1270,6 +1270,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index cabc5af858..041f965447 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index d36f228192..b8acbd5839 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -1270,6 +1270,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index cabc5af858..041f965447 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 59b4313280..b8583563b5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -861,6 +861,7 @@ GLIBC_2.0 pthread_condattr_init F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
 GLIBC_2.0 pthread_getschedparam F
+GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
 GLIBC_2.0 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index 390b6384d0..a05379d8d7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.0 pthread_getspecific F
 GLIBC_2.0 pthread_join F
 GLIBC_2.0 pthread_key_create F
 GLIBC_2.0 pthread_key_delete F
-GLIBC_2.0 pthread_kill F
 GLIBC_2.0 pthread_kill_other_threads_np F
 GLIBC_2.0 pthread_mutex_destroy F
 GLIBC_2.0 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 266dcdfa08..2f27067543 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1313,6 +1313,7 @@ GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
 GLIBC_2.2 pthread_getschedparam F
+GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
 GLIBC_2.2 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index 335f486cb5..998d7d2d99 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2 pthread_getspecific F
 GLIBC_2.2 pthread_join F
 GLIBC_2.2 pthread_key_create F
 GLIBC_2.2 pthread_key_delete F
-GLIBC_2.2 pthread_kill F
 GLIBC_2.2 pthread_kill_other_threads_np F
 GLIBC_2.2 pthread_mutex_destroy F
 GLIBC_2.2 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 4fff61818b..4541c8b54e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1281,6 +1281,7 @@ GLIBC_2.2.5 pthread_equal F
 GLIBC_2.2.5 pthread_exit F
 GLIBC_2.2.5 pthread_getattr_np F
 GLIBC_2.2.5 pthread_getschedparam F
+GLIBC_2.2.5 pthread_kill F
 GLIBC_2.2.5 pthread_mutex_destroy F
 GLIBC_2.2.5 pthread_mutex_init F
 GLIBC_2.2.5 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index 971269d2ef..2a74e40f01 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -100,7 +100,6 @@ GLIBC_2.2.5 pthread_getspecific F
 GLIBC_2.2.5 pthread_join F
 GLIBC_2.2.5 pthread_key_create F
 GLIBC_2.2.5 pthread_key_delete F
-GLIBC_2.2.5 pthread_kill F
 GLIBC_2.2.5 pthread_kill_other_threads_np F
 GLIBC_2.2.5 pthread_mutex_destroy F
 GLIBC_2.2.5 pthread_mutex_init F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 102ed47a9c..d14923e737 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -1450,6 +1450,7 @@ GLIBC_2.16 pthread_exit F
 GLIBC_2.16 pthread_getaffinity_np F
 GLIBC_2.16 pthread_getattr_np F
 GLIBC_2.16 pthread_getschedparam F
+GLIBC_2.16 pthread_kill F
 GLIBC_2.16 pthread_mutex_destroy F
 GLIBC_2.16 pthread_mutex_init F
 GLIBC_2.16 pthread_mutex_lock F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index b9bf4324a9..81f294c3e0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.16 pthread_getspecific F
 GLIBC_2.16 pthread_join F
 GLIBC_2.16 pthread_key_create F
 GLIBC_2.16 pthread_key_delete F
-GLIBC_2.16 pthread_kill F
 GLIBC_2.16 pthread_kill_other_threads_np F
 GLIBC_2.16 pthread_mutex_consistent F
 GLIBC_2.16 pthread_mutex_consistent_np F
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 3/8] nptl: Make pthread_kill async-signal-safe
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 2/8] nptl: Move pthread_kill to libc Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 4/8] nptl: Remove pthread raise implementation Adhemerval Zanella
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version:

  * Move __libc_signal_block_all prior TID read.

--

Simiar to raise (BZ #15368), pthread_kill is also defined as
async-signal-safe (POSIX.1-2008 TC1).  However, similar to raise
it has the same issues relating to signal handling.

Different than raise, all the signal are blocked so it would be
possible to implement pthread_cancel (which also should be
async-cancel safe).

Checked on x86_64-linux-gnu.
---
 nptl/pthread_kill.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index 7ef68d1572..006322ea9f 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -27,6 +27,11 @@ __pthread_kill (pthread_t threadid, int signo)
   if (__is_internal_signal (signo))
     return EINVAL;
 
+  sigset_t set;
+  __libc_signal_block_all (&set);
+
+  int val;
+
   /* Force load of pd->tid into local variable or register.  Otherwise
      if a thread exits between ESRCH test and tgkill, we might return
      EINVAL, because pd->tid would be cleared by the kernel.  */
@@ -34,13 +39,19 @@ __pthread_kill (pthread_t threadid, int signo)
   pid_t tid = atomic_forced_read (pd->tid);
   if (__glibc_unlikely (tid <= 0))
     /* Not a valid thread handle.  */
-    return ESRCH;
+    val = ESRCH;
+  else
+    {
+      /* We have a special syscall to do the work.  */
+      pid_t pid = __getpid ();
+
+      val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
+      val = (INTERNAL_SYSCALL_ERROR_P (val)
+	    ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+    }
 
-  /* We have a special syscall to do the work.  */
-  pid_t pid = __getpid ();
+  __libc_signal_restore_set (&set);
 
-  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
-  return (INTERNAL_SYSCALL_ERROR_P (val)
-	  ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+  return val;
 }
 strong_alias (__pthread_kill, pthread_kill)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 4/8] nptl: Remove pthread raise implementation
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 2/8] nptl: Move pthread_kill to libc Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 3/8] nptl: Make pthread_kill async-signal-safe Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 5/8] nptl: Implement raise in terms of pthread_kill Adhemerval Zanella
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version:

  * Removed spurious new line.

--

The Linux version already target the current thread by using tgkill
along with getpid and gettid.

Checked on x86_64-linux-gnu.
---
 nptl/Makefile                                 |  2 +-
 nptl/pt-raise.c                               | 29 -------------------
 .../sysv/linux/aarch64/libpthread.abilist     |  1 -
 .../unix/sysv/linux/alpha/libpthread.abilist  |  1 -
 .../unix/sysv/linux/arc/libpthread.abilist    |  1 -
 .../unix/sysv/linux/arm/be/libpthread.abilist |  1 -
 .../unix/sysv/linux/arm/le/libpthread.abilist |  1 -
 .../unix/sysv/linux/csky/libpthread.abilist   |  1 -
 .../unix/sysv/linux/hppa/libpthread.abilist   |  1 -
 .../unix/sysv/linux/i386/libpthread.abilist   |  1 -
 .../unix/sysv/linux/ia64/libpthread.abilist   |  1 -
 .../linux/m68k/coldfire/libpthread.abilist    |  1 -
 .../sysv/linux/m68k/m680x0/libpthread.abilist |  1 -
 .../linux/microblaze/be/libpthread.abilist    |  1 -
 .../linux/microblaze/le/libpthread.abilist    |  1 -
 .../sysv/linux/mips/mips32/libpthread.abilist |  1 -
 .../sysv/linux/mips/mips64/libpthread.abilist |  1 -
 .../unix/sysv/linux/nios2/libpthread.abilist  |  1 -
 .../powerpc/powerpc32/libpthread.abilist      |  1 -
 .../powerpc/powerpc64/be/libpthread.abilist   |  1 -
 .../powerpc/powerpc64/le/libpthread.abilist   |  1 -
 sysdeps/unix/sysv/linux/pt-raise.c            | 20 -------------
 .../sysv/linux/riscv/rv32/libpthread.abilist  |  1 -
 .../sysv/linux/riscv/rv64/libpthread.abilist  |  1 -
 .../linux/s390/s390-32/libpthread.abilist     |  1 -
 .../linux/s390/s390-64/libpthread.abilist     |  1 -
 .../unix/sysv/linux/sh/be/libpthread.abilist  |  1 -
 .../unix/sysv/linux/sh/le/libpthread.abilist  |  1 -
 .../linux/sparc/sparc32/libpthread.abilist    |  1 -
 .../linux/sparc/sparc64/libpthread.abilist    |  1 -
 .../sysv/linux/x86_64/64/libpthread.abilist   |  1 -
 .../sysv/linux/x86_64/x32/libpthread.abilist  |  1 -
 32 files changed, 1 insertion(+), 79 deletions(-)
 delete mode 100644 nptl/pt-raise.c
 delete mode 100644 sysdeps/unix/sysv/linux/pt-raise.c

diff --git a/nptl/Makefile b/nptl/Makefile
index 3f6e77f63f..0e0f50e95b 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -150,7 +150,7 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      lowlevellock \
 		      pt-fork pt-fcntl \
 		      $(pthread-compat-wrappers) \
-		      pt-raise pt-system \
+		      pt-system \
 		      flockfile ftrylockfile funlockfile \
 		      sigaction \
 		      herrno res pt-allocrtsig \
diff --git a/nptl/pt-raise.c b/nptl/pt-raise.c
deleted file mode 100644
index 069b33a86e..0000000000
--- a/nptl/pt-raise.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ISO C raise function for libpthread.
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <pthread.h>
-#include <signal.h>
-
-
-int
-raise (int sig)
-{
-  /* This is what POSIX says must happen.  */
-  return pthread_kill (pthread_self (), sig);
-}
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index 18f2b38dca..8674d82bad 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -164,7 +164,6 @@ GLIBC_2.17 pthread_tryjoin_np F
 GLIBC_2.17 pthread_yield F
 GLIBC_2.17 pwrite F
 GLIBC_2.17 pwrite64 F
-GLIBC_2.17 raise F
 GLIBC_2.17 read F
 GLIBC_2.17 recv F
 GLIBC_2.17 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index a05379d8d7..37e2e498ba 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
index 9a5a035490..85cdb87513 100644
--- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.32 pthread_tryjoin_np F
 GLIBC_2.32 pthread_yield F
 GLIBC_2.32 pwrite F
 GLIBC_2.32 pwrite64 F
-GLIBC_2.32 raise F
 GLIBC_2.32 read F
 GLIBC_2.32 recv F
 GLIBC_2.32 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index fc7343bae9..e29ecce521 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -193,7 +193,6 @@ GLIBC_2.4 pthread_tryjoin_np F
 GLIBC_2.4 pthread_yield F
 GLIBC_2.4 pwrite F
 GLIBC_2.4 pwrite64 F
-GLIBC_2.4 raise F
 GLIBC_2.4 read F
 GLIBC_2.4 recv F
 GLIBC_2.4 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index fc7343bae9..e29ecce521 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -193,7 +193,6 @@ GLIBC_2.4 pthread_tryjoin_np F
 GLIBC_2.4 pthread_yield F
 GLIBC_2.4 pwrite F
 GLIBC_2.4 pwrite64 F
-GLIBC_2.4 raise F
 GLIBC_2.4 read F
 GLIBC_2.4 recv F
 GLIBC_2.4 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index d82933bab8..5975349ad0 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -174,7 +174,6 @@ GLIBC_2.29 pthread_tryjoin_np F
 GLIBC_2.29 pthread_yield F
 GLIBC_2.29 pwrite F
 GLIBC_2.29 pwrite64 F
-GLIBC_2.29 raise F
 GLIBC_2.29 read F
 GLIBC_2.29 recv F
 GLIBC_2.29 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index 041f965447..f16ca227ab 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index 8875b14ad1..c3e8cbf284 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index 998d7d2d99..d249bf0bb1 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index fc7343bae9..e29ecce521 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -193,7 +193,6 @@ GLIBC_2.4 pthread_tryjoin_np F
 GLIBC_2.4 pthread_yield F
 GLIBC_2.4 pwrite F
 GLIBC_2.4 pwrite64 F
-GLIBC_2.4 raise F
 GLIBC_2.4 read F
 GLIBC_2.4 recv F
 GLIBC_2.4 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index 8875b14ad1..c3e8cbf284 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index 6a26159353..a260eaf1ad 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -166,7 +166,6 @@ GLIBC_2.18 pthread_tryjoin_np F
 GLIBC_2.18 pthread_yield F
 GLIBC_2.18 pwrite F
 GLIBC_2.18 pwrite64 F
-GLIBC_2.18 raise F
 GLIBC_2.18 read F
 GLIBC_2.18 recv F
 GLIBC_2.18 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index 6a26159353..a260eaf1ad 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -166,7 +166,6 @@ GLIBC_2.18 pthread_tryjoin_np F
 GLIBC_2.18 pthread_yield F
 GLIBC_2.18 pwrite F
 GLIBC_2.18 pwrite64 F
-GLIBC_2.18 raise F
 GLIBC_2.18 read F
 GLIBC_2.18 recv F
 GLIBC_2.18 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index 42112cee49..55b42b617c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index 42112cee49..55b42b617c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index b1061cdbdd..5d5c5aab44 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -166,7 +166,6 @@ GLIBC_2.21 pthread_tryjoin_np F
 GLIBC_2.21 pthread_yield F
 GLIBC_2.21 pwrite F
 GLIBC_2.21 pwrite64 F
-GLIBC_2.21 raise F
 GLIBC_2.21 read F
 GLIBC_2.21 recv F
 GLIBC_2.21 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index abb726e354..e9b0739340 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index 7edba91681..0faf484806 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -164,7 +164,6 @@ GLIBC_2.3 pthread_testcancel F
 GLIBC_2.3 pthread_yield F
 GLIBC_2.3 pwrite F
 GLIBC_2.3 pwrite64 F
-GLIBC_2.3 raise F
 GLIBC_2.3 read F
 GLIBC_2.3 recv F
 GLIBC_2.3 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index 18f2b38dca..8674d82bad 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -164,7 +164,6 @@ GLIBC_2.17 pthread_tryjoin_np F
 GLIBC_2.17 pthread_yield F
 GLIBC_2.17 pwrite F
 GLIBC_2.17 pwrite64 F
-GLIBC_2.17 raise F
 GLIBC_2.17 read F
 GLIBC_2.17 recv F
 GLIBC_2.17 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/pt-raise.c b/sysdeps/unix/sysv/linux/pt-raise.c
deleted file mode 100644
index 0c8246b0cc..0000000000
--- a/sysdeps/unix/sysv/linux/pt-raise.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* ISO C raise function for libpthread.
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/unix/sysv/linux/raise.c>
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
index 0023fa95df..62a11c535a 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.33 pthread_tryjoin_np F
 GLIBC_2.33 pthread_yield F
 GLIBC_2.33 pwrite F
 GLIBC_2.33 pwrite64 F
-GLIBC_2.33 raise F
 GLIBC_2.33 read F
 GLIBC_2.33 recv F
 GLIBC_2.33 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index faeb8dd7b6..4628abce49 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -163,7 +163,6 @@ GLIBC_2.27 pthread_tryjoin_np F
 GLIBC_2.27 pthread_yield F
 GLIBC_2.27 pwrite F
 GLIBC_2.27 pwrite64 F
-GLIBC_2.27 raise F
 GLIBC_2.27 read F
 GLIBC_2.27 recv F
 GLIBC_2.27 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index 41f7d4371b..a02aafedbc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index dca95c3126..249dd16a6b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -146,7 +146,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index 041f965447..f16ca227ab 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index 041f965447..f16ca227ab 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index a05379d8d7..37e2e498ba 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -71,7 +71,6 @@ GLIBC_2.0 pthread_setcancelstate F
 GLIBC_2.0 pthread_setcanceltype F
 GLIBC_2.0 pthread_setspecific F
 GLIBC_2.0 pthread_testcancel F
-GLIBC_2.0 raise F
 GLIBC_2.0 read F
 GLIBC_2.0 recv F
 GLIBC_2.0 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index 998d7d2d99..d249bf0bb1 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2 pthread_testcancel F
 GLIBC_2.2 pthread_yield F
 GLIBC_2.2 pwrite F
 GLIBC_2.2 pwrite64 F
-GLIBC_2.2 raise F
 GLIBC_2.2 read F
 GLIBC_2.2 recv F
 GLIBC_2.2 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index 2a74e40f01..71390950d1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -144,7 +144,6 @@ GLIBC_2.2.5 pthread_testcancel F
 GLIBC_2.2.5 pthread_yield F
 GLIBC_2.2.5 pwrite F
 GLIBC_2.2.5 pwrite64 F
-GLIBC_2.2.5 raise F
 GLIBC_2.2.5 read F
 GLIBC_2.2.5 recv F
 GLIBC_2.2.5 recvfrom F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index 81f294c3e0..cd337846d9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -164,7 +164,6 @@ GLIBC_2.16 pthread_tryjoin_np F
 GLIBC_2.16 pthread_yield F
 GLIBC_2.16 pwrite F
 GLIBC_2.16 pwrite64 F
-GLIBC_2.16 raise F
 GLIBC_2.16 read F
 GLIBC_2.16 recv F
 GLIBC_2.16 recvfrom F
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 5/8] nptl: Implement raise in terms of pthread_kill
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2020-12-07 21:27 ` [PATCH v2 4/8] nptl: Remove pthread raise implementation Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 6/8] nptl: Move cancel state out of cancelhandling Adhemerval Zanella
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version:

  * Handle vfork usage for raise and obtain the TID using a syscall
    instead of reading from TCB.

--

Now that pthread_kill is provided by libc.so and async-signal-safe,
it is possible to implement the generic POSIX implementation as
pthread_kill(pthread_self(), sig).

For Linux implementation, pthread_kill read the targetting TID from
the TCB.  For raise, this it not possible because it would make raise
fail when issue after vfork (where creates the resulting process
has a different TID from the parent, but its TCB is not updated as
for pthread_create).  For this case, gettid is called directly.

Checked on x86_64-linux-gnu.
---
 include/pthread.h               |  5 ++++
 nptl/pthreadP.h                 |  4 +--
 nptl/pthread_kill.c             | 40 +++++++++++++------------
 nptl/pthread_self.c             |  4 ++-
 sysdeps/htl/pthreadP.h          |  2 --
 sysdeps/posix/raise.c           | 11 +++++--
 sysdeps/unix/sysv/linux/raise.c | 52 ---------------------------------
 7 files changed, 41 insertions(+), 77 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/raise.c

diff --git a/include/pthread.h b/include/pthread.h
index 858c869a16..2623fb5e95 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -13,4 +13,9 @@ extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
 
 /* This function is called to initialize the pthread library.  */
 extern void __pthread_initialize (void) __attribute__ ((weak));
+
+extern int __pthread_kill (pthread_t threadid, int signo);
+
+extern pthread_t __pthread_self (void);
+
 #endif
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index a7510f9f63..968adcdb6a 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -521,11 +521,11 @@ extern int __pthread_once (pthread_once_t *once_control,
 			   void (*init_routine) (void));
 extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void),
 			     void (*child) (void));
-extern pthread_t __pthread_self (void);
+libc_hidden_proto (__pthread_self)
 extern int __pthread_equal (pthread_t thread1, pthread_t thread2);
 extern int __pthread_detach (pthread_t th);
 extern int __pthread_cancel (pthread_t th);
-extern int __pthread_kill (pthread_t threadid, int signo);
+libc_hidden_proto (__pthread_kill)
 extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));
 extern int __pthread_join (pthread_t threadid, void **thread_return);
 extern int __pthread_setcanceltype (int type, int *oldtype);
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index 006322ea9f..cf12fa743f 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -30,28 +30,32 @@ __pthread_kill (pthread_t threadid, int signo)
   sigset_t set;
   __libc_signal_block_all (&set);
 
-  int val;
-
-  /* Force load of pd->tid into local variable or register.  Otherwise
-     if a thread exits between ESRCH test and tgkill, we might return
-     EINVAL, because pd->tid would be cleared by the kernel.  */
+  pid_t tid;
   struct pthread *pd = (struct pthread *) threadid;
-  pid_t tid = atomic_forced_read (pd->tid);
-  if (__glibc_unlikely (tid <= 0))
-    /* Not a valid thread handle.  */
-    val = ESRCH;
-  else
-    {
-      /* We have a special syscall to do the work.  */
-      pid_t pid = __getpid ();
 
-      val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
-      val = (INTERNAL_SYSCALL_ERROR_P (val)
-	    ? INTERNAL_SYSCALL_ERRNO (val) : 0);
-    }
+  if (pd == THREAD_SELF)
+    tid = INLINE_SYSCALL_CALL (gettid);
+  else
+    /* Force load of pd->tid into local variable or register.  Otherwise
+       if a thread exits between ESRCH test and tgkill, we might return
+       EINVAL, because pd->tid would be cleared by the kernel.  */
+    tid = atomic_forced_read (pd->tid);
+
+   int val;
+   if (__glibc_likely (tid > 0))
+     {
+       pid_t pid = __getpid ();
+
+       val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
+       val = (INTERNAL_SYSCALL_ERROR_P (val)
+	     ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+     }
+   else
+     val = ESRCH;
 
   __libc_signal_restore_set (&set);
 
   return val;
 }
-strong_alias (__pthread_kill, pthread_kill)
+libc_hidden_def (__pthread_kill)
+weak_alias (__pthread_kill, pthread_kill)
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c
index 00a8474909..4fab462bbf 100644
--- a/nptl/pthread_self.c
+++ b/nptl/pthread_self.c
@@ -20,7 +20,9 @@
 #include <tls.h>
 
 pthread_t
-pthread_self (void)
+__pthread_self (void)
 {
   return (pthread_t) THREAD_SELF;
 }
+libc_hidden_def (__pthread_self)
+weak_alias (__pthread_self, pthread_self)
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index bf00f7d2f0..befe18b421 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -31,8 +31,6 @@ extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
 
 /* These represent the interface used by glibc itself.  */
 
-extern pthread_t __pthread_self (void);
-extern int __pthread_kill (pthread_t threadid, int signo);
 extern struct __pthread **__pthread_threads;
 
 extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr);
diff --git a/sysdeps/posix/raise.c b/sysdeps/posix/raise.c
index 32cb108f0b..586116fc1c 100644
--- a/sysdeps/posix/raise.c
+++ b/sysdeps/posix/raise.c
@@ -16,13 +16,20 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <signal.h>
-#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
 
 /* Raise the signal SIG.  */
 int
 raise (int sig)
 {
-  return __kill (__getpid (), sig);
+  int ret = __pthread_kill (__pthread_self (), sig);
+  if (ret != 0)
+    {
+      __set_errno (ret);
+      ret = -1;
+    }
+  return ret;
 }
 libc_hidden_def (raise)
 weak_alias (raise, gsignal)
diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c
deleted file mode 100644
index 3b90ae1d55..0000000000
--- a/sysdeps/unix/sysv/linux/raise.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <signal.h>
-#include <sysdep.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <internal-signals.h>
-
-int
-raise (int sig)
-{
-  /* rt_sigprocmask may fail if:
-
-     1. sigsetsize != sizeof (sigset_t) (EINVAL)
-     2. a failure in copy from/to user space (EFAULT)
-     3. an invalid 'how' operation (EINVAL)
-
-     The first case is already handle in glibc syscall call by using the arch
-     defined _NSIG.  Second case is handled by using a stack allocated mask.
-     The last one should be handled by the block/unblock functions.  */
-
-  sigset_t set;
-  __libc_signal_block_app (&set);
-
-  pid_t pid = INTERNAL_SYSCALL_CALL (getpid);
-  pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
-
-  int ret = INLINE_SYSCALL_CALL (tgkill, pid, tid, sig);
-
-  __libc_signal_restore_set (&set);
-
-  return ret;
-}
-libc_hidden_def (raise)
-weak_alias (raise, gsignal)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 6/8] nptl: Move cancel state out of cancelhandling
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2020-12-07 21:27 ` [PATCH v2 5/8] nptl: Implement raise in terms of pthread_kill Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH v2 7/8] nptl: Move cancel type " Adhemerval Zanella
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version [1]

 * Rebased against master.

--

The thread cancellation state is not accessed concurrently internally
neither the pthread interface allows changing the state of a different
thread than its own.

By removing the cancel state out of the internal thread cancel handling
state there is no need to check if cancelled bit was set in CAS
operation.

The code is also simplified: the CANCELLATION_P is replaced with a
internal pthread_testcancel call and the CANCELSTATE_BIT{MASK} is
removed.

The second part of this patchset also keeps the pthread_setcanceltype as
cancellation entrypoint by calling pthread_testcancel if the new type
is PTHREAD_CANCEL_ASYNCHRONOUS.

With this behavior pthread_setcancelstate does not require to act on
cancellation if cancel type is asynchronous (is already handled either
by pthread_setcanceltype or by the signal handler).

Checked on x86_64-linux-gnu.

[1] https://patchwork.sourceware.org/project/glibc/patch/20200520174819.1138124-1-adhemerval.zanella@linaro.org/

---
 nptl/allocatestack.c          |  1 +
 nptl/cancellation.c           |  3 ++-
 nptl/cleanup_defer.c          |  2 +-
 nptl/cleanup_defer_compat.c   |  2 +-
 nptl/descr.h                  | 14 ++++++--------
 nptl/pthreadP.h               | 12 ------------
 nptl/pthread_cancel.c         |  3 ++-
 nptl/pthread_join_common.c    |  5 ++++-
 nptl/pthread_setcancelstate.c | 36 +++--------------------------------
 nptl/pthread_setcanceltype.c  |  3 ++-
 nptl/pthread_testcancel.c     | 11 ++++++++++-
 11 files changed, 32 insertions(+), 60 deletions(-)

diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index b7f9eeebf6..169ed41b9e 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -220,6 +220,7 @@ get_cached_stack (size_t *sizep, void **memp)
 
   /* Cancellation handling is back to the default.  */
   result->cancelhandling = 0;
+  result->cancelstate = PTHREAD_CANCEL_ENABLE;
   result->cleanup = NULL;
 
   /* No pending event.  */
diff --git a/nptl/cancellation.c b/nptl/cancellation.c
index 826071321e..7e8cbe9fe1 100644
--- a/nptl/cancellation.c
+++ b/nptl/cancellation.c
@@ -45,7 +45,8 @@ __pthread_enable_asynccancel (void)
 					      oldval);
       if (__glibc_likely (curval == oldval))
 	{
-	  if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
+	  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
+	      && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
 	    {
 	      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
 	      __do_cancel ();
diff --git a/nptl/cleanup_defer.c b/nptl/cleanup_defer.c
index 8ad9a90c50..33d4ea6eef 100644
--- a/nptl/cleanup_defer.c
+++ b/nptl/cleanup_defer.c
@@ -86,6 +86,6 @@ __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *buf)
 	  cancelhandling = curval;
 	}
 
-      CANCELLATION_P (self);
+      __pthread_testcancel ();
     }
 }
diff --git a/nptl/cleanup_defer_compat.c b/nptl/cleanup_defer_compat.c
index 33e47888f2..a1ad291fcc 100644
--- a/nptl/cleanup_defer_compat.c
+++ b/nptl/cleanup_defer_compat.c
@@ -83,7 +83,7 @@ _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
 	  cancelhandling = curval;
 	}
 
-      CANCELLATION_P (self);
+      __pthread_testcancel ();
     }
 
   /* If necessary call the cleanup routine after we removed the
diff --git a/nptl/descr.h b/nptl/descr.h
index b172ee408b..258c485ef1 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -277,9 +277,6 @@ struct pthread
 
   /* Flags determining processing of cancellation.  */
   int cancelhandling;
-  /* Bit set if cancellation is disabled.  */
-#define CANCELSTATE_BIT		0
-#define CANCELSTATE_BITMASK	(0x01 << CANCELSTATE_BIT)
   /* Bit set if asynchronous cancellation mode is selected.  */
 #define CANCELTYPE_BIT		1
 #define CANCELTYPE_BITMASK	(0x01 << CANCELTYPE_BIT)
@@ -301,11 +298,8 @@ struct pthread
   /* Mask for the rest.  Helps the compiler to optimize.  */
 #define CANCEL_RESTMASK		0xffffff80
 
-#define CANCEL_ENABLED_AND_CANCELED(value) \
-  (((value) & (CANCELSTATE_BITMASK | CANCELED_BITMASK | EXITING_BITMASK	      \
-	       | CANCEL_RESTMASK | TERMINATED_BITMASK)) == CANCELED_BITMASK)
-#define CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS(value) \
-  (((value) & (CANCELSTATE_BITMASK | CANCELTYPE_BITMASK | CANCELED_BITMASK    \
+#define CANCEL_CANCELED_AND_ASYNCHRONOUS(value) \
+  (((value) & (CANCELTYPE_BITMASK | CANCELED_BITMASK    \
 	       | EXITING_BITMASK | CANCEL_RESTMASK | TERMINATED_BITMASK))     \
    == (CANCELTYPE_BITMASK | CANCELED_BITMASK))
 
@@ -409,6 +403,10 @@ struct pthread
   /* Used on strsignal.  */
   struct tls_internal_t tls_state;
 
+  /* Thread cancel state (PTHREAD_CANCEL_ENABLE or
+     PTHREAD_CANCEL_DISABLE).  */
+  unsigned char cancelstate;
+
   /* This member must be last.  */
   char end_padding[];
 
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 968adcdb6a..1a8518ef23 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -253,18 +253,6 @@ extern int __pthread_debug attribute_hidden;
 #endif
 
 
-/* Cancellation test.  */
-#define CANCELLATION_P(self) \
-  do {									      \
-    int cancelhandling = THREAD_GETMEM (self, cancelhandling);		      \
-    if (CANCEL_ENABLED_AND_CANCELED (cancelhandling))			      \
-      {									      \
-	THREAD_SETMEM (self, result, PTHREAD_CANCELED);			      \
-	__do_cancel ();							      \
-      }									      \
-  } while (0)
-
-
 extern void __pthread_unwind (__pthread_unwind_buf_t *__buf)
      __cleanup_fct_attribute __attribute ((__noreturn__))
 #if !defined SHARED && !IS_IN (libpthread)
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index 88c1ab8f6a..5b2789d620 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -55,7 +55,8 @@ __pthread_cancel (pthread_t th)
       /* If the cancellation is handled asynchronously just send a
 	 signal.  We avoid this if possible since it's more
 	 expensive.  */
-      if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
+      if (pd->cancelstate == PTHREAD_CANCEL_ENABLE
+	  && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
 	{
 	  /* Mark the cancellation as "in progress".  */
 	  if (atomic_compare_and_exchange_bool_acq (&pd->cancelhandling,
diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c
index 4293b072c8..2d23e83ced 100644
--- a/nptl/pthread_join_common.c
+++ b/nptl/pthread_join_common.c
@@ -59,7 +59,10 @@ __pthread_clockjoin_ex (pthread_t threadid, void **thread_return,
 	   && (pd->cancelhandling
 	       & (CANCELING_BITMASK | CANCELED_BITMASK | EXITING_BITMASK
 		  | TERMINATED_BITMASK)) == 0))
-      && !CANCEL_ENABLED_AND_CANCELED (self->cancelhandling))
+      && !(self->cancelstate == PTHREAD_CANCEL_ENABLE
+	   && (pd->cancelhandling & (CANCELED_BITMASK | EXITING_BITMASK
+				     | TERMINATED_BITMASK))
+	       == CANCELED_BITMASK))
     /* This is a deadlock situation.  The threads are waiting for each
        other to finish.  Note that this is a "may" error.  To be 100%
        sure we catch this error we would have to lock the data
diff --git a/nptl/pthread_setcancelstate.c b/nptl/pthread_setcancelstate.c
index 4d7f413e19..aa1c8073a8 100644
--- a/nptl/pthread_setcancelstate.c
+++ b/nptl/pthread_setcancelstate.c
@@ -31,39 +31,9 @@ __pthread_setcancelstate (int state, int *oldstate)
 
   self = THREAD_SELF;
 
-  int oldval = THREAD_GETMEM (self, cancelhandling);
-  while (1)
-    {
-      int newval = (state == PTHREAD_CANCEL_DISABLE
-		    ? oldval | CANCELSTATE_BITMASK
-		    : oldval & ~CANCELSTATE_BITMASK);
-
-      /* Store the old value.  */
-      if (oldstate != NULL)
-	*oldstate = ((oldval & CANCELSTATE_BITMASK)
-		     ? PTHREAD_CANCEL_DISABLE : PTHREAD_CANCEL_ENABLE);
-
-      /* Avoid doing unnecessary work.  The atomic operation can
-	 potentially be expensive if the memory has to be locked and
-	 remote cache lines have to be invalidated.  */
-      if (oldval == newval)
-	break;
-
-      /* Update the cancel handling word.  This has to be done
-	 atomically since other bits could be modified as well.  */
-      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
-					      oldval);
-      if (__glibc_likely (curval == oldval))
-	{
-	  if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
-	    __do_cancel ();
-
-	  break;
-	}
-
-      /* Prepare for the next round.  */
-      oldval = curval;
-    }
+  if (oldstate != NULL)
+    *oldstate = self->cancelstate;
+  self->cancelstate = state;
 
   return 0;
 }
diff --git a/nptl/pthread_setcanceltype.c b/nptl/pthread_setcanceltype.c
index fcaae8abc7..cc0507ae04 100644
--- a/nptl/pthread_setcanceltype.c
+++ b/nptl/pthread_setcanceltype.c
@@ -53,7 +53,8 @@ __pthread_setcanceltype (int type, int *oldtype)
 					      oldval);
       if (__glibc_likely (curval == oldval))
 	{
-	  if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
+	  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
+	      && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
 	    {
 	      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
 	      __do_cancel ();
diff --git a/nptl/pthread_testcancel.c b/nptl/pthread_testcancel.c
index 30408c2008..cd937bb3a3 100644
--- a/nptl/pthread_testcancel.c
+++ b/nptl/pthread_testcancel.c
@@ -23,7 +23,16 @@
 void
 __pthread_testcancel (void)
 {
-  CANCELLATION_P (THREAD_SELF);
+  struct pthread *self = THREAD_SELF;
+  int cancelhandling = THREAD_GETMEM (self, cancelhandling);
+  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
+      && (cancelhandling & CANCELED_BITMASK)
+      && !(cancelhandling & EXITING_BITMASK)
+      && !(cancelhandling & TERMINATED_BITMASK))
+    {
+      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
+      __do_cancel ();
+    }
 }
 strong_alias (__pthread_testcancel, pthread_testcancel)
 hidden_def (__pthread_testcancel)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 7/8] nptl: Move cancel type out of cancelhandling
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2020-12-07 21:27 ` [PATCH v2 6/8] nptl: Move cancel state out of cancelhandling Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-07 21:27 ` [PATCH 8/8] nptl: Use pthread_kill on pthread_cancel Adhemerval Zanella
  2020-12-11 14:02 ` [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Florian Weimer
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

Changes from previous version [1]

 * Rebased against master.

--

The thread cancellation type is not accessed concurrently internally
neither its pthread interface allows changing the state of a different
thread than its own.

By removing the cancel state out of the internal thread cancel handling
state there is no need to check if cancelled bit was set in CAS
operation.

It allows simplifing the cancellation wrappers and the
CANCEL_CANCELED_AND_ASYNCHRONOUS is removed.

Checked on x86_64-linux-gnu.

[1] https://patchwork.sourceware.org/project/glibc/patch/20200520174819.1138124-2-adhemerval.zanella@linaro.org/

---
 nptl/allocatestack.c         |  1 +
 nptl/cancellation.c          | 60 ++++++++++--------------------------
 nptl/cleanup_defer.c         | 46 +++------------------------
 nptl/cleanup_defer_compat.c  | 46 +++------------------------
 nptl/descr.h                 | 14 +++------
 nptl/nptl-init.c             |  2 +-
 nptl/pthread_cancel.c        |  5 ++-
 nptl/pthread_setcanceltype.c | 42 +++----------------------
 nptl/pthread_testcancel.c    |  2 +-
 9 files changed, 43 insertions(+), 175 deletions(-)

diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 169ed41b9e..a5da5e4337 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -221,6 +221,7 @@ get_cached_stack (size_t *sizep, void **memp)
   /* Cancellation handling is back to the default.  */
   result->cancelhandling = 0;
   result->cancelstate = PTHREAD_CANCEL_ENABLE;
+  result->canceltype = PTHREAD_CANCEL_DEFERRED;
   result->cleanup = NULL;
 
   /* No pending event.  */
diff --git a/nptl/cancellation.c b/nptl/cancellation.c
index 7e8cbe9fe1..90974c0b18 100644
--- a/nptl/cancellation.c
+++ b/nptl/cancellation.c
@@ -32,31 +32,19 @@ attribute_hidden
 __pthread_enable_asynccancel (void)
 {
   struct pthread *self = THREAD_SELF;
-  int oldval = THREAD_GETMEM (self, cancelhandling);
 
-  while (1)
-    {
-      int newval = oldval | CANCELTYPE_BITMASK;
-
-      if (newval == oldval)
-	break;
-
-      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
-					      oldval);
-      if (__glibc_likely (curval == oldval))
-	{
-	  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
-	      && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
-	    {
-	      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
-	      __do_cancel ();
-	    }
+  int oldval = THREAD_GETMEM (self, canceltype);
+  THREAD_SETMEM (self, canceltype, PTHREAD_CANCEL_ASYNCHRONOUS);
 
-	  break;
-	}
+  int ch = THREAD_GETMEM (self, cancelhandling);
 
-      /* Prepare the next round.  */
-      oldval = curval;
+  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
+      && (ch & CANCELED_BITMASK)
+      && !(ch & EXITING_BITMASK)
+      && !(ch & TERMINATED_BITMASK))
+    {
+      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
+      __do_cancel ();
     }
 
   return oldval;
@@ -70,36 +58,22 @@ __pthread_disable_asynccancel (int oldtype)
 {
   /* If asynchronous cancellation was enabled before we do not have
      anything to do.  */
-  if (oldtype & CANCELTYPE_BITMASK)
+  if (oldtype == PTHREAD_CANCEL_ASYNCHRONOUS)
     return;
 
   struct pthread *self = THREAD_SELF;
-  int newval;
-
-  int oldval = THREAD_GETMEM (self, cancelhandling);
-
-  while (1)
-    {
-      newval = oldval & ~CANCELTYPE_BITMASK;
-
-      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
-					      oldval);
-      if (__glibc_likely (curval == oldval))
-	break;
-
-      /* Prepare the next round.  */
-      oldval = curval;
-    }
+  THREAD_SETMEM (self, canceltype, PTHREAD_CANCEL_DEFERRED);
 
   /* We cannot return when we are being canceled.  Upon return the
      thread might be things which would have to be undone.  The
      following loop should loop until the cancellation signal is
      delivered.  */
-  while (__builtin_expect ((newval & (CANCELING_BITMASK | CANCELED_BITMASK))
-			   == CANCELING_BITMASK, 0))
+  int ch = THREAD_GETMEM (self, cancelhandling);
+  while (__glibc_unlikely ((ch & CANCELING_BITMASK)
+			    && !(ch & CANCELED_BITMASK)))
     {
-      futex_wait_simple ((unsigned int *) &self->cancelhandling, newval,
+      futex_wait_simple ((unsigned int *) &self->cancelhandling, ch,
 			 FUTEX_PRIVATE);
-      newval = THREAD_GETMEM (self, cancelhandling);
+      ch = THREAD_GETMEM (self, cancelhandling);
     }
 }
diff --git a/nptl/cleanup_defer.c b/nptl/cleanup_defer.c
index 33d4ea6eef..3300b4df46 100644
--- a/nptl/cleanup_defer.c
+++ b/nptl/cleanup_defer.c
@@ -31,27 +31,9 @@ __pthread_register_cancel_defer (__pthread_unwind_buf_t *buf)
   ibuf->priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
   ibuf->priv.data.cleanup = THREAD_GETMEM (self, cleanup);
 
-  int cancelhandling = THREAD_GETMEM (self, cancelhandling);
-
   /* Disable asynchronous cancellation for now.  */
-  if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
-    while (1)
-      {
-	int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
-						cancelhandling
-						& ~CANCELTYPE_BITMASK,
-						cancelhandling);
-	if (__glibc_likely (curval == cancelhandling))
-	  /* Successfully replaced the value.  */
-	  break;
-
-	/* Prepare for the next round.  */
-	cancelhandling = curval;
-      }
-
-  ibuf->priv.data.canceltype = (cancelhandling & CANCELTYPE_BITMASK
-				? PTHREAD_CANCEL_ASYNCHRONOUS
-				: PTHREAD_CANCEL_DEFERRED);
+  ibuf->priv.data.canceltype = THREAD_GETMEM (self, canceltype);
+  THREAD_SETMEM (self, canceltype, PTHREAD_CANCEL_DEFERRED);
 
   /* Store the new cleanup handler info.  */
   THREAD_SETMEM (self, cleanup_jmp_buf, (struct pthread_unwind_buf *) buf);
@@ -67,25 +49,7 @@ __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *buf)
 
   THREAD_SETMEM (self, cleanup_jmp_buf, ibuf->priv.data.prev);
 
-  int cancelhandling;
-  if (ibuf->priv.data.canceltype != PTHREAD_CANCEL_DEFERRED
-      && ((cancelhandling = THREAD_GETMEM (self, cancelhandling))
-	  & CANCELTYPE_BITMASK) == 0)
-    {
-      while (1)
-	{
-	  int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
-						  cancelhandling
-						  | CANCELTYPE_BITMASK,
-						  cancelhandling);
-	  if (__glibc_likely (curval == cancelhandling))
-	    /* Successfully replaced the value.  */
-	    break;
-
-	  /* Prepare for the next round.  */
-	  cancelhandling = curval;
-	}
-
-      __pthread_testcancel ();
-    }
+  THREAD_SETMEM (self, canceltype, ibuf->priv.data.canceltype);
+  if (ibuf->priv.data.canceltype == PTHREAD_CANCEL_ASYNCHRONOUS)
+    __pthread_testcancel ();
 }
diff --git a/nptl/cleanup_defer_compat.c b/nptl/cleanup_defer_compat.c
index a1ad291fcc..77655c1b0a 100644
--- a/nptl/cleanup_defer_compat.c
+++ b/nptl/cleanup_defer_compat.c
@@ -29,27 +29,9 @@ _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
   buffer->__arg = arg;
   buffer->__prev = THREAD_GETMEM (self, cleanup);
 
-  int cancelhandling = THREAD_GETMEM (self, cancelhandling);
-
   /* Disable asynchronous cancellation for now.  */
-  if (__glibc_unlikely (cancelhandling & CANCELTYPE_BITMASK))
-    while (1)
-      {
-	int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
-						cancelhandling
-						& ~CANCELTYPE_BITMASK,
-						cancelhandling);
-	if (__glibc_likely (curval == cancelhandling))
-	  /* Successfully replaced the value.  */
-	  break;
-
-	/* Prepare for the next round.  */
-	cancelhandling = curval;
-      }
-
-  buffer->__canceltype = (cancelhandling & CANCELTYPE_BITMASK
-			  ? PTHREAD_CANCEL_ASYNCHRONOUS
-			  : PTHREAD_CANCEL_DEFERRED);
+  buffer->__canceltype = THREAD_GETMEM (self, canceltype);
+  THREAD_SETMEM (self, canceltype, PTHREAD_CANCEL_DEFERRED);
 
   THREAD_SETMEM (self, cleanup, buffer);
 }
@@ -64,27 +46,9 @@ _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
 
   THREAD_SETMEM (self, cleanup, buffer->__prev);
 
-  int cancelhandling;
-  if (__builtin_expect (buffer->__canceltype != PTHREAD_CANCEL_DEFERRED, 0)
-      && ((cancelhandling = THREAD_GETMEM (self, cancelhandling))
-	  & CANCELTYPE_BITMASK) == 0)
-    {
-      while (1)
-	{
-	  int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
-						  cancelhandling
-						  | CANCELTYPE_BITMASK,
-						  cancelhandling);
-	  if (__glibc_likely (curval == cancelhandling))
-	    /* Successfully replaced the value.  */
-	    break;
-
-	  /* Prepare for the next round.  */
-	  cancelhandling = curval;
-	}
-
-      __pthread_testcancel ();
-    }
+  THREAD_SETMEM (self, canceltype, buffer->__canceltype);
+  if (buffer->__canceltype == PTHREAD_CANCEL_ASYNCHRONOUS)
+    __pthread_testcancel ();
 
   /* If necessary call the cleanup routine after we removed the
      current cleanup block from the list.  */
diff --git a/nptl/descr.h b/nptl/descr.h
index 258c485ef1..0aed19ccd7 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -277,9 +277,6 @@ struct pthread
 
   /* Flags determining processing of cancellation.  */
   int cancelhandling;
-  /* Bit set if asynchronous cancellation mode is selected.  */
-#define CANCELTYPE_BIT		1
-#define CANCELTYPE_BITMASK	(0x01 << CANCELTYPE_BIT)
   /* Bit set if canceling has been initiated.  */
 #define CANCELING_BIT		2
 #define CANCELING_BITMASK	(0x01 << CANCELING_BIT)
@@ -295,13 +292,6 @@ struct pthread
   /* Bit set if thread is supposed to change XID.  */
 #define SETXID_BIT		6
 #define SETXID_BITMASK		(0x01 << SETXID_BIT)
-  /* Mask for the rest.  Helps the compiler to optimize.  */
-#define CANCEL_RESTMASK		0xffffff80
-
-#define CANCEL_CANCELED_AND_ASYNCHRONOUS(value) \
-  (((value) & (CANCELTYPE_BITMASK | CANCELED_BITMASK    \
-	       | EXITING_BITMASK | CANCEL_RESTMASK | TERMINATED_BITMASK))     \
-   == (CANCELTYPE_BITMASK | CANCELED_BITMASK))
 
   /* Flags.  Including those copied from the thread attribute.  */
   int flags;
@@ -407,6 +397,10 @@ struct pthread
      PTHREAD_CANCEL_DISABLE).  */
   unsigned char cancelstate;
 
+  /* Thread cancel type (PTHREAD_CANCEL_DEFERRED or
+     PTHREAD_CANCEL_ASYNCHRONOUS).  */
+  unsigned char canceltype;
+
   /* This member must be last.  */
   char end_padding[];
 
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 53b817715d..2202d44b95 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -156,7 +156,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
 	  THREAD_SETMEM (self, result, PTHREAD_CANCELED);
 
 	  /* Make sure asynchronous cancellation is still enabled.  */
-	  if ((newval & CANCELTYPE_BITMASK) != 0)
+	  if (self->canceltype == PTHREAD_CANCEL_ASYNCHRONOUS)
 	    /* Run the registered destructors and terminate the thread.  */
 	    __do_cancel ();
 
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index 5b2789d620..266fd77284 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -56,7 +56,10 @@ __pthread_cancel (pthread_t th)
 	 signal.  We avoid this if possible since it's more
 	 expensive.  */
       if (pd->cancelstate == PTHREAD_CANCEL_ENABLE
-	  && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
+	  && pd->canceltype == PTHREAD_CANCEL_ASYNCHRONOUS
+	  && (newval & CANCELED_BITMASK)
+	  && !(newval & EXITING_BITMASK)
+	  && !(newval & TERMINATED_BITMASK))
 	{
 	  /* Mark the cancellation as "in progress".  */
 	  if (atomic_compare_and_exchange_bool_acq (&pd->cancelhandling,
diff --git a/nptl/pthread_setcanceltype.c b/nptl/pthread_setcanceltype.c
index cc0507ae04..d8cb54736d 100644
--- a/nptl/pthread_setcanceltype.c
+++ b/nptl/pthread_setcanceltype.c
@@ -29,43 +29,11 @@ __pthread_setcanceltype (int type, int *oldtype)
 
   volatile struct pthread *self = THREAD_SELF;
 
-  int oldval = THREAD_GETMEM (self, cancelhandling);
-  while (1)
-    {
-      int newval = (type == PTHREAD_CANCEL_ASYNCHRONOUS
-		    ? oldval | CANCELTYPE_BITMASK
-		    : oldval & ~CANCELTYPE_BITMASK);
-
-      /* Store the old value.  */
-      if (oldtype != NULL)
-	*oldtype = ((oldval & CANCELTYPE_BITMASK)
-		    ? PTHREAD_CANCEL_ASYNCHRONOUS : PTHREAD_CANCEL_DEFERRED);
-
-      /* Avoid doing unnecessary work.  The atomic operation can
-	 potentially be expensive if the memory has to be locked and
-	 remote cache lines have to be invalidated.  */
-      if (oldval == newval)
-	break;
-
-      /* Update the cancel handling word.  This has to be done
-	 atomically since other bits could be modified as well.  */
-      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
-					      oldval);
-      if (__glibc_likely (curval == oldval))
-	{
-	  if (self->cancelstate == PTHREAD_CANCEL_ENABLE
-	      && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval))
-	    {
-	      THREAD_SETMEM (self, result, PTHREAD_CANCELED);
-	      __do_cancel ();
-	    }
-
-	  break;
-	}
-
-      /* Prepare for the next round.  */
-      oldval = curval;
-    }
+  if (oldtype != NULL)
+    *oldtype = self->canceltype;
+  self->canceltype = type;
+  if (type == PTHREAD_CANCEL_ASYNCHRONOUS)
+    __pthread_testcancel ();
 
   return 0;
 }
diff --git a/nptl/pthread_testcancel.c b/nptl/pthread_testcancel.c
index cd937bb3a3..cf518bb8a8 100644
--- a/nptl/pthread_testcancel.c
+++ b/nptl/pthread_testcancel.c
@@ -34,5 +34,5 @@ __pthread_testcancel (void)
       __do_cancel ();
     }
 }
-strong_alias (__pthread_testcancel, pthread_testcancel)
+weak_alias (__pthread_testcancel, pthread_testcancel)
 hidden_def (__pthread_testcancel)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 8/8] nptl: Use pthread_kill on pthread_cancel
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
                   ` (5 preceding siblings ...)
  2020-12-07 21:27 ` [PATCH v2 7/8] nptl: Move cancel type " Adhemerval Zanella
@ 2020-12-07 21:27 ` Adhemerval Zanella
  2020-12-11 14:02 ` [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Florian Weimer
  7 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2020-12-07 21:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg, Florian Weimer

It consolidates the tgkill call and it is the first step of making
pthread_cancel async-signal-safe.

Checked on x86_64-linux-gnu.
---
 nptl/Versions         |  2 ++
 nptl/pthreadP.h       |  2 ++
 nptl/pthread_cancel.c |  7 +------
 nptl/pthread_kill.c   | 19 +++++++++++++------
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/nptl/Versions b/nptl/Versions
index 7cfe39a91c..ec68f8bb3d 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -66,6 +66,8 @@ libc {
     __pthread_attr_copy;
     __pthread_getattr_default_np;
     __pthread_attr_setsigmask_internal;
+    # Used for thread cancellation.
+    __pthread_kill_internal;
   }
 }
 
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 1a8518ef23..40499d6881 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -514,6 +514,8 @@ extern int __pthread_equal (pthread_t thread1, pthread_t thread2);
 extern int __pthread_detach (pthread_t th);
 extern int __pthread_cancel (pthread_t th);
 libc_hidden_proto (__pthread_kill)
+extern int __pthread_kill_internal (pthread_t threadid, int signo);
+libc_hidden_proto (__pthread_kill_internal);
 extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));
 extern int __pthread_join (pthread_t threadid, void **thread_return);
 extern int __pthread_setcanceltype (int type, int *oldtype);
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index 266fd77284..766dfca260 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -69,12 +69,7 @@ __pthread_cancel (pthread_t th)
 
 	  /* The cancellation handler will take care of marking the
 	     thread as canceled.  */
-	  pid_t pid = __getpid ();
-
-	  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
-					   SIGCANCEL);
-	  if (INTERNAL_SYSCALL_ERROR_P (val))
-	    result = INTERNAL_SYSCALL_ERRNO (val);
+	  __pthread_kill_internal (th, SIGCANCEL);
 
 	  break;
 	}
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
index cf12fa743f..97f1bf2b4b 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -20,13 +20,8 @@
 #include <pthreadP.h>
 
 int
-__pthread_kill (pthread_t threadid, int signo)
+__pthread_kill_internal (pthread_t threadid, int signo)
 {
-  /* Disallow sending the signal we use for cancellation, timers,
-     for the setxid implementation.  */
-  if (__is_internal_signal (signo))
-    return EINVAL;
-
   sigset_t set;
   __libc_signal_block_all (&set);
 
@@ -57,5 +52,17 @@ __pthread_kill (pthread_t threadid, int signo)
 
   return val;
 }
+libc_hidden_def (__pthread_kill_internal)
+
+int
+__pthread_kill (pthread_t threadid, int signo)
+{
+  /* Disallow sending the signal we use for cancellation, timers,
+     for the setxid implementation.  */
+  if (__is_internal_signal (signo))
+    return EINVAL;
+
+  return __pthread_kill_internal (threadid, signo);
+}
 libc_hidden_def (__pthread_kill)
 weak_alias (__pthread_kill, pthread_kill)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl
  2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
                   ` (6 preceding siblings ...)
  2020-12-07 21:27 ` [PATCH 8/8] nptl: Use pthread_kill on pthread_cancel Adhemerval Zanella
@ 2020-12-11 14:02 ` Florian Weimer
  7 siblings, 0 replies; 9+ messages in thread
From: Florian Weimer @ 2020-12-11 14:02 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha, Zack Weinberg

* Adhemerval Zanella:

> The nptl already expects a Linux syscall internally.  Also
> __is_internal_signal is used and the DEBUGGING_P check is removed.
>
> Checked on x86_64-linux-gnu.

Looks okay to me.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-11 14:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 21:27 [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 2/8] nptl: Move pthread_kill to libc Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 3/8] nptl: Make pthread_kill async-signal-safe Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 4/8] nptl: Remove pthread raise implementation Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 5/8] nptl: Implement raise in terms of pthread_kill Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 6/8] nptl: Move cancel state out of cancelhandling Adhemerval Zanella
2020-12-07 21:27 ` [PATCH v2 7/8] nptl: Move cancel type " Adhemerval Zanella
2020-12-07 21:27 ` [PATCH 8/8] nptl: Use pthread_kill on pthread_cancel Adhemerval Zanella
2020-12-11 14:02 ` [PATCH v2 1/8] nptl: Move Linux pthread_kill to nptl Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).