about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-03-23 09:16:59 -0400
committerZack Weinberg <zackw@panix.com>2018-03-26 08:30:46 -0400
commit9ea49e16c79bd2acd0d0648ca0163f26dd1c3dae (patch)
treebc5d3c3735dd1ee96b43f1dee3001dfb165d1fd8
parent3d8eb8099425ae4f474e97082e04784c2984ec48 (diff)
downloadglibc-zack/wip-pthread-no-dupe-defns.tar.gz
glibc-zack/wip-pthread-no-dupe-defns.tar.xz
glibc-zack/wip-pthread-no-dupe-defns.zip
[Bug 15368] Move pthread_kill to libc and use it to implement raise. zack/wip-pthread-no-dupe-defns
The fix for bug #15368 was unnecessarily Linux-specific.  To recap,
POSIX specifies raise to be async-signal-safe, but also specifies it
to be equivalent to pthread_kill(pthread_self(), sig), which is not
an async-signal-safe sequence of operations; a signal handler could
run in between pthread_self and pthread_kill, and do something (such
as calling fork, which is also async-signal-safe) that would invalidate
the thread descriptor.  This is even true in the hypothetical case of
a port that doesn't implement multithreading: kill(getpid(), sig) will
fire the signal twice if a signal handler runs in between, calls fork,
and then returns on both sides of the fork.  I don't see anything in
the standards to forbid that.

