From patchwork Fri Dec 3 16:33:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 48469 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93B24385800D for ; Fri, 3 Dec 2021 16:33:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93B24385800D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638549236; bh=vWZygDRRIlNyzRTscw3rsDeDQGepKBhg+krqDLOBjcw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TAT0/HMKZoe3esMgY7tNvJF8+w5/TtP9WGeicKR332c5BUHYQz7MsghnGIWn1yZWI Y7GuR89nO0KPCnaxJbDQbDGcgfdHPwMFRLaXj7MfcgNFgzTLnMmyTaPGjdfFmNqG8u ngwQr/QQOLcG7NlZU88ad/Bwz8d7UssXzBm+n0Hc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8C7BE3858D28 for ; Fri, 3 Dec 2021 16:33:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8C7BE3858D28 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-YODMp3HcMvSJXe6PfH-yPw-1; Fri, 03 Dec 2021 11:33:31 -0500 X-MC-Unique: YODMp3HcMvSJXe6PfH-yPw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA1E1101F7A3 for ; Fri, 3 Dec 2021 16:33:30 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CAB25ED25 for ; Fri, 3 Dec 2021 16:33:29 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] nptl: Increase default TCB alignment to 32 Date: Fri, 03 Dec 2021 17:33:28 +0100 Message-ID: <87r1atwsvb.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 to obtain the fallback definition. Tested on i686-linux-gnu and x86_64-linux-gnu. Built with build-many-glibcs.py. Reviewed-by: H.J. Lu --- nptl/descr.h | 4 +++- nptl/tst-tls3mod.c | 1 + sysdeps/aarch64/nptl/pthreaddef.h | 3 --- sysdeps/alpha/nptl/pthreaddef.h | 3 --- sysdeps/arc/nptl/pthreaddef.h | 3 --- sysdeps/arm/nptl/pthreaddef.h | 3 --- sysdeps/csky/nptl/pthreaddef.h | 3 --- sysdeps/ia64/nptl/pthreaddef.h | 3 --- sysdeps/m68k/nptl/pthreaddef.h | 3 --- sysdeps/microblaze/nptl/pthreaddef.h | 3 --- sysdeps/mips/nptl/pthreaddef.h | 3 --- sysdeps/nios2/nptl/pthreaddef.h | 3 --- sysdeps/powerpc/nptl/pthreaddef.h | 3 --- sysdeps/riscv/nptl/pthreaddef.h | 3 --- sysdeps/s390/nptl/pthreaddef.h | 3 --- sysdeps/sh/nptl/pthreaddef.h | 3 --- sysdeps/sparc/sparc32/pthreaddef.h | 3 --- sysdeps/sparc/sparc64/pthreaddef.h | 4 ---- 18 files changed, 4 insertions(+), 50 deletions(-) diff --git a/nptl/descr.h b/nptl/descr.h index 41ee56feb2..af2a6ab87a 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -36,7 +36,9 @@ #include #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 diff --git a/nptl/tst-tls3mod.c b/nptl/tst-tls3mod.c index 7090b41ce6..b2b218f7c9 100644 --- a/nptl/tst-tls3mod.c +++ b/nptl/tst-tls3mod.c @@ -23,6 +23,7 @@ #include #include #include +#include extern pthread_barrier_t b; diff --git a/sysdeps/aarch64/nptl/pthreaddef.h b/sysdeps/aarch64/nptl/pthreaddef.h index 4d5ecf6661..8d9a10622d 100644 --- a/sysdeps/aarch64/nptl/pthreaddef.h +++ b/sysdeps/aarch64/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/alpha/nptl/pthreaddef.h b/sysdeps/alpha/nptl/pthreaddef.h index 25edb5093e..660e5694a2 100644 --- a/sysdeps/alpha/nptl/pthreaddef.h +++ b/sysdeps/alpha/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/arc/nptl/pthreaddef.h b/sysdeps/arc/nptl/pthreaddef.h index 873b9d149a..d4dbe9e079 100644 --- a/sysdeps/arc/nptl/pthreaddef.h +++ b/sysdeps/arc/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/arm/nptl/pthreaddef.h b/sysdeps/arm/nptl/pthreaddef.h index 332f4079c4..13769f5ae2 100644 --- a/sysdeps/arm/nptl/pthreaddef.h +++ b/sysdeps/arm/nptl/pthreaddef.h @@ -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. diff --git a/sysdeps/csky/nptl/pthreaddef.h b/sysdeps/csky/nptl/pthreaddef.h index e78bc0016b..7dde9131b9 100644 --- a/sysdeps/csky/nptl/pthreaddef.h +++ b/sysdeps/csky/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/ia64/nptl/pthreaddef.h b/sysdeps/ia64/nptl/pthreaddef.h index 3a0f6daf9a..c7420fd1e4 100644 --- a/sysdeps/ia64/nptl/pthreaddef.h +++ b/sysdeps/ia64/nptl/pthreaddef.h @@ -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 diff --git a/sysdeps/m68k/nptl/pthreaddef.h b/sysdeps/m68k/nptl/pthreaddef.h index cf46ed7a93..aefb3c5b22 100644 --- a/sysdeps/m68k/nptl/pthreaddef.h +++ b/sysdeps/m68k/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/microblaze/nptl/pthreaddef.h b/sysdeps/microblaze/nptl/pthreaddef.h index 517157444d..19d7235782 100644 --- a/sysdeps/microblaze/nptl/pthreaddef.h +++ b/sysdeps/microblaze/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/mips/nptl/pthreaddef.h b/sysdeps/mips/nptl/pthreaddef.h index a7bccef6e5..322591c293 100644 --- a/sysdeps/mips/nptl/pthreaddef.h +++ b/sysdeps/mips/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/nios2/nptl/pthreaddef.h b/sysdeps/nios2/nptl/pthreaddef.h index e01a0e6df7..aa0709d0dc 100644 --- a/sysdeps/nios2/nptl/pthreaddef.h +++ b/sysdeps/nios2/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/powerpc/nptl/pthreaddef.h b/sysdeps/powerpc/nptl/pthreaddef.h index ef5310e631..117c35229e 100644 --- a/sysdeps/powerpc/nptl/pthreaddef.h +++ b/sysdeps/powerpc/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/riscv/nptl/pthreaddef.h b/sysdeps/riscv/nptl/pthreaddef.h index 7bf93d6a63..0f33cc48fe 100644 --- a/sysdeps/riscv/nptl/pthreaddef.h +++ b/sysdeps/riscv/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/s390/nptl/pthreaddef.h b/sysdeps/s390/nptl/pthreaddef.h index 091f82df24..0e32bd862f 100644 --- a/sysdeps/s390/nptl/pthreaddef.h +++ b/sysdeps/s390/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/sh/nptl/pthreaddef.h b/sysdeps/sh/nptl/pthreaddef.h index 3fa3d189ef..f4e3a290df 100644 --- a/sysdeps/sh/nptl/pthreaddef.h +++ b/sysdeps/sh/nptl/pthreaddef.h @@ -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) diff --git a/sysdeps/sparc/sparc32/pthreaddef.h b/sysdeps/sparc/sparc32/pthreaddef.h index 6526fb3d6e..7a0a04789d 100644 --- a/sysdeps/sparc/sparc32/pthreaddef.h +++ b/sysdeps/sparc/sparc32/pthreaddef.h @@ -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)) diff --git a/sysdeps/sparc/sparc64/pthreaddef.h b/sysdeps/sparc/sparc64/pthreaddef.h index 3da9d7afc8..103842856d 100644 --- a/sysdeps/sparc/sparc64/pthreaddef.h +++ b/sysdeps/sparc/sparc64/pthreaddef.h @@ -27,10 +27,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 (stack_pointer + (2 * 128)) register char *stack_pointer __asm__("%sp");