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:17:01 +0100
commita257f201dd557aa82c7efb7528277afe675c0468 (patch)
treef7524a3e0079709b1ba14e36a299136501713678
parentc4ed6a380ed7b7b9670e3974ecb5d2db7d455123 (diff)
downloadglibc-a257f201dd557aa82c7efb7528277afe675c0468.zip
glibc-a257f201dd557aa82c7efb7528277afe675c0468.tar.gz
glibc-a257f201dd557aa82c7efb7528277afe675c0468.tar.bz2
Revert "x86_64: Remove unused padding from tcbhead_t"
This reverts commit 30d3fd7f4f4bc8f767d73ad4e4b005c1bd234310. 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--sysdeps/x86_64/nptl/tls.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
index a9c348e..551d342 100644
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -62,16 +62,28 @@ typedef struct
void *__private_ss;
/* The marker for the current shadow stack. */
unsigned long long int ssp_base;
+ /* Must be kept even if it is no longer used by glibc since programs,
+ like AddressSanitizer, depend on the size of tcbhead_t. */
+ __128bits __glibc_unused2[8][4] __attribute__ ((aligned (32)));
+
+ void *__padding[8];
} tcbhead_t;
# ifdef __ILP32__
/* morestack.S in libgcc uses offset 0x40 to access __private_ss, */
_Static_assert (offsetof (tcbhead_t, __private_ss) == 0x40,
"offset of __private_ss != 0x40");
+/* NB: ssp_base used to be "long int __glibc_reserved2", which was
+ changed from 32 bits to 64 bits. Make sure that the offset of the
+ next field, __glibc_unused2, is unchanged. */
+_Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x60,
+ "offset of __glibc_unused2 != 0x60");
# else
/* morestack.S in libgcc uses offset 0x70 to access __private_ss, */
_Static_assert (offsetof (tcbhead_t, __private_ss) == 0x70,
"offset of __private_ss != 0x70");
+_Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
+ "offset of __glibc_unused2 != 0x80");
# endif
#else /* __ASSEMBLER__ */