The Linux-specific fix was to override the definitions of raise in
both libpthread and libc to the same unitary function that blocks
signals, retrieves TID and PID directly from the kernel, calls tgkill,
and only then unblocks signals.  This patch generalizes that to any
port: pthread_kill is moved from libpthread to libc, with a forwarding
stub left behind.  The definition of raise in libpthread is also
replaced with a forwarding stub.  The Linux-specific definition of
raise is deleted; those ports will now use sysdeps/pthread/raise.c,
which blocks signals first, then calls pthread_self and pthread_kill,
and then unblocks signals.  Similarly, sysdeps/posix/raise.c (which
would be used on a port that didn't implement multithreading) blocks
signals, calls getpid and kill, and then unblocks signals.  Thus,
ports need only implement the primitives correctly and do not need to
worry about making raise async-signal-safe.

The only wrinkle was that up till now, we did not bother initializing
the ->tid field of the initial thread's descriptor unless libpthread
was loaded; now that raise calls pthread_kill even in a single-
threaded environment, that won't fly.  This is abstractly easy to fix;
the tricky part was figuring out _where_ to put the calls (two of
them, as it happens) to __pthread_initialize_pids, and I'd appreciate
careful eyes on those changes.

You might be wondering why it's safe to rely on the TID in the thread
descriptor, rather than calling gettid directly.  Since all signals
are blocked from before calling pthread_self until after pthread_kill
uses the TID to call tgkill, the question is whether some _other_
thread could do something that would invalidate the calling thread's
descriptor, and I believe there is no such thing.

While I was at it I fixed another bug: raise was returning an error
code on failure (like pthread_kill does) instead of setting errno as
specified.  This is user-visible but I don't think it's worth recording
as a fixed bug, nobody bothers checking whether raise failed anyway.

	* nptl/pt-raise.c
	* sysdeps/unix/sysv/linux/pt-raise.c
	* sysdeps/unix/sysv/linux/raise.c:
	Remove file.

	* sysdeps/unix/sysv/linux/pthread_kill.c: Use __is_internal_signal
	to check for forbidden signals.  Use INTERNAL_SYSCALL_CALL to call
	getpid.  Provide __libc_pthread_kill, with __pthread_kill as
	strong alias and pthread_kill as weak alias.

	* sysdeps/posix/raise.c: Block signals around the calls to
	__getpid and __kill.  Provide __libc_raise, with raise as strong
	alias, libc_hidden_def for raise, and gsignal as weak alias.
	* sysdeps/pthread/raise.c: New file.  Implement by blocking
	signals, calling pthread_self and pthread_kill, and then
	unblocking signals again.  Provide same symbols as above.

	* sysdeps/generic/internal-signals.h: Define all of the same
	functions that sysdeps/unix/sysv/linux/internal-signals.h does,
	with sensible default definitions.
	* sysdeps/unix/sysv/linux/internal-signals.h: Clarify comments.

	* nptl/pthread_kill.c: Define __libc_pthread_kill, with
	__pthread_kill as strong alias and pthread_kill as weak alias.
	* nptl/pthread_self.c: Define __pthread_self, with
	pthread_self as weak alias.
	* signal/raise.c: Define __libc_raise, with raise as strong alias,
	libc_hidden_def for raise, and gsignal as weak alias.

	* nptl/Makefile: Move pthread_kill from libpthread-routines to
	routines.  Remove pt-raise from libpthread-routines.
	* nptl/Versions (libc/GLIBC_2.28): Add pthread_kill.
	(libc/GLIBC_PRIVATE): Add __libc_pthread_kill and __libc_raise.
	* sysdeps/generic/pt-compat-stubs.S: Add stubs for raise and
	pthread_kill.

	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
	Don't call __pthread_initialize_pids here.
	* csu/libc-tls.c (__libc_setup_tls):
        Call __pthread_initialize_pids after all other setup.
	* elf/rtld.c (init_tls): Likewise.

	* include/pthreadP.h: New forwarder.
	* include/pthread.h: Add multiple inclusion guard.  Declare
	__pthread_self.
	* include/signal.h: Declare __pthread_kill.

	* sysdeps/**/libc.abilist (GLIBC_2.28): Add pthread_kill.
-rw-r--r--csu/libc-tls.c10
-rw-r--r--elf/rtld.c9
-rw-r--r--include/pthread.h5
-rw-r--r--include/pthreadP.h1
-rw-r--r--include/signal.h2
-rw-r--r--nptl/Makefile5
-rw-r--r--nptl/Versions6
-rw-r--r--nptl/nptl-init.c5
-rw-r--r--nptl/pt-raise.c29
-rw-r--r--nptl/pthread_kill.c5
-rw-r--r--nptl/pthread_self.c3
-rw-r--r--signal/raise.c6
-rw-r--r--sysdeps/generic/internal-signals.h51
-rw-r--r--sysdeps/generic/pt-compat-stubs.S6
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist2
-rw-r--r--sysdeps/posix/raise.c47
-rw-r--r--sysdeps/pthread/raise.c76
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/arm/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/i386/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/internal-signals.h12
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/pt-raise.c20
-rw-r--r--sysdeps/unix/sysv/linux/pthread_kill.c16
-rw-r--r--sysdeps/unix/sysv/linux/raise.c53
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sh/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/tile/tilegx32/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/tile/tilegx64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist2
49 files changed, 294 insertions, 131 deletions
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 28a79441cd..91d83dfba6 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/param.h>
-
+#include <pthread-pids.h>
 
 #ifdef SHARED
  #error makefile bug, this file is for static only
@@ -215,4 +215,12 @@ __libc_setup_tls (void)
 #endif
 
   init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
+
+  /* Initialize only as much of the initial thread's descriptor as is
+     necessary even when libpthread is not loaded.  More will be done
+     by __pthread_initialize_minimal if libpthread is loaded.  This
+     needs to happen before anything that could possibly call raise,
+     but cannot happen before TLS is initialized.  */
+  struct pthread *pd = THREAD_SELF;
+  __pthread_initialize_pids (pd);
 }
diff --git a/elf/rtld.c b/elf/rtld.c
index f8d9597cdd..8367398e64 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -41,6 +41,7 @@
 #include <tls.h>
 #include <stap-probe.h>
 #include <stackinfo.h>
+#include <pthread-pids.h>
 
 #include <assert.h>
 
@@ -741,6 +742,14 @@ cannot allocate TLS data structures for initial thread\n");
     _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
   tls_init_tp_called = true;
 
+  /* Initialize only as much of the initial thread's descriptor as is
+     necessary even when libpthread is not loaded.  More will be done
+     by __pthread_initialize_minimal if libpthread is loaded.  This
+     needs to happen before anything that could possibly call raise,
+     but cannot happen before TLS is initialized.  */
+  struct pthread *pd = THREAD_SELF;
+  __pthread_initialize_pids (pd);
+
   return tcbp;
 }
 
