]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nptl: Increase default TCB alignment to 32
authorFlorian Weimer <fweimer@redhat.com>
Fri, 3 Dec 2021 15:28:07 +0000 (16:28 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 3 Dec 2021 19:43:31 +0000 (20:43 +0100)
rseq support will use a 32-byte aligned field in struct pthread,
so the whole struct needs to have at least that alignment.

nptl/tst-tls3mod.c uses TCB_ALIGNMENT, therefore include <descr.h>
to obtain the fallback definition.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
18 files changed:
nptl/descr.h
nptl/tst-tls3mod.c
sysdeps/aarch64/nptl/pthreaddef.h
sysdeps/alpha/nptl/pthreaddef.h
sysdeps/arc/nptl/pthreaddef.h
sysdeps/arm/nptl/pthreaddef.h
sysdeps/csky/nptl/pthreaddef.h
sysdeps/ia64/nptl/pthreaddef.h
sysdeps/m68k/nptl/pthreaddef.h
sysdeps/microblaze/nptl/pthreaddef.h
sysdeps/mips/nptl/pthreaddef.h
sysdeps/nios2/nptl/pthreaddef.h
sysdeps/powerpc/nptl/pthreaddef.h
sysdeps/riscv/nptl/pthreaddef.h
sysdeps/s390/nptl/pthreaddef.h
sysdeps/sh/nptl/pthreaddef.h
sysdeps/sparc/sparc32/pthreaddef.h
sysdeps/sparc/sparc64/pthreaddef.h

index 41ee56feb26b246214b91e6f705bc3c7f09f5c1a..af2a6ab87a64a9378d2198875092d3cf25a4e8ce 100644 (file)
@@ -36,7 +36,9 @@
 #include <tls-internal-struct.h>
 
 #ifndef TCB_ALIGNMENT
-# define TCB_ALIGNMENT sizeof (double)
+# define TCB_ALIGNMENT 32
+#elif TCB_ALIGNMENT < 32
+# error TCB_ALIGNMENT must be at least 32
 #endif
 
 
index 7090b41ce6dc1c2311d606c739aadcd2531b493c..b2b218f7c9bdee523d6d5751f05bef6e1fbf9b78 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <pthreaddef.h>
+#include <descr.h>
 
 
 extern pthread_barrier_t b;
index 4d5ecf6661fd0fe6849945e0a50eeb8d036b3513..8d9a10622d132a7a4fea638329b1486ea4dc32f2 100644 (file)
@@ -28,8 +28,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK 2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT 16
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 25edb5093e09554844e0d51291b9ed26697804ea..660e5694a25ec60fb247fb4908a956d61a15c72f 100644 (file)
@@ -27,8 +27,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     4096
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 873b9d149ac46a62947a1341c1be899a8be2b280..d4dbe9e0794453537b40a2d80798fc6c394bab18 100644 (file)
@@ -28,8 +28,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          4
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 332f4079c4c3f2bf3c9ec2af69148e751794a1ff..13769f5ae270b0cafd683f5a9413d5285a409c8d 100644 (file)
@@ -28,9 +28,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.
 
index e78bc0016b43b450619e5555c316022862c49f1e..7dde9131b9b1a6b08b8bbc20c91864898bce36db 100644 (file)
@@ -28,8 +28,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          8
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 3a0f6daf9ad871aa27529e1b8e77e037fc50b211..c7420fd1e4ee6081a4a148009c5e2d0b8c38964c 100644 (file)
@@ -30,9 +30,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     16384
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __stack_pointer
index cf46ed7a93cc22c9a0a2c182a1912eb5aa274ae0..aefb3c5b2259bb59a8681e8d7ed6969d4b49690d 100644 (file)
@@ -27,9 +27,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 517157444da556adc6d486c9dd78cb1ee3667d6e..19d7235782afde5391c84973530ac0b9b6b9cc4a 100644 (file)
@@ -31,8 +31,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK  2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT       16
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME __builtin_frame_address (0)
index a7bccef6e512438f4f601feb1016e77be91deea1..322591c293ce5e1571abd6fc04c3043979f9abc1 100644 (file)
@@ -27,9 +27,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index e01a0e6df72c089a25b1f42474d03a5e83ea576c..aa0709d0dc69f2513a2e256827ce7ca187e047b2 100644 (file)
@@ -28,8 +28,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          4
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index ef5310e6315fde2cd4e518e81a333d9647f35533..117c35229ea68f48f98be57eda78b2971dbbf6fc 100644 (file)
@@ -28,9 +28,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     4096
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 7bf93d6a63fdecd2346ab4cae33982d8c48da25c..0f33cc48fe4fc728ff5e03c5325e9df7ac079d62 100644 (file)
@@ -28,8 +28,5 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 091f82df24a4024c36a5531007eec1b22b1f43e7..0e32bd862f7fea4874c3a12d589a93ad62c8f6ce 100644 (file)
@@ -28,9 +28,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 3fa3d189ef969c90243825a5cab3f24b29b9983a..f4e3a290df4ee6e64525d37ffa26d41c35be1c50 100644 (file)
@@ -29,9 +29,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          8
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME    __builtin_frame_address (0)
index 6526fb3d6e7e144871e3d98265df3aaa4ebd4e2c..7a0a04789dac478e8e1942d75b0cb08ced8bd4fd 100644 (file)
@@ -27,9 +27,6 @@
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     2048
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 64))
index 3da9d7afc8054598469329db1633f94328a596a9..103842856d40432b5c1460469e73d51290a1a037 100644 (file)
 /* Minimal stack size after allocating thread descriptor and guard size.  */
 #define MINIMAL_REST_STACK     4096
 
-/* Alignment requirement for TCB.  */
-#define TCB_ALIGNMENT          16
-
-
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 128))
 register char *stack_pointer __asm__("%sp");