aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-01-07 08:34:13 +0100
committerFlorian Weimer <fweimer@redhat.com>2025-01-07 09:16:47 +0100
commitc4ed6a380ed7b7b9670e3974ecb5d2db7d455123 (patch)
tree879fea29018449de8e5d377761168c2ca4c3f137
parent2d196c2e10a3f75a46910210430435da1afff81f (diff)
downloadglibc-c4ed6a380ed7b7b9670e3974ecb5d2db7d455123.zip
glibc-c4ed6a380ed7b7b9670e3974ecb5d2db7d455123.tar.gz
glibc-c4ed6a380ed7b7b9670e3974ecb5d2db7d455123.tar.bz2
Revert "nptl: More useful padding in struct pthread"
This reverts commit 7c22dcda27743658b6b8ea479283b384ad56bd5a. The padding is required by Chromium's MaybeUpdateGlibcTidCache in sandbox/linux/services/namespace_sandbox.cc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r--nptl/descr.h56
1 files changed, 31 insertions, 25 deletions
diff --git a/nptl/descr.h b/nptl/descr.h
index bcc537e..d0d3092 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -129,32 +129,41 @@ struct priority_protection_data
/* Thread descriptor data structure. */
struct pthread
{
+ union
+ {
#if !TLS_DTV_AT_TP
- /* This overlaps the TCB as used for TLS without threads (see tls.h). */
- tcbhead_t header;
+ /* This overlaps the TCB as used for TLS without threads (see tls.h). */
+ tcbhead_t header;
#else
- struct
- {
- /* multiple_threads is enabled either when the process has spawned at
- least one thread or when a single-threaded process cancels itself.
- This enables additional code to introduce locking before doing some
- compare_and_exchange operations and also enable cancellation points.
- The concepts of multiple threads and cancellation points ideally
- should be separate, since it is not necessary for multiple threads to
- have been created for cancellation points to be enabled, as is the
- case is when single-threaded process cancels itself.
-
- Since enabling multiple_threads enables additional code in
- cancellation points and compare_and_exchange operations, there is a
- potential for an unneeded performance hit when it is enabled in a
- single-threaded, self-canceling process. This is OK though, since a
- single-threaded process will enable async cancellation only when it
- looks to cancel itself and is hence going to end anyway. */
- int multiple_threads;
- int gscope_flag;
- } header;
+ struct
+ {
+ /* multiple_threads is enabled either when the process has spawned at
+ least one thread or when a single-threaded process cancels itself.
+ This enables additional code to introduce locking before doing some
+ compare_and_exchange operations and also enable cancellation points.
+ The concepts of multiple threads and cancellation points ideally
+ should be separate, since it is not necessary for multiple threads to
+ have been created for cancellation points to be enabled, as is the
+ case is when single-threaded process cancels itself.
+
+ Since enabling multiple_threads enables additional code in
+ cancellation points and compare_and_exchange operations, there is a
+ potential for an unneeded performance hit when it is enabled in a
+ single-threaded, self-canceling process. This is OK though, since a
+ single-threaded process will enable async cancellation only when it
+ looks to cancel itself and is hence going to end anyway. */
+ int multiple_threads;
+ int gscope_flag;
+ } header;
#endif
+ /* This extra padding has no special purpose, and this structure layout
+ is private and subject to change without affecting the official ABI.
+ We just have it here in case it might be convenient for some
+ implementation-specific instrumentation hack or suchlike. */
+ void *__padding[24];
+ };
+
/* This descriptor's link on the GL (dl_stack_used) or
GL (dl_stack_user) list. */
list_t list;
@@ -398,9 +407,6 @@ struct pthread
/* getrandom vDSO per-thread opaque state. */
void *getrandom_buf;
- /* Can be used for backports preserving internal TCB layout. */
- void *padding[8];
-
/* 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;