|
|
94084c |
Downstream adjustment: Change return type of
|
|
|
94084c |
rseq_register_current_thread to bool. Upstream, this was part of the
|
|
|
94084c |
commit that introduced the ABI symbols.
|
|
|
94084c |
|
|
|
94084c |
commit a41c8e92350e744a4bc639df5025153d05263e7f
|
|
|
94084c |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
94084c |
Date: Thu Dec 9 09:49:32 2021 +0100
|
|
|
94084c |
|
|
|
94084c |
nptl: rseq failure after registration on main thread is fatal
|
|
|
94084c |
|
|
|
94084c |
This simplifies the application programming model.
|
|
|
94084c |
|
|
|
94084c |
Browser sandboxes have already been fixed:
|
|
|
94084c |
|
|
|
94084c |
Sandbox is incompatible with rseq registration
|
|
|
94084c |
<https://bugzilla.mozilla.org/show_bug.cgi?id=1651701>
|
|
|
94084c |
|
|
|
94084c |
Allow rseq in the Linux sandboxes. r=gcp
|
|
|
94084c |
<https://hg.mozilla.org/mozilla-central/rev/042425712eb1>
|
|
|
94084c |
|
|
|
94084c |
Sandbox needs to support rseq system call
|
|
|
94084c |
<https://bugs.chromium.org/p/chromium/issues/detail?id=1104160>
|
|
|
94084c |
|
|
|
94084c |
Linux sandbox: Allow rseq(2)
|
|
|
94084c |
<https://chromium.googlesource.com/chromium/src.git/+/230675d9ac8f1>
|
|
|
94084c |
|
|
|
94084c |
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|
94084c |
|
|
|
94084c |
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
|
|
94084c |
index f405fa356c2955ce..109c5e3dc78c9aa2 100644
|
|
|
94084c |
--- a/nptl/pthread_create.c
|
|
|
94084c |
+++ b/nptl/pthread_create.c
|
|
|
94084c |
@@ -371,7 +371,8 @@ start_thread (void *arg)
|
|
|
94084c |
/* Register rseq TLS to the kernel. */
|
|
|
94084c |
{
|
|
|
94084c |
bool do_rseq = THREAD_GETMEM (pd, flags) & ATTR_FLAG_DO_RSEQ;
|
|
|
94084c |
- rseq_register_current_thread (pd, do_rseq);
|
|
|
94084c |
+ if (!rseq_register_current_thread (pd, do_rseq) && do_rseq)
|
|
|
94084c |
+ __libc_fatal ("Fatal glibc error: rseq registration failed\n");
|
|
|
94084c |
}
|
|
|
94084c |
|
|
|
94084c |
#ifndef __ASSUME_SET_ROBUST_LIST
|
|
|
94084c |
diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
|
|
|
94084c |
index 15bc7ffd6eda632d..6a3441f2cc49e7c4 100644
|
|
|
94084c |
--- a/sysdeps/unix/sysv/linux/rseq-internal.h
|
|
|
94084c |
+++ b/sysdeps/unix/sysv/linux/rseq-internal.h
|
|
|
94084c |
@@ -26,7 +26,7 @@
|
|
|
94084c |
#include <sys/rseq.h>
|
|
|
94084c |
|
|
|
94084c |
#ifdef RSEQ_SIG
|
|
|
94084c |
-static inline void
|
|
|
94084c |
+static inline bool
|
|
|
94084c |
rseq_register_current_thread (struct pthread *self, bool do_rseq)
|
|
|
94084c |
{
|
|
|
94084c |
if (do_rseq)
|
|
|
94084c |
@@ -35,15 +35,17 @@ rseq_register_current_thread (struct pthread *self, bool do_rseq)
|
|
|
94084c |
sizeof (self->rseq_area),
|
|
|
94084c |
0, RSEQ_SIG);
|
|
|
94084c |
if (!INTERNAL_SYSCALL_ERROR_P (ret))
|
|
|
94084c |
- return;
|
|
|
94084c |
+ return true;
|
|
|
94084c |
}
|
|
|
94084c |
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
|
|
|
94084c |
+ return false;
|
|
|
94084c |
}
|
|
|
94084c |
#else /* RSEQ_SIG */
|
|
|
94084c |
static inline void
|
|
|
94084c |
rseq_register_current_thread (struct pthread *self, bool do_rseq)
|
|
|
94084c |
{
|
|
|
94084c |
THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
|
|
|
94084c |
+ return false;
|
|
|
94084c |
}
|
|
|
94084c |
#endif /* RSEQ_SIG */
|
|
|
94084c |
|