diff --git a/include/pthread.h b/include/pthread.h
index 858c869a16..7bbd36ccc7 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -1,3 +1,5 @@
+#ifndef _INCLUDE_PTHREAD_H
+#define _INCLUDE_PTHREAD_H 1
 #include_next <pthread.h>
 
 #ifndef _ISOMAC
@@ -11,6 +13,9 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
 extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
      __THROWNL __nonnull ((1));
 
+extern pthread_t __pthread_self (void) __THROW attribute_hidden;
+
 /* This function is called to initialize the pthread library.  */
 extern void __pthread_initialize (void) __attribute__ ((weak));
 #endif
+#endif
diff --git a/include/pthreadP.h b/include/pthreadP.h
new file mode 100644
index 0000000000..651d94aaa4
--- /dev/null
+++ b/include/pthreadP.h
@@ -0,0 +1 @@
+#include <nptl/pthreadP.h>
diff --git a/include/signal.h b/include/signal.h
index 293258ad65..d48113fcd7 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -59,5 +59,7 @@ extern __typeof (__sigaction) __sigaction attribute_hidden;
 extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
 #  endif
 
+extern typeof (pthread_kill) __pthread_kill attribute_hidden;
+
 # endif /* _ISOMAC */
 #endif /* signal.h */
diff --git a/nptl/Makefile b/nptl/Makefile
index 167f2cc24b..bf31da0ee5 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -29,7 +29,7 @@ extra-libs-others := $(extra-libs)
 
 routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
 	   libc-cleanup libc_pthread_init libc_multiple_threads \
-	   register-atfork pthread_atfork pthread_self
+	   register-atfork pthread_atfork pthread_self pthread_kill
 shared-only-routines = forward
 static-only-routines = pthread_atfork
 
@@ -90,7 +90,7 @@ libpthread-routines = nptl-init vars events version pt-interp \
 		      pthread_barrierattr_setpshared \
 		      pthread_key_create pthread_key_delete \
 		      pthread_getspecific pthread_setspecific \
-		      pthread_sigmask pthread_kill pthread_sigqueue \
+		      pthread_sigmask pthread_sigqueue \
 		      pthread_cancel pthread_testcancel \
 		      pthread_setcancelstate pthread_setcanceltype \
 		      pthread_once \
@@ -108,7 +108,6 @@ libpthread-routines = nptl-init vars events version pt-interp \
 		      cancellation \
 		      lowlevellock \
 		      lll_timedlock_wait lll_timedwait_tid \
-		      pt-raise \
 		      pt-compat-stubs \
 		      flockfile ftrylockfile funlockfile \
 		      sigaction \
diff --git a/nptl/Versions b/nptl/Versions
index 0ae5def464..18c96e851c 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -28,6 +28,9 @@ libc {
     pthread_cond_wait; pthread_cond_signal;
     pthread_cond_broadcast; pthread_cond_timedwait;
   }
+  GLIBC_2.28 {
+    pthread_kill;
+  }
   GLIBC_PRIVATE {
     __libc_alloca_cutoff;
     # Internal libc interface to libpthread
@@ -36,6 +39,9 @@ libc {
     __libc_pthread_init;
     __libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
     __libc_allocate_rtsig_private;
+    # Used by compat stubs
+    __libc_pthread_kill;
+    __libc_raise;
   }
 }
 
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 5a4b52419f..77fa9d9cde 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -37,7 +37,6 @@
 #include <futex-internal.h>
 #include <kernel-features.h>
 #include <libc-pointer-arith.h>
-#include <pthread-pids.h>
 
 #ifndef TLS_MULTIPLE_THREADS_IN_TCB
 /* Pointer to the corresponding variable in libc.  */
