public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH glibc] Linux: Use fixed rseq_len value for rseq registration
@ 2020-07-13 19:34 Mathieu Desnoyers
  2020-07-14  8:51 ` Florian Weimer
  0 siblings, 1 reply; 13+ messages in thread
From: Mathieu Desnoyers @ 2020-07-13 19:34 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Carlos O'Donell, Joseph Myers, Szabolcs Nagy, libc-alpha,
	Mathieu Desnoyers

The rseq registration system call expects a fixed-size argument of 32
for the rseq_len.  We are currently discussing schemes to extend
struct rseq beyond that size, and those involve using fields within
struct rseq, without any changes to the rseq_len argument.

Building a glibc with an updated, larger, struct rseq in the Linux
kernel UAPI headers should not break registration.  Therefore, use
a fixed-size of 32 as rseq_len parameter.

See struct rseq extension discussion:

https://lore.kernel.org/lkml/1305865358.10354.1594665620975.JavaMail.zimbra@efficios.com/
---
 sysdeps/unix/sysv/linux/rseq-internal.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
index 8f6772ca1d..3522668f3a 100644
--- a/sysdeps/unix/sysv/linux/rseq-internal.h
+++ b/sysdeps/unix/sysv/linux/rseq-internal.h
@@ -33,8 +33,9 @@ rseq_register_current_thread (void)
   if (__rseq_abi.cpu_id != RSEQ_CPU_ID_UNINITIALIZED)
     __libc_fatal ("glibc fatal error: "
                   "rseq already initialized for this thread\n");
-  ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, sizeof (struct rseq),
-                               0, RSEQ_SIG);
+  /* The rseq_len parameter does not allow extending struct rseq.  Fix its
+     value to 32 as expected by the Linux kernel.  */
+  ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, 32, 0, RSEQ_SIG);
   if (INTERNAL_SYSCALL_ERROR_P (ret))
     {
       const char *msg = NULL;
-- 
2.17.1


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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 19:34 [RFC PATCH glibc] Linux: Use fixed rseq_len value for rseq registration Mathieu Desnoyers
2020-07-14  8:51 ` Florian Weimer
2020-07-14 12:31   ` Mathieu Desnoyers
2020-07-14 13:28     ` Florian Weimer
2020-07-14 13:33       ` Christian Brauner
2020-07-14 13:54         ` Florian Weimer
2020-07-14 14:04           ` Mathieu Desnoyers
2020-07-14 15:07             ` Florian Weimer
2020-07-14 15:30               ` Mathieu Desnoyers
2020-07-14 16:01                 ` Szabolcs Nagy
2020-07-14 16:12                   ` Mathieu Desnoyers
2020-07-14 17:03                     ` Florian Weimer
2020-07-14 17:12                       ` Mathieu Desnoyers

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).