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 41ee56f..af2a6ab 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 7090b41..b2b218f 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <pthreaddef.h>
+#include <descr.h>
 
 
 extern pthread_barrier_t b;
index 4d5ecf6..8d9a106 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 25edb50..660e569 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 873b9d1..d4dbe9e 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 332f407..13769f5 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 e78bc00..7dde913 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 3a0f6da..c7420fd 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 cf46ed7..aefb3c5 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 5171574..19d7235 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 a7bccef..322591c 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 e01a0e6..aa0709d 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 ef5310e..117c352 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 7bf93d6..0f33cc4 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 091f82d..0e32bd8 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 3fa3d18..f4e3a29 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 6526fb3..7a0a047 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 3da9d7a..1038428 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");