public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.37/master] nptl: Unconditionally use a 32-byte rseq area
@ 2024-03-18 17:49 Arjun Shankar
0 siblings, 0 replies; only message in thread
From: Arjun Shankar @ 2024-03-18 17:49 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9da8174362860b4fc564c8ca8c11fc3c51ed1de9
commit 9da8174362860b4fc564c8ca8c11fc3c51ed1de9
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Jul 21 16:18:18 2023 +0200
nptl: Unconditionally use a 32-byte rseq area
If the kernel headers provide a larger struct rseq, we used that
size as the argument to the rseq system call. As a result,
rseq registration would fail on older kernels which only accept
size 32.
(cherry picked from commit 2c6b4b272e6b4d07303af25709051c3e96288f2d)
Diff:
---
nptl/descr.h | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/nptl/descr.h b/nptl/descr.h
index 4d7ef28edd..e196ab7562 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -34,7 +34,6 @@
#include <bits/types/res_state.h>
#include <kernel-features.h>
#include <tls-internal-struct.h>
-#include <sys/rseq.h>
#include <internal-sigset.h>
#ifndef TCB_ALIGNMENT
@@ -405,14 +404,25 @@ struct pthread
/* Used on strsignal. */
struct tls_internal_t tls_state;
- /* rseq area registered with the kernel. */
- struct rseq rseq_area;
+ /* rseq area registered with the kernel. Use a custom definition
+ here to isolate from kernel struct rseq changes. The
+ implementation of sched_getcpu needs acccess to the cpu_id field;
+ the other fields are unused and not included here. */
+ union
+ {
+ struct
+ {
+ uint32_t cpu_id_start;
+ uint32_t cpu_id;
+ };
+ char pad[32]; /* Original rseq area size. */
+ } rseq_area __attribute__ ((aligned (32)));
/* Amount of end padding, if any, in this structure.
This definition relies on rseq_area being last. */
#define PTHREAD_STRUCT_END_PADDING \
(sizeof (struct pthread) - offsetof (struct pthread, rseq_area) \
- + sizeof (struct rseq))
+ + sizeof ((struct pthread) {}.rseq_area))
} __attribute ((aligned (TCB_ALIGNMENT)));
static inline bool
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-18 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 17:49 [glibc/release/2.37/master] nptl: Unconditionally use a 32-byte rseq area Arjun Shankar
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).