@@ -283,9 +282,9 @@ static bool __nptl_initial_report_events __attribute_used__;
 void
 __pthread_initialize_minimal_internal (void)
 {
-  /* Minimal initialization of the thread descriptor.  */
+  /* Minimal initialization of the thread descriptor.
+     pd->tid was set during TLS initialization.  */
   struct pthread *pd = THREAD_SELF;
-  __pthread_initialize_pids (pd);
   THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
   THREAD_SETMEM (pd, user_stack, true);
   if (LLL_LOCK_INITIALIZER != 0)
diff --git a/nptl/pt-raise.c b/nptl/pt-raise.c
deleted file mode 100644
index c4d3893a4d..0000000000
--- a/nptl/pt-raise.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ISO C raise function for libpthread.
-   Copyright (C) 2002-2018 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
-   <http://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/nptl/pthread_kill.c b/nptl/pthread_kill.c
index bbe57d18c6..c682a422d1 100644
--- a/nptl/pthread_kill.c
+++ b/nptl/pthread_kill.c
@@ -22,7 +22,7 @@
 
 
 int
-__pthread_kill (pthread_t threadid, int signo)
+__libc_pthread_kill (pthread_t threadid, int signo)
 {
   struct pthread *pd = (struct pthread *) threadid;
 
@@ -33,6 +33,7 @@ __pthread_kill (pthread_t threadid, int signo)
 
   return ENOSYS;
 }
-strong_alias (__pthread_kill, pthread_kill)
+strong_alias (__libc_pthread_kill, __pthread_kill)
+weak_alias (__libc_pthread_kill, pthread_kill)
 
 stub_warning (pthread_kill)
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c
index ae173c4661..bcf32068ea 100644
--- a/nptl/pthread_self.c
+++ b/nptl/pthread_self.c
@@ -20,7 +20,8 @@
 #include <tls.h>
 
 pthread_t
-pthread_self (void)
+__pthread_self (void)
 {
   return (pthread_t) THREAD_SELF;
 }
+weak_alias (__pthread_self, pthread_self)
diff --git a/signal/raise.c b/signal/raise.c
index 2590adac4f..fb695277b3 100644
--- a/signal/raise.c
+++ b/signal/raise.c
@@ -20,12 +20,14 @@
 
 /* Raise the signal SIG.  */
 int
-raise (int sig)
+__libc_raise (int sig)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (raise, gsignal)
+strong_alias (__libc_raise, raise)
+libc_hidden_def (raise)
+weak_alias (__libc_raise, gsignal)
 
 stub_warning (raise)
 stub_warning (gsignal)
diff --git a/sysdeps/generic/internal-signals.h b/sysdeps/generic/internal-signals.h
index 01e5b75b6b..1bae0fd875 100644
--- a/sysdeps/generic/internal-signals.h
+++ b/sysdeps/generic/internal-signals.h
@@ -1,4 +1,4 @@
-/* Special use of signals internally.  Stub version.
+/* Special use of signals internally.  Generic version.
    Copyright (C) 2014-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -15,3 +15,52 @@
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
+
+#ifndef __INTERNAL_SIGNALS_H
+# define __INTERNAL_SIGNALS_H
+
+#include <signal.h>
+#include <sigsetops.h>
+
+/* Return whether sig is used internally.  */
+static inline int
+__is_internal_signal (int sig)
+{
+  return 0;
+}
+
+/* Remove internal glibc signals from the mask.  */
+static inline void
+__clear_internal_signals (sigset_t *set)
+{
+}
+
+/* Block all signals, including internal glibc ones; write the previous
+   signal mask to SET.  */
+static inline int
+__libc_signal_block_all (sigset_t *set)
+{
+  sigset_t allset;
+  __sigfillset (&allset);
+  return __sigprocmask (SIG_BLOCK, &allset, set);
+}
+
+/* Block all application signals (excluding internal glibc ones); write
+   the previous signal mask to SET.  */
+static inline int
+__libc_signal_block_app (sigset_t *set)
+{
+  sigset_t allset;
+  __sigfillset (&allset);
+  __clear_internal_signals (&allset);
+  return __sigprocmask (SIG_BLOCK, &allset, set);
+}
+
+/* Restore process signal mask according to SET.  */
+static inline int
+__libc_signal_restore_set (const sigset_t *set)
+{
+  return __sigprocmask (SIG_SETMASK, set, NULL);
+}
+
+#endif
diff --git a/sysdeps/generic/pt-compat-stubs.S b/sysdeps/generic/pt-compat-stubs.S
index 426689a18d..d9d49f6b16 100644
--- a/sysdeps/generic/pt-compat-stubs.S
+++ b/sysdeps/generic/pt-compat-stubs.S
@@ -131,6 +131,9 @@
         define_stub(pause)
         compat_stub(pause, pause, GLIBC_2_0)
 
+	define_stub(raise)
+	compat_stub(raise, raise, GLIBC_2_0)
+
         define_stub(read)
         compat_stub(read, read, GLIBC_2_0)
         compat_stub(read, __read, GLIBC_2_0)
@@ -171,6 +174,9 @@
         compat_stub(write, write, GLIBC_2_0)
         compat_stub(write, __write, GLIBC_2_0)
 
+        define_stub(pthread_kill)
+        compat_stub(pthread_kill, pthread_kill, GLIBC_2_0)
+
 #endif
 
 /* The off64_t functions were added in glibc 2.2, but some architectures
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 9545e898c1..daf8c16aae 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2049,6 +2049,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/posix/raise.c b/sysdeps/posix/raise.c
index 1f02b201e1..f171dc2407 100644
--- a/sysdeps/posix/raise.c
+++ b/sysdeps/posix/raise.c
@@ -15,14 +15,55 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <errno.h>
 #include <signal.h>
 #include <unistd.h>
+#include <internal-signals.h>
 
-/* Raise the signal SIG.  */
+/* Raise the signal SIG.  POSIX requires raise to be async-signal-safe,
+   but calling getpid and then raise is *not* async-signal-safe; if an
+   async signal handler calls fork (which is also async-signal-safe)
+   in between the two operations, and returns normally on both sides
+   of the fork, kill will be called twice.  So we must block signals
+   around the operation.  See bug 15368 for more detail.
+ */
 int
-raise (int sig)
+__libc_raise (int sig)
 {
-  return __kill (__getpid (), sig);
+  /* Disallow sending the signals we use for cancellation, timers,
+     setxid, etc.  This check is also performed in __kill, but
+     if we do it now we can avoid blocking and then unblocking signals
+     unnecessarily.  */
+  if (__glibc_unlikely (__is_internal_signal (sig)))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We can safely assume that __libc_signal_block_app and
+     __libc_signal_restore_set will not fail, because
+     sigprocmask can only fail under three circumstances:
+
+     1. sigsetsize != sizeof (sigset_t) (EINVAL)
+     2. a failure in copy from/to user space (EFAULT)
+     3. an invalid 'how' operation (EINVAL)
+
+     Getting any of these would indicate a bug in either the
+     definition of sigset_t or the implementations of the
+     wrappers.  */
+  sigset_t omask;
+  __libc_signal_block_app (&omask);
+
+  int ret = __kill (__getpid (), sig);
+
+  /* ... But just because sigprocmask will not fail here, that doesn't
+     mean it won't clobber errno.  */
+  int save_errno = errno;
+  __libc_signal_restore_set (&omask);
+  __set_errno (errno);
+
+  return ret;
 }
+strong_alias (__libc_raise, raise)
 libc_hidden_def (raise)
 weak_alias (raise, gsignal)
diff --git a/sysdeps/pthread/raise.c b/sysdeps/pthread/raise.c
new file mode 100644
index 0000000000..583cd1535d
--- /dev/null
+++ b/sysdeps/pthread/raise.c
@@ -0,0 +1,76 @@
+/* ISO C raise function for libpthread.
+   Copyright (C) 2002-2018 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <internal-signals.h>
+
+/* Raise the signal SIG.  POSIX requires raise to be async-signal-safe,
+   but also requires it to be equivalent to pthread_kill (pthread_self (), sig),
+   and that construct is *not* async-signal safe.  In particular, an
+   async signal handler that calls fork (which is also async-signal-safe)
+   could invalidate the handle returned by pthread_self, and/or cause
+   pthread_kill to be called twice.  So we must block signals around
+   the operation.  See bug 15368 for more detail.
+
+   Also, raise sets errno on failure, whereas pthread_kill returns the
+   error code.  (It is not possible for pthread_self to fail.)  */
+
+int
+__libc_raise (int sig)
+{
+  /* Disallow sending the signals we use for cancellation, timers,
+     setxid, etc.  This check is also performed in pthread_kill, but
+     if we do it now we can avoid blocking and then unblocking signals
+     unnecessarily.  */
+  if (__glibc_unlikely (__is_internal_signal (sig)))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We can safely assume that __libc_signal_block_app and
+     __libc_signal_restore_set will not fail, because
+     sigprocmask can only fail under three circumstances:
+
+     1. sigsetsize != sizeof (sigset_t) (EINVAL)
+     2. a failure in copy from/to user space (EFAULT)
+     3. an invalid 'how' operation (EINVAL)
+
+     Getting any of these would indicate a bug in either the
+     definition of sigset_t or the implementations of the
+     wrappers.  */
+  sigset_t omask;
+  __libc_signal_block_app (&omask);
+
+  int ret = __pthread_kill (__pthread_self (), sig);
+
+  __libc_signal_restore_set (&omask);
+
+  if (__glibc_unlikely (ret))
+    {
+      __set_errno (ret);
+      return -1;
+    }
+  return 0;
+}
+strong_alias (__libc_raise, raise)
+libc_hidden_def (raise)
+weak_alias (__libc_raise, gsignal)
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 90c9bc84e1..8c0cf4d7af 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2139,3 +2139,5 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8674a874b4..df3e7d6628 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2054,6 +2054,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index 044ec102c2..52ab98b3de 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -130,6 +130,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 2360130abe..e2f2a991fe 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1894,6 +1894,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 39c993fd79..bacf5a184d 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2064,6 +2064,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 68496aa6ac..236f087894 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1928,6 +1928,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h
index e007372f21..ad828ff56a 100644
--- a/sysdeps/unix/sysv/linux/internal-signals.h
+++ b/sysdeps/unix/sysv/linux/internal-signals.h
@@ -36,14 +36,14 @@
 #define SIGSETXID       (__SIGRTMIN + 1)
 
 
-/* Return is sig is used internally.  */
+/* Return whether sig is used internally.  */
 static inline int
 __is_internal_signal (int sig)
 {
   return (sig == SIGCANCEL) || (sig == SIGSETXID);
 }
 
-/* Remove internal glibc signal from the mask.  */
+/* Remove internal glibc signals from the mask.  */
 static inline void
 __clear_internal_signals (sigset_t *set)
 {
@@ -54,7 +54,8 @@ __clear_internal_signals (sigset_t *set)
 #define SIGALL_SET \
   ((__sigset_t) { .__val = {[0 ...  _SIGSET_NWORDS-1 ] =  -1 } })
 
-/* Block all signals, including internal glibc ones.  */
+/* Block all signals, including internal glibc ones; write the previous
+   signal mask to SET.  */
 static inline int
 __libc_signal_block_all (sigset_t *set)
 {
@@ -63,7 +64,8 @@ __libc_signal_block_all (sigset_t *set)
 			   set, _NSIG / 8);
 }
 
-/* Block all application signals (excluding internal glibc ones).  */
+/* Block all application signals (excluding internal glibc ones); write
+   the previous signal mask to SET.  */
 static inline int
 __libc_signal_block_app (sigset_t *set)
 {
@@ -74,7 +76,7 @@ __libc_signal_block_app (sigset_t *set)
 			   _NSIG / 8);
 }
 
-/* Restore current process signal mask.  */
+/* Restore process signal mask according to SET.  */
 static inline int
 __libc_signal_restore_set (const sigset_t *set)
 {
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index b676025261..206341cd8d 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -131,6 +131,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index cdd1df55d0..9d476461c8 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2008,6 +2008,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
index e4265fd74d..6bb0c62b62 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
@@ -2129,3 +2129,5 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 3a7e0b4c29..840093d0ac 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -1983,6 +1983,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 5e805924fa..cccc333aeb 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -1981,6 +1981,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 1973fac36d..4128e9f72a 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -1989,6 +1989,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 5e18ab83b4..601b038ede 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -1984,6 +1984,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index cc5885ab9b..4edb4667a8 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2170,3 +2170,5 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 676aa50c81..0c6f194b74 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2012,6 +2012,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 2016c7c1e5..9a9be2258a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2017,6 +2017,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 3d19e38dbd..f4b710075e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2229,3 +2229,5 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index c57ab21b82..658dd0f0df 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -131,6 +131,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 _Exit F
 GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
diff --git a/sysdeps/unix/sysv/linux/pt-raise.c b/sysdeps/unix/sysv/linux/pt-raise.c
deleted file mode 100644
index b5513d4537..0000000000
--- a/sysdeps/unix/sysv/linux/pt-raise.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* ISO C raise function for libpthread.
-   Copyright (C) 2002-2018 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/unix/sysv/linux/raise.c>
diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c
index 3a6171b815..80939cdd92 100644
--- a/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -22,10 +22,10 @@
 #include <tls.h>
 #include <sysdep.h>
 #include <unistd.h>
-
+#include <internal-signals.h>
 
 int
-__pthread_kill (pthread_t threadid, int signo)
+__libc_pthread_kill (pthread_t threadid, int signo)
 {
   struct pthread *pd = (struct pthread *) threadid;
 
@@ -42,18 +42,18 @@ __pthread_kill (pthread_t threadid, int signo)
     /* 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)
+  /* Disallow sending the signals we use for cancellation, timers,
+     setxid, etc.  */
+  if (__is_internal_signal (signo))
     return EINVAL;
 
   /* We have a special syscall to do the work.  */
   INTERNAL_SYSCALL_DECL (err);
 
-  pid_t pid = __getpid ();
-
+  pid_t pid = INTERNAL_SYSCALL_CALL (getpid, err);
   int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo);
   return (INTERNAL_SYSCALL_ERROR_P (val, err)
 	  ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
 }
-strong_alias (__pthread_kill, pthread_kill)
+strong_alias (__libc_pthread_kill, __pthread_kill)
+weak_alias (__libc_pthread_kill, pthread_kill)
diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c
deleted file mode 100644
index b05eae202f..0000000000
--- a/sysdeps/unix/sysv/linux/raise.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2002-2018 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
-   <http://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);
-
-  INTERNAL_SYSCALL_DECL (err);
-  pid_t pid = INTERNAL_SYSCALL (getpid, err, 0);
-  pid_t tid = INTERNAL_SYSCALL (gettid, err, 0);
-
-  int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig);
-
-  __libc_signal_restore_set (&set);
-
-  return ret;
-}
-libc_hidden_def (raise)
-weak_alias (raise, gsignal)
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 8ab44ec41f..60342db2a9 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2094,3 +2094,5 @@ GLIBC_2.27 xdrstdio_create F
 GLIBC_2.27 xencrypt F
 GLIBC_2.27 xprt_register F
 GLIBC_2.27 xprt_unregister F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 25903720e3..4f5d0bb82f 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2022,6 +2022,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 5d6800c236..1810c6e152 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1923,6 +1923,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index c04872ca7f..0d1a7d095f 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -1898,6 +1898,8 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 85cbe308d6..182f7d6e2c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2015,6 +2015,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index f7a1ab8edb..1ed8c8a5ae 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1952,6 +1952,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx32/libc.abilist
index ab56ecee44..e1cea90f30 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx32/libc.abilist
@@ -2136,3 +2136,5 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx64/libc.abilist
index f2518c08ff..78bdfa766b 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx64/libc.abilist
@@ -2136,3 +2136,5 @@ GLIBC_2.27 wcstof32x F
 GLIBC_2.27 wcstof32x_l F
 GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 2a3cc40674..89f19bbc9d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1905,6 +1905,8 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 8bc16b9004..727a8b4151 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2148,3 +2148,5 @@ GLIBC_2.27 wcstof64 F
 GLIBC_2.27 wcstof64_l F
 GLIBC_2.27 wcstof64x F
 GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 pthread_kill F