From patchwork Mon Aug 5 20:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969196 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=af1RH225; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7pV4Lf3z1yXs for ; Tue, 6 Aug 2024 06:49:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F111385DDE3 for ; Mon, 5 Aug 2024 20:49:20 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id 7DCE4385841C for ; Mon, 5 Aug 2024 20:48:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DCE4385841C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7DCE4385841C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890940; cv=none; b=FW1mx2891dXbKAlwbnajoBuKoZnTrRY17AJHx74de7m31qrRU/FCwmAN9uITkI3Yx+yvFaw3m++Xq4ynfYLN60Z37M2gRutTbSmlORk4UGzm9+Dlif8V74tm5oTmr55E0NioIHU6HZaCpYkOra+uSt5UgJy/i66UMZaMeroluFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890940; c=relaxed/simple; bh=QBvDz7qzBhVdlKqzZhMMyWNVjpJUSOhFSU2PDCkmO1A=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=u7znbSTfihmHai3PzF15sA+ghHhLppPhz7CdNkAvwMvQzZ9GQJ0OuE7wUV/B2cPi32eQSmEL26lCameh5p3eaeiytnRyCP2rHDff/wdY1epcG56WD63hUaug26XpRltexKRn2Vatb0JpaMkxxlUhb7DWbRWtvkHeGGbwP0IgbPk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890938; bh=QBvDz7qzBhVdlKqzZhMMyWNVjpJUSOhFSU2PDCkmO1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=af1RH225kyad4aSsSVS+qkniPU8Wkcf5HnWjwOcU9gSq+x8wW5Do2NrM9AR6/ZTf8 yRRvCmbKzGj5nNZxWnfCYbSh6/SRkOv6blfFI7tFtHCQBdWtdf2tmliQAbqAIdxJUL 1X56K+lPPK3+5dPbCyJD5P0CImdzP/Xsutm1GxFK7LDFHzN7Hj7RMHzA1DtkG94mIY aLSh3ZtNCXqwcI0kqeb3EGfKVRpMEE/DoALtYkAxErMvXry/nn6J9db8VhYnZ9F8ce zxg/4mLygcHs02O/lm7YmNQDjj28dOQS+MvwTA1vrFUDYCJ7zNoGR7IWvj5EOM29mi Bj79NUyZ4Cb3w== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p21Yt6z1Fkf; Mon, 5 Aug 2024 16:48:58 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 01/17] nptl: Add rseq auxvals Date: Mon, 5 Aug 2024 16:48:23 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-1-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Get the rseq feature size and alignment requirement from the auxiliary vector for use inside the dynamic loader. This will be used in the TLS block allocator to compute the size and alignment of the rseq area block for the extended ABI support. Signed-off-by: Michael Jeanson --- Changes since v11: - Removed _dl_rseq_feature_size, use __rseq_size instead - Replace GLRO(dl_rseq_align) with a hidden global variable _rseq_align --- sysdeps/nptl/dl-tls_init_tp.c | 2 ++ sysdeps/unix/sysv/linux/dl-parse_auxv.h | 5 +++++ sysdeps/unix/sysv/linux/rseq-internal.h | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 7803e19fd1..b2abb2762d 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -46,6 +46,8 @@ rtld_mutex_dummy (pthread_mutex_t *lock) const unsigned int __rseq_flags; +size_t _rseq_align attribute_hidden; + void __tls_pre_init_tp (void) { diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h index ea2a58ecb1..d24daab3fc 100644 --- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h +++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h @@ -21,6 +21,7 @@ #include #include #include +#include typedef ElfW(Addr) dl_parse_auxv_t[AT_MINSIGSTKSZ + 1]; @@ -59,5 +60,9 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values) GLRO(dl_sysinfo) = auxv_values[AT_SYSINFO]; #endif + _rseq_size = MAX (auxv_values[AT_RSEQ_FEATURE_SIZE], + RSEQ_AREA_SIZE_INITIAL_USED); + _rseq_align = MAX (auxv_values[AT_RSEQ_ALIGN], RSEQ_MIN_ALIGN); + DL_PLATFORM_AUXV } diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 7ea935b4ad..2aae447b60 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -25,12 +25,23 @@ #include #include -/* 32 is the initially required value for the area size. The - actually used rseq size may be less (20 bytes initially). */ +/* Minimum size of the rseq area allocation required by the syscall. The + actually used rseq feature size may be less (20 bytes initially). */ #define RSEQ_AREA_SIZE_INITIAL 32 + +/* Minimum used feature size of the rseq area. */ #define RSEQ_AREA_SIZE_INITIAL_USED 20 -/* The variables are in .data.relro but are not yet write-protected. */ +/* Minimum alignment of the rseq area. */ +#define RSEQ_MIN_ALIGN 32 + +/* Alignment requirement of the rseq area. + Populated from the auxiliary vector with a minimum of '32'. */ +extern size_t _rseq_align attribute_hidden; + +/* Size of the active features in the rseq area. + Populated from the auxiliary vector with a minimum of '20'. + In .data.relro but not yet write-protected. */ extern unsigned int _rseq_size attribute_hidden; extern ptrdiff_t _rseq_offset attribute_hidden; From patchwork Mon Aug 5 20:48:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969198 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=WuQjBboE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7pg3NX4z1yXs for ; Tue, 6 Aug 2024 06:49:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4524B385DDE3 for ; Mon, 5 Aug 2024 20:49:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id BA66B385841D for ; Mon, 5 Aug 2024 20:48:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA66B385841D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA66B385841D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; cv=none; b=hdWJvNobIcrAt4SI7AK4N8/UfTqGAJc4xQlJA4lQm5KTPbf5MS4hNb8n9I7ZjCU744QdRtTUSQ048NGaCHUw4Jdf4/I1cpk8hdPssmzDz/uTJ4Cy9ItR84d5PkCl6aV4oSM8jRkLvnzVZoin+MgwZwgStERsQW9I59t9WfbmWus= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; c=relaxed/simple; bh=AEVbucOjKfzWNrbBycmBnWGRpuK18xG6x3HgSKrT3IU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RXqArdC76kMx8kmHibt2XrxoI93RviCfskukluynz1nZG0THWb7fVVrxd50FK2zD4F4G04DEuVOXkr/aG4Li/JIgTsd2ZAc38Ucrkl3n3PbG+leGFj0UhAg9iMEdYXsjeARYRtvj1jxK7FHLfE2nCRgthkUqn44YxbvV6KqLfRI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890939; bh=AEVbucOjKfzWNrbBycmBnWGRpuK18xG6x3HgSKrT3IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WuQjBboEIfWCrFjAijwT4Y1eEIvbuEQ4ibbNUWl3kKL899hkcmDXoHGbmOTl1Of82 ZK/2ocJ4BD+LslOY9rrwf2VjaNX7qorksB9OiXtamoDhm8vJaYI1MWhuHiyUflJyUz 2pC7AJxvB81M8hnYCVDDVjfWAtWCzE1pCrHMVDsTM5+KkvDAqUOvDgvrkcjftUEp6o 6dVsdTIXmkpMDTP+H80viZ3Hq0iDUKNkHBuRlMkF/ulehzJadSHLkkYzFD59At66g+ 92YSP5Vz+1ME7mhEEuiEknBczYsmnK/BlW5zsvgVHEyUdsrHdUX38hsRwX/84hNMBU ZA2AZEDPsKWVg== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p32cqYz1GY7; Mon, 5 Aug 2024 16:48:59 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 02/17] Add generic 'extra TLS' Date: Mon, 5 Aug 2024 16:48:24 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-2-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Add the logic to append an 'extra TLS' block in the TLS block allocator with a generic stub implementation. Signed-off-by: Michael Jeanson --- csu/libc-tls.c | 59 +++++++++++++++++++++++++++++++++++------- elf/dl-tls.c | 59 ++++++++++++++++++++++++++++++++++++++++++ sysdeps/generic/dl-extra_tls.h | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 9 deletions(-) diff --git a/csu/libc-tls.c b/csu/libc-tls.c index b7682bdf43..03a000c499 100644 --- a/csu/libc-tls.c +++ b/csu/libc-tls.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef SHARED #error makefile bug, this file is for static only @@ -110,6 +111,7 @@ __libc_setup_tls (void) size_t filesz = 0; void *initimage = NULL; size_t align = 0; + size_t tls_blocks_size = 0; size_t max_align = TCB_ALIGNMENT; size_t tcb_offset; const ElfW(Phdr) *phdr; @@ -135,22 +137,67 @@ __libc_setup_tls (void) /* Calculate the size of the static TLS surplus, with 0 auditors. */ _dl_tls_static_surplus_init (0); + /* Extra TLS block for internal usage to append at the end of the TLS blocks + (in allocation order). On Linux systems this is where the rseq area will + be allocated. On other systems it is currently unused and both values will + be '0'. */ + size_t extra_tls_size = _dl_extra_tls_get_size(); + size_t extra_tls_align = _dl_extra_tls_get_align(); + + /* Increase the maximum alignment with the extra TLS alignment requirements + if necessary. */ + max_align = MAX (max_align, extra_tls_align); + /* We have to set up the TCB block which also (possibly) contains 'errno'. Therefore we avoid 'malloc' which might touch 'errno'. Instead we use 'sbrk' which would only uses 'errno' if it fails. In this case we are right away out of memory and the user gets what she/he deserves. */ #if TLS_TCB_AT_TP + /* Before the the thread pointer, add the aligned tls block size and then + align the extra tls block on top. */ + tls_blocks_size = roundup (roundup (memsz, align ?: 1) + extra_tls_size, + extra_tls_align); + + /* Record the extra TLS block offset from the thread pointer. + + With TLS_TCB_AT_TP the TLS blocks are allocated before the thread pointer + in reverse order. Our block is added last which results in it being the + first in the static TLS block, thus record the most negative offset. + + The alignment requirements of the pointer resulting from this offset and + the thread pointer are enforced by 'max_align' which is used to align the + tcb_offset. */ + _dl_extra_tls_set_offset(-tls_blocks_size); + /* Align the TCB offset to the maximum alignment, as _dl_allocate_tls_storage (in elf/dl-tls.c) does using __libc_memalign and dl_tls_static_align. */ - tcb_offset = roundup (memsz + GLRO(dl_tls_static_surplus), max_align); + tcb_offset = roundup (tls_blocks_size + GLRO(dl_tls_static_surplus), max_align); tlsblock = _dl_early_allocate (tcb_offset + TLS_INIT_TCB_SIZE + max_align); if (tlsblock == NULL) _startup_fatal_tls_error (); #elif TLS_DTV_AT_TP + /* Align memsz on top of the initial tcb. */ tcb_offset = roundup (TLS_INIT_TCB_SIZE, align ?: 1); - tlsblock = _dl_early_allocate (tcb_offset + memsz + max_align + + /* After the thread pointer, add the initial tcb plus the tls block size and + then align the extra TLS block on top. */ + tls_blocks_size = roundup (tcb_offset + memsz + extra_tls_size, extra_tls_align); + + /* Record the extra TLS block offset from the thread pointer. + + With TLS_DTV_AT_TP the TLS blocks are allocated after the thread pointer in + order. Our block is added last which results in it being the last in the + static TLS block, thus record the offset as the size of the static TLS + block minus the size of our block. The resulting offset will be positive. + + The alignment requirements of the pointer resulting from this offset and + the thread pointer are enforced by 'max_align' which is used to align the + tcb_offset. */ + _dl_extra_tls_set_offset(tls_blocks_size - extra_tls_size); + + tlsblock = _dl_early_allocate (tls_blocks_size + max_align + TLS_PRE_TCB_SIZE + GLRO(dl_tls_static_surplus)); if (tlsblock == NULL) @@ -209,11 +256,5 @@ __libc_setup_tls (void) /* static_slotinfo.slotinfo[1].gen = 0; -- Already zero. */ static_slotinfo.slotinfo[1].map = main_map; - memsz = roundup (memsz, align ?: 1); - -#if TLS_DTV_AT_TP - memsz += tcb_offset; -#endif - - init_static_tls (memsz, MAX (TCB_ALIGNMENT, max_align)); + init_static_tls (tls_blocks_size, MAX (TCB_ALIGNMENT, max_align)); } diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 3d529b722c..57e72be4f2 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -36,6 +36,8 @@ #define TUNABLE_NAMESPACE rtld #include +#include + /* Surplus static TLS, GLRO(dl_tls_static_surplus), is used for - IE TLS in libc.so for all dlmopen namespaces except in the initial @@ -323,6 +325,33 @@ _dl_determine_tlsoffset (void) slotinfo[cnt].map->l_tls_offset = off; } + /* Insert the extra TLS block after the last TLS block. */ + + /* Extra TLS block for internal usage to append at the end of the TLS blocks + (in allocation order). On Linux systems this is where the rseq area will + be allocated. On other systems it is currently unused and both values will + be '0'. */ + size_t extra_tls_size = _dl_extra_tls_get_size(); + size_t extra_tls_align = _dl_extra_tls_get_align(); + + /* Align and add the extra TLS block to the global offset. */ + offset = roundup (offset, extra_tls_align) + extra_tls_size; + + /* Increase the maximum alignment with the extra TLS alignment requirements + if necessary. */ + max_align = MAX (max_align, extra_tls_align); + + /* Record the extra TLS offset. + + With TLS_TCB_AT_TP the TLS blocks are allocated before the thread pointer + in reverse order. Our block is added last which results in it being the + first in the static TLS block, thus record the most negative offset. + + The alignment requirements of the pointer resulting from this offset and + the thread pointer are enforced by 'max_align' which is used to align the + tcb_offset. */ + _dl_extra_tls_set_offset(-offset); + GL(dl_tls_static_used) = offset; GLRO (dl_tls_static_size) = (roundup (offset + GLRO(dl_tls_static_surplus), max_align) @@ -368,6 +397,36 @@ _dl_determine_tlsoffset (void) offset = off + slotinfo[cnt].map->l_tls_blocksize - firstbyte; } + /* Insert the extra TLS block after the last TLS block. */ + + /* Extra TLS block for internal usage to append at the end of the TLS blocks + (in allocation order). On Linux systems this is where the rseq area will + be allocated. On other systems it is currently unused and both values will + be '0'. */ + size_t extra_tls_size = _dl_extra_tls_get_size(); + size_t extra_tls_align = _dl_extra_tls_get_align(); + + /* Align the global offset to the beginning of the extra TLS block. */ + offset = roundup (offset, extra_tls_align); + + /* Record the extra TLS offset. + + With TLS_DTV_AT_TP the TLS blocks are allocated after the thread pointer in + order. Our block is added last which results in it being the last in the + static TLS block, thus record the offset as the size of the static TLS + block minus the size of our block. The resulting offset will be positive. + + The alignment requirements of the pointer resulting from this offset and + the thread pointer are enforced by 'max_align' which is used to align the + tcb_offset. */ + _dl_extra_tls_set_offset(offset); + + /* Add the extra TLS block to the global offset. */ + offset += extra_tls_size; + + /* Increase the max_align if necessary. */ + max_align = MAX (max_align, extra_tls_align); + GL(dl_tls_static_used) = offset; GLRO (dl_tls_static_size) = roundup (offset + GLRO(dl_tls_static_surplus), TCB_ALIGNMENT); diff --git a/sysdeps/generic/dl-extra_tls.h b/sysdeps/generic/dl-extra_tls.h new file mode 100644 index 0000000000..6e2c89828c --- /dev/null +++ b/sysdeps/generic/dl-extra_tls.h @@ -0,0 +1,45 @@ +/* extra tls utils for the dynamic linker. Generic stub version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_EXTRA_TLS_H +#define _DL_EXTRA_TLS_H 1 +#include + +/* In this generic version, the extra TLS block is unused. */ + +/* Returns the size of the extra TLS block. */ +static inline size_t +_dl_extra_tls_get_size (void) +{ + return 0; +} + +/* Returns the alignment requirements of the extra TLS block. */ +static inline size_t +_dl_extra_tls_get_align (void) +{ + return 0; +} + +/* Record the offset of the extra TLS block from the thread pointer. */ +static inline void +_dl_extra_tls_set_offset (ptrdiff_t tls_offset) +{ +} + +#endif From patchwork Mon Aug 5 20:48:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=QurzEg+w; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7qs4Jfsz1ydt for ; Tue, 6 Aug 2024 06:50:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6CCA4385DDE4 for ; Mon, 5 Aug 2024 20:50:31 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id B4BB6385842A for ; Mon, 5 Aug 2024 20:49:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4BB6385842A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B4BB6385842A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; cv=none; b=ADjFy70MlCi2qQdkkeVEKMxMH5+6RKPlCzg5yuEh1u0Px05UeZphlmAymrc61EwKSxUZIw08TdUR084fM049Dg8I+V/JOtrgu/Qrop2AnXzreeqpjQWeSVw8KFrXZyDgf+GgYdvc9QDybnTbUzWXCbVPuSSj4ooyXO/4UKW8ej4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; c=relaxed/simple; bh=mZWp3yQu7X4pjjtu112NGh0JYRD8/8ExasO5xs1X+Q4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=XieN/ki/0z4cmjzE/K1AfUOB4t6dCzgiH+52uNx5bXLIjP01Q3815nl2S95B2YmUig2Wuw0YoDzLe5OyBCMVAcMbJNqv138FEO5J5FbIqizeOjrtPrmjNPNqBWdnZJy6oeXU6BVOjIvX5vIZ9B9xb28MyonhPaoV5P8bUTt0N4I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890940; bh=mZWp3yQu7X4pjjtu112NGh0JYRD8/8ExasO5xs1X+Q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QurzEg+wtOXZ0GVbVypVD/wqPYrb5fkAF6yvelzE2g3pU3g9e5xyYfkACKaoFutY6 Xm3pQ2/8P0j4YeXb67QK6PrZ2f2C8OmtJCg64iz4AUD3t4bGQNEmEK0Kes5WZpNY6o Vy7ehUKBhCXZLzpcgeIvGnShkh6fWfvevQFClDysTnxTSZdCRMsOACmlmjjxTQocCr YWBmpWhlmZ4uI51bB90+8XoB5zYIjHr3WsziuUPRbeVAvGMLyq88CO7FzrRyFPrP4u KK2R2BHkTOb2NTXIQNhjgfItXWlUUWNHXMSF7BtqRdmtzau4SyIax4ts/xQ84KC9mp xyZko1wuh3uMw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p42N5xz1GY8; Mon, 5 Aug 2024 16:49:00 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 03/17] Add Linux 'extra TLS' Date: Mon, 5 Aug 2024 16:48:25 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-3-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Add the Linux implementation of 'extra TLS' which will allocate space for the rseq area at the end of the TLS blocks in allocation order. Signed-off-by: Michael Jeanson --- sysdeps/unix/sysv/linux/dl-extra_tls.h | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/sysdeps/unix/sysv/linux/dl-extra_tls.h b/sysdeps/unix/sysv/linux/dl-extra_tls.h new file mode 100644 index 0000000000..d00207a76e --- /dev/null +++ b/sysdeps/unix/sysv/linux/dl-extra_tls.h @@ -0,0 +1,76 @@ +/* extra tls block utils for the dynamic linker. Generic stub version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_EXTRA_TLS_H +#define _DL_EXTRA_TLS_H 1 + +#include +#include +#include +#include + +/* Returns the size of the extra TLS block. */ +static inline size_t +_dl_extra_tls_get_size (void) +{ + bool do_rseq = true; + do_rseq = TUNABLE_GET_FULL (glibc, pthread, rseq, int, NULL); + if (do_rseq) + { + /* Make sure the rseq area size is at least the minimum ABI size and a + multiple of the requested aligment. */ + return roundup (MAX (_rseq_size, RSEQ_AREA_SIZE_INITIAL), _rseq_align); + } + + /* Even when disabled by tunable, an rseq area will be allocated to allow + application code to test the registration status with 'rseq->cpu_id >= 0'. + Default to the rseq ABI minimum size, this will ensure we don't use more + TLS than necessary. */ + return RSEQ_AREA_SIZE_INITIAL; +} + +/* Returns the alignment requirements of the extra TLS block. */ +static inline size_t +_dl_extra_tls_get_align (void) +{ + bool do_rseq = true; + do_rseq = TUNABLE_GET_FULL (glibc, pthread, rseq, int, NULL); + if (do_rseq) + { + return _rseq_align; + } + + /* Even when disabled by tunable, an rseq area will be allocated to allow + application code to test the registration status with 'rseq->cpu_id >= 0'. + Default to the rseq ABI minimum alignment, this will ensure we don't use + more TLS than necessary. */ + return RSEQ_MIN_ALIGN; +} + +/* Record the offset of the extra TLS block from the thread pointer. */ +static inline void +_dl_extra_tls_set_offset (ptrdiff_t tls_offset) +{ +#ifdef RSEQ_SIG + /* Not all targets support __thread_pointer, so set __rseq_offset only if + the rseq registration may have happened because RSEQ_SIG is defined. */ + _rseq_offset = tls_offset; +#endif +} + +#endif From patchwork Mon Aug 5 20:48:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=x1PAjAav; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7q95r4yz1yXs for ; Tue, 6 Aug 2024 06:49:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0CE8385DDE3 for ; Mon, 5 Aug 2024 20:49:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id B14D5385842C for ; Mon, 5 Aug 2024 20:49:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B14D5385842C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B14D5385842C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; cv=none; b=vUTZ472N4SzA/yrnkrhKdeD4Wt1+XhYwN9wWhnWSPAWgkuCUVJ2qXtMbw8Ehn6ukK7FeS3vxY2k8v5hGgBTchGzNLtLFKDaM5HwmdqVBEs/BIo43BcOslCOBCcetgNgW972/7N4BCiE0SDIvIF/n/gGhYGAvrhyUhAgs+GwxPAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890943; c=relaxed/simple; bh=QCeWDwSUTWbdyDfSbFGWW1mXm/KLvwAFiBh65+d217c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=JQcisbFY2l5hWKTeqPl6h8H1wi/csCQV0CfI5hWskD5dORb0PcVp4BwYGtmwkFV9bNtQpFAo6yz1nfpLA4fLRzwEgVB5ij58fs11iWkOnFzNRI7isr/rRMMmXaiY/0UzXwB5ytV2/ewkWW8RSnXieR8+MJjd6zMPRtRgQZPeYMQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890941; bh=QCeWDwSUTWbdyDfSbFGWW1mXm/KLvwAFiBh65+d217c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1PAjAav0481vrTae0U+XZk2PG2PCzfIxtYknb/VitydV/+wqQ2ozl41kcXCX4kSL NlaWnk05bXp8S2Tif6SGzR7A7A5xohOOizOPpkn4updN4gQ2e+1jLVu0EMijq+OELi 0vW9G7AM6rhEHEr7gVxAIWReYQCthQuy5WUqzdbWyIrYvgHLAEkJO8ilm7r8SIVVTX UTMs4jWOM55S82aHp8aPMcOxTlGmoeDcUIE6CrLM/bznICmPy6ks0p1HNMdxubiBcl 4+WBzb94bh8gq82XitD2NEV8lS+x8YMNMQF+O575tHL6qFd1onB9nOJA1B543ce2c9 QR5thvB9QE9Iw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p52SDkz1GY9; Mon, 5 Aug 2024 16:49:01 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 04/17] nptl: Add for RISC-V Date: Mon, 5 Aug 2024 16:48:26 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-4-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/riscv/nptl/thread_pointer.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sysdeps/riscv/nptl/thread_pointer.h b/sysdeps/riscv/nptl/thread_pointer.h new file mode 100644 index 0000000000..e7f6296e7d --- /dev/null +++ b/sysdeps/riscv/nptl/thread_pointer.h @@ -0,0 +1,34 @@ +/* __thread_pointer definition. riscv version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +static inline void * +__thread_pointer (void) +{ +#if __GNUC_PREREQ (10, 3) + return __builtin_thread_pointer (); +#else + void *__result; + __asm__ ("mv %0, tp" : "=r" (__result)); + return __result; +#endif /* !GCC 10.3 */ +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=gEXUCK/h; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7qH6Ptyz1yXs for ; Tue, 6 Aug 2024 06:50:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3EE36385DDF0 for ; Mon, 5 Aug 2024 20:50:01 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id A9D713858430 for ; Mon, 5 Aug 2024 20:49:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9D713858430 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A9D713858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890944; cv=none; b=LMsSmeBgaefVI7KRlULGf02VtOjImuFFZfTD5+xff2j5W3NQ7zcQpH+ludwtd/xqpiQeAxX7Z5D6aubDVe8UAUxTziL5+IDQih/kQBTi8JCEd9JaKGN/X02Qqk/edH8Nng2ObnWiRe5kiJ9mraMA6Qt+qOjtpGF+j6A2vy8kbJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890944; c=relaxed/simple; bh=yVrUQ8rZkLYj8FVc5HB5BE2SmZ6oWAGNwcJwHsbA7v0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Y+aetFPq7TQ9zFHoelW7FPpmyuooBERMryxYqSeF89VjUBvoaZ/P67Q1Sdc0xibJ3FOSnNdVtTba9JwW8wZ7zKshSK/PtdsBU1z/rBPDzbNzA5zFN0yxuXBAC3xtLC/zXtqcYwPlrNGY9IFUDCj3sPycE15CtsvxMGqyTQ34nW4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890942; bh=yVrUQ8rZkLYj8FVc5HB5BE2SmZ6oWAGNwcJwHsbA7v0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEXUCK/hr3vmZphRamdCyxQ2C8XBRq7MqRqKe0T+sr65N3mT7fXrGqXr/qiXjqj+B yDjfhBsPIz9B/bsa4Ldcz8lyN5iPp7wBaVbz7H9Ky2TPWmHzfLbgq/kzT3ah9w7y/C a/GI+TSLuLPX9uC1aqhkpw3mCjb8e1fKclVxd9cN7jYk17sF6C1kj0+40R8whCjtmV OUMrMYFSgD+G7gMAhlnEIv6I5Ti03WincyQ+8P98h/QiDPPuFnZdTqtpzClRP8EhuM JAItFZNib5r1EolDkcdDzqoEnM3t3rGtSnJjO0uY2uBwzeLdDArX6uytTK75AJLh8d OR0WbSkzFCDtw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p622FSz1GYB; Mon, 5 Aug 2024 16:49:02 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 05/17] nptl: Add for LoongArch Date: Mon, 5 Aug 2024 16:48:27 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-5-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/loongarch/nptl/thread_pointer.h | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sysdeps/loongarch/nptl/thread_pointer.h b/sysdeps/loongarch/nptl/thread_pointer.h new file mode 100644 index 0000000000..9d46d29905 --- /dev/null +++ b/sysdeps/loongarch/nptl/thread_pointer.h @@ -0,0 +1,34 @@ +/* __thread_pointer definition. loongarch version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +static inline void * +__thread_pointer (void) +{ +#if __GNUC_PREREQ (14, 1) + return __builtin_thread_pointer (); +#else + void *__result; + __asm__ ("move %0, $tp" : "=r" (__result)); + return __result; +#endif /* !GCC 14 */ +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=a4bv4tvT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7qs03LSz1ybS for ; Tue, 6 Aug 2024 06:50:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0B93385DDF0 for ; Mon, 5 Aug 2024 20:50:30 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id A89DB385C6D1 for ; Mon, 5 Aug 2024 20:49:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A89DB385C6D1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A89DB385C6D1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890945; cv=none; b=qwomHx8XP8j1S/JfGxW3kwCG8oLAMU74jVscyns4Fz33Xr9Rpc/bjMtIKET7llNjHbMnC4WAZsJRKKWRBLB2unul0TOFn2JR04hKtPOK6lGNMdncDs1F8azuKuRSqba0z7Nk1krT0kHu8bUscS8Qy7iez8O1tKMa4HDynH4VhrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890945; c=relaxed/simple; bh=uBRxO72dAwjaGSfhCi3I9IGxcjVf27kXXV3jSm4Ebto=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=N2DfU4tvc8ihrMyfJ6fvJ6zBtUYLFOUZEOfAwN4ZFpRrjHv4w7GfmWbK7fJ3J4l+xZw9bSmK04LGYGWGee8WZo5QR3GwGYVhlOp7ofKK30gTbI6g9+e7Ovaqk99E7Zz1etkhiRxop0r7L3F7SL2ljlN9uZUq2Rvr8fbkw1WlVxw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890943; bh=uBRxO72dAwjaGSfhCi3I9IGxcjVf27kXXV3jSm4Ebto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4bv4tvTiZMky/hMs9QOyA0z86PbDSI4aFj/NkWoJxO3WVtpXkY4bCwzPuhFvmqYM tazRB3dO3b+Ufg7fDNWuR937lWDC6ZthL/Qx4Cf0nNiA9bkkcVlYzO/tPN5kUbUspG uDBUrfKtu3CZzy6YPn4y9eHLoE0pfyIeAaFbTmj1SNiMAJUJDK0FCNU0TyNdLx3gDz uimOrR81AjZG99QnpQG2+DbpnZLIPh19TlRlcFBrPb2/HJmNy56L7rtei21RNrYyJa G1eNJtUwSPzhl1xaWfGW2yQ8x2DQ/cg/3JeFhX7aJSDVG9bfYAWi05p7rSZUeZmIsJ lf+ybrIk6n/Dg== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p725mDz1GYC; Mon, 5 Aug 2024 16:49:03 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 06/17] nptl: Add for sparc Date: Mon, 5 Aug 2024 16:48:28 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-6-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/sparc/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/sparc/nptl/thread_pointer.h b/sysdeps/sparc/nptl/thread_pointer.h new file mode 100644 index 0000000000..800180f0a9 --- /dev/null +++ b/sysdeps/sparc/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. sparc version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("g7"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969203 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=vwYHZrZb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7r36p0Cz1ybS for ; Tue, 6 Aug 2024 06:50:43 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E578385828E for ; Mon, 5 Aug 2024 20:50:41 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id A6E28385C6CD for ; Mon, 5 Aug 2024 20:49:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6E28385C6CD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A6E28385C6CD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890948; cv=none; b=QH3t2a6KB8/A2ryCu0erRcw+ErRn1qyOas2MVZlZTEagOhl1rZn4IB0mnzy4uJD70jTe/kMw4FmrvpqYsXvVKWkrwWlhmYKyjqwjyTH6KeAxx+iViacrAt4UYHQwiKXRhKQmz0sEY3LWcJK9vs+Z7cwY5Z3i5C0zQKuib9yUP0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890948; c=relaxed/simple; bh=4cEI3WnY/55P6iPHOeHIt0taPHUI+xEqdm/n6l6641U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=AS650+dUaAx+rWsVi3s7o+WyTUBQ2ywXrKjJgG9mueq5Ps73SxxsYGvYuas368QwzyLB7uCw+slsoi9DjuJpB4jfSylnxNojyT96gis7EcNvlxTepA3t560P545yZIcfkBxfHLDWib9SMLxukBsakt8CSu1HqzJHrSMbaNPYm9E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890944; bh=4cEI3WnY/55P6iPHOeHIt0taPHUI+xEqdm/n6l6641U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vwYHZrZbk3SLb2iKmNBIs5uhWnwaN0b+6uEju0wcu/3eiEK1j8WjRD7BAsy5YMhYu F/hmUAxZwQ3qUD9xY815ngVdzU5fm55Plq7M1Tm2nMRdnZWY4IV16EFCeF2PB8YlyH ttkKAJnqCRUPI3l6E6WB6CsUhoCuk4M5TYLAmXjBBznuMHzSxrUCzK2Ne173L/PK0q BvW5v2o97CZsit6SPJQkQLWulziYfH6ZUeYrEQHJCWsbtXpwO3POHr4fT1dGimuPwU 16zKOWzmH9eX6ygYWZ8WaRQfBr2MJKfMU+mIIn1GVAnwc9L2h9oRKwPo4cIrQYCFFg T6Ll0+bjgMggw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p823N7z1GYD; Mon, 5 Aug 2024 16:49:04 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 07/17] nptl: Add for m68k Date: Mon, 5 Aug 2024 16:48:29 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-7-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/m68k/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/m68k/nptl/thread_pointer.h b/sysdeps/m68k/nptl/thread_pointer.h new file mode 100644 index 0000000000..50f4df38da --- /dev/null +++ b/sysdeps/m68k/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. m68k version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +extern void * __m68k_read_tp (void); + +static inline void * +__thread_pointer (void) +{ + return __m68k_read_tp(); +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=Ca1kmq3D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7rT1gxMz1ybS for ; Tue, 6 Aug 2024 06:51:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C582385DDFA for ; Mon, 5 Aug 2024 20:51:03 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id 9CD66385DDE4 for ; Mon, 5 Aug 2024 20:49:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9CD66385DDE4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9CD66385DDE4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890949; cv=none; b=sghUb2dLoCt0cXbZhbOQex6eXR3cND/pdOfAFHI+oNywU+F/ChsPlGGgsV2yGhsqMAkd+qZuEslOtmbVovLl26OImVJLpgvTL7v+f6ISAc+1heWwaSfLj9wS9jKu4h9MMFEv8AJJpQvi68KJ14pqe7Wgwzkmbmy+ym3z21cY7uE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890949; c=relaxed/simple; bh=g8QI7f+Y2Sls9rafvl8j9etaPS7E9D014KGx7tk84CE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=LOFs34WPuFMIpGP+wVS7JXG3lXbGmsbWrM0S0Xn/WPwYgwhg9QiAhVnJwP9kik7i+0gbt7TL4TeP72+5dixGnm5ElB1S8V3+P4e0mkLHeeWhoEXO/zKEFdiWyKFfNbDa3jpenenIWoju/vmzqmuMSgwWMTbbhQlIt9mcJl5+7zU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890945; bh=g8QI7f+Y2Sls9rafvl8j9etaPS7E9D014KGx7tk84CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ca1kmq3Dc85fVcZovanLZ2tBOfhXVc3ToVFktcFUDnbJvmn9uyawi7RkqUCQUvRvs t+Zk6g7IKoCsMocgTbE9rcZ/iByP258+FCBVzVpuT9MgXCoi/JUtHh3Ok0ynjVI1HD rafsgCtN16B9p+Kc8OBNnme8yv4JmvVtCWLDuzbODdQOyTIIVk8Ufi+Ks/PV1m2esn VbvoGl1XajSpP5zvREmvy8LGmVZfMenn5nAibijGr3LXPzFAT8Yed28Ujyp/7blaqI TKIShvqDnkQSflMYF7ZIkJ5X5AggAzuJH8zoWETgw+NqB1spmm1QNvVhxFxehABunp OfW43pPI4x7Pw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7p91twQz1Fy8; Mon, 5 Aug 2024 16:49:05 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 08/17] nptl: Add for or1k Date: Mon, 5 Aug 2024 16:48:30 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-8-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/or1k/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/or1k/nptl/thread_pointer.h b/sysdeps/or1k/nptl/thread_pointer.h new file mode 100644 index 0000000000..a323fe079b --- /dev/null +++ b/sysdeps/or1k/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. or1k version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("r10"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=eSSlhU7+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7rz065Qz1ybS for ; Tue, 6 Aug 2024 06:51:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D3905385DDDF for ; Mon, 5 Aug 2024 20:51:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id 9C366385842D for ; Mon, 5 Aug 2024 20:49:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C366385842D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C366385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890949; cv=none; b=e+etfkhQDv3l0Q++j01Ab162J5/loJmJbSTcmTEU6/Up+kzV5wSuOyVnq8zSnU94sjtB+oqNu7Xy/5+O4Kd4OUeUJtat5ZkZMtVyRqZmTKrVqFLYZzY0Gpa9o/Cl3fahN7APmpmzlnGQUvQwj31UNTYh8CdH38uV3ShsgQo5DHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890949; c=relaxed/simple; bh=TDFKqTgFbj1GBQtXdzgWclwbh5GrSaEX0I+TlIayXSA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=oO5KnYQbcTZHbNmb7mxVtgmAGCLbtr5sqJZX0WR0y237FjO1yHweMenj+StrxKtr4St6zUhBC3iJ8WlYT25uWalXnKAxfQ8XyNq38mLtdBkaU5/pW8VSQ8iBhJnd22A6s+MnDbUV49jnmpOkV71wNqmbCOgVgOyA9ujYb4RHKH8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890946; bh=TDFKqTgFbj1GBQtXdzgWclwbh5GrSaEX0I+TlIayXSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSSlhU7+5OWxMKvnv2FG9cP3YrYOkhpzlyj73Yfb6FU25WSWIi/tpicyIxEr6ixz2 SptZmwzZYLGOvNWIhrSVTukO+dEGI5DVcovsxHTm6hJ1PAU40cv5TqiwAuORwlMyTO nYA6klNKWY9bxFThRzHoeIp0dhwWalsLk/eY9xnT2mWKpdiDEaFzDhFLPeljxq1I5P IuXe+qQA/PDkpkPqMiyTznXrvFdjZdLzj7LopY/DCvQ2w05UDdgdU+SnhbzUuGRD5T 439KWKbrXq67UPStQo22fXw7+KcbieuC7g5/XUzDjKAZKiXy01iL/+AYBZlXH6ANPS DP2aEe3Cu9xBg== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pB1lLYz1GYF; Mon, 5 Aug 2024 16:49:06 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 09/17] nptl: Add for nios2 Date: Mon, 5 Aug 2024 16:48:31 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-9-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/nios2/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/nios2/nptl/thread_pointer.h b/sysdeps/nios2/nptl/thread_pointer.h new file mode 100644 index 0000000000..0cd6fe2295 --- /dev/null +++ b/sysdeps/nios2/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. nios2 version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("r23"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969210 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=Bi2kaYkY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7sl02Z9z1ybS for ; Tue, 6 Aug 2024 06:52:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D60743858431 for ; Mon, 5 Aug 2024 20:52:08 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 97CDD385828E for ; Mon, 5 Aug 2024 20:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97CDD385828E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 97CDD385828E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890950; cv=none; b=EBLisTp2eAtBJOBzeuqiWx3nauPZUxQKc8GHGJ6GDlYZUlCxKTFYtOf4RP/oMjlvwVHYvQtUMpkQuMupZZU+nGSZkdn65odOBCitH4RD/l+NwCTuWrAaXg2UnoCtHB/crADJNx2FFumEH0kZDjkrcA0dMD6XERX9HQ2zstwuIIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890950; c=relaxed/simple; bh=X/8cJ0pb4gHWKHspLWJlCCZkkP2ZF1foGLk3UZp2oUo=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=lPkCgfQF1NP0xOAI+p3i5bIVguXJEfTdjjOfm2wagDL+RcET38f3C+b7MJ0fvRqfgtPsTJisrTndeoukVZ8ejX5MH8FqrAwGsINnUlbPKr9GlMk4E1evF6H3xvELFziWNiCRXmWFIQGB6CY/psLUOmmigtqMhDN/hRYU5ILGijY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890947; bh=X/8cJ0pb4gHWKHspLWJlCCZkkP2ZF1foGLk3UZp2oUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bi2kaYkY416eA8bYFrx+25mtedrKpRKdqc7loV/F10F9sPQWlxjkTTaC6885hZGg8 foNp+dfMJbst9fNFv2MheYNHnjTbaJ9xrUJ1SVkxE++TLrdvRuhqwRy5UAp+j3wrIR ub64m9OX1WfrYcR8BlyaqhO4UenrP/EQcim+qfsA9ZIkrPu4IC8zJgU6vOMIz0kgMY k9gpQCOIDy9eX+eZ10AvdcEc9okr9MxHX4XMz01QXV2jzEOFG+P0JZj6sRjfHbi34P 9rsJltOMsGnD6txJl/wbkEYFoPrCbbid47UiE1TSC5dKwNaYzin91UPrcWbwdBlGbz Mwe8pyRtMFLgQ== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pC1d87z1FpR; Mon, 5 Aug 2024 16:49:07 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 10/17] nptl: Add for microblaze Date: Mon, 5 Aug 2024 16:48:32 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-10-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/microblaze/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/microblaze/nptl/thread_pointer.h b/sysdeps/microblaze/nptl/thread_pointer.h new file mode 100644 index 0000000000..1c56a7debf --- /dev/null +++ b/sysdeps/microblaze/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. microblaze version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("r21"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=rY02gPpd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7tQ0pQ9z1ybS for ; Tue, 6 Aug 2024 06:52:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CACB73857000 for ; Mon, 5 Aug 2024 20:52:43 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 948073858294 for ; Mon, 5 Aug 2024 20:49:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 948073858294 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 948073858294 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890950; cv=none; b=mKjhjUKWVWPN2V/2Wf+iNIymGywX/aqLwv3kBYkeQ2F8ClF7DH3DQEymDvW8vNhGdIKzTg97eGJAI0n+gxCGuLy1DoL9fYni8YnWYFA4bCDIikNtmAIJcKF0qqFrkfJwoEo1J2EE3/CtiEb84Iy+/Pir9rNLy2qIrMC850qkHe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890950; c=relaxed/simple; bh=bJlJUlytqocYD59R8/azpnS3HqnC/ILkMDl3NUNhOw4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=f1SkhNGj6vUzlFGHijMX3kmXAQfexj3k5FxMwWfJBQGPn+PKbl67a5n3jvP+3KgqfnRpYx3cy2KfawcnXd34Znqhsyvcv16VUGmg+foqwyyOU3ke1BBLL/qSQf4w21h4d+IlP1I6Crdov3ccMw5++6xgj6DziO9c+43DN9+ihME= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890948; bh=bJlJUlytqocYD59R8/azpnS3HqnC/ILkMDl3NUNhOw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rY02gPpdKRDDOIh38V5KOW5JjUTPWCIoNdXTLwp4Y4xYqNXG8t+EsYJRscKwZF8RK rDPvfIT9mH7fRa13bm250dCQX61kbfVAyL3yLHsM9Kke+0q8fiEyYsQQVfELnCwpdK Xj6DSyAbj/R33qPS9uXWjoETWK8LZCf7FXywRY9GLlN/4fure2rzufKiXvoPBfVJKr Zn9bV+jxRvnyTQhNptQk0I5MXvicmm/ZxPRbusX3PmR0iUW62RgkN1he4c/p+NrZWM OUgY4/5QpoqioD8+js05e/N1klciFf67hRzKinzktLm4j0TiREWAKgc4ie72XfeI2m 6leTJGCWMhmVg== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pD1Zjbz1FpS; Mon, 5 Aug 2024 16:49:08 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 11/17] nptl: Add for hppa Date: Mon, 5 Aug 2024 16:48:33 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-11-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/hppa/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/hppa/nptl/thread_pointer.h b/sysdeps/hppa/nptl/thread_pointer.h new file mode 100644 index 0000000000..93380f3e52 --- /dev/null +++ b/sysdeps/hppa/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. hppa version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("cr27"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=qXmUY20v; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7sN74c4z1ybS for ; Tue, 6 Aug 2024 06:51:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D393B3860745 for ; Mon, 5 Aug 2024 20:51:50 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id 8F19B385C6D3 for ; Mon, 5 Aug 2024 20:49:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F19B385C6D3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F19B385C6D3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890951; cv=none; b=GNZUjbvpL/j1ALWNBWdsb0oc46bYJdwBG700VWcctKgbDJS6AZujXSNBQp4MEiNOFP2MV9Bg0+5//Szj8vRbIjEAgYhwQeS8oMut7MVqZTbNAZP31eKxHJ5ZC6TiSDiWpgmDGWFYP1j2WjmvrC7ERdjYWr0RFZeoEoQTM0B9848= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890951; c=relaxed/simple; bh=WIL/OWLKux8StVDM3cnFmF+xbdRRUdWP+o0owx8sma8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=U1F4kKDLIHxQ1qqwA0rtlZTPRBAuqR+FsBGQ/p8c3bhTRc0Fhd3I7mRebJsjRJR4oUjZ9MmW4qtl+lCuMXgqkFQsb+X0/qNnNRJr3v5C3zBxEVoLt4JrjNGBKE9bC87auLeCbYEaOgKFAI9Q6B0OVTolZFg4+AQZMMIE7A+nC9o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890949; bh=WIL/OWLKux8StVDM3cnFmF+xbdRRUdWP+o0owx8sma8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qXmUY20vh1UNpjCtz6wGVEIezx2oYYWZz2Tt1jAzUl1qjE5xXPryBIUnxUUgXsArO yO3e9JnrG0ZLAPd344nQbAuty9/90ixGbbQf/pMrUBgl3oX2EhQKsT5/tCzWwpwUsj +jzu+NwJU0x594+dci5n5HPYwlJL/wXLJ9AYzYor2tgfVX9YfB+92xrYnEr0uRTiHk d7xTp09jvly/IsC7kE1mCkvjXe4aEFh9Vhz5xtUKzWM4TVPnOfpaVPOmj34oM5lC2x +GKSn+tii0Ru7WZgLWgBWlxiJeJHcyPtqH5DrUULuc1NENz22hdd1VvIkwzifZeNbJ dK55unKv5lisg== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pF1STdz1FpT; Mon, 5 Aug 2024 16:49:09 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 12/17] nptl: Add for csky Date: Mon, 5 Aug 2024 16:48:34 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-12-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the __rseq_size and __rseq_offset symbols to set the 'cpu_id' field so applications can test if rseq is registered. Signed-off-by: Michael Jeanson --- sysdeps/csky/nptl/thread_pointer.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysdeps/csky/nptl/thread_pointer.h b/sysdeps/csky/nptl/thread_pointer.h new file mode 100644 index 0000000000..d4847f691a --- /dev/null +++ b/sysdeps/csky/nptl/thread_pointer.h @@ -0,0 +1,30 @@ +/* __thread_pointer definition. csky version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +register void *__thread_register asm ("r31"); + +static inline void * +__thread_pointer (void) +{ + return __thread_register; +} + +#endif /* _SYS_THREAD_POINTER_H */ From patchwork Mon Aug 5 20:48:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=Fm7Z1Vhk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7rR0M18z1ybS for ; Tue, 6 Aug 2024 06:51:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 422293858431 for ; Mon, 5 Aug 2024 20:51:01 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 8A7C1385DDE7 for ; Mon, 5 Aug 2024 20:49:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A7C1385DDE7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A7C1385DDE7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890952; cv=none; b=ZOjnE1iA3WicII1mTtQ5n3clbV9xIkRuC7yj1NHpndv3OVHbnwlX/gjL/atu5mtYnRbm/wLpi8BjxENignYwQmOxguwUTb9Sw65ZeNytK1iqaciCBw6c3z30xq0KWuon9JLhvr6EtwdQUfbCWmyakJYLTwQoJcB224XT7vnyygw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890952; c=relaxed/simple; bh=36M3TDuYP6v2jYxKrJK9e8aoGTVsMv5nppmXoUhTmbU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=FlJ2T2EkvS3xfIGx4r256gtLVL7F1DTDZL2/W5E+ngBGXHJkpMUj6NujToRqOYdaSIND/BblLSJTIijsyplqREiiUWlEyohQQIo1rY4xqioTT9DT80JpNtyNN5CSAg2rvvMg8CNshEaBhRftZvR/8DwDnBx/0SN8EPd4SerF5rg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890950; bh=36M3TDuYP6v2jYxKrJK9e8aoGTVsMv5nppmXoUhTmbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fm7Z1VhkP8SiPyqgDfEUhvZ1PHgE8IsaFP3XW+gzq+DjET6/eEy9SPrwQu8jiwp6Q as4e5p+eIvALfOg5pm8JakaiFx/LEhCN4Lxf9wq/Eknyp4J7TzTtAFwmCWYe/hQiNq 6Ulzl0h+XrKOSX0s0I+mEElt9F+I51qrFX0ngMTK66TPVAgHY+NG4DHNi7awnMySFf PKi3voQXihtquvwM0+05nntsknCrZKiVcIKqiuL/lmfw4Jyr7zwjz10J4uooqfHiyE K7rWNW0NlLwZkpEHej7tnzYCx1OHluyYTMZHuEOFGjVNXyq04Ckodf3fNcD3sCwhSa P9fOYN2yFsqBw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pG1HLxz1GhQ; Mon, 5 Aug 2024 16:49:10 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 13/17] nptl: add RSEQ_SIG for RISC-V Date: Mon, 5 Aug 2024 16:48:35 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-13-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Enable RSEQ for RISC-V, support was added in Linux 5.18. Signed-off-by: Michael Jeanson --- sysdeps/unix/sysv/linux/riscv/bits/rseq.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/sysdeps/unix/sysv/linux/riscv/bits/rseq.h b/sysdeps/unix/sysv/linux/riscv/bits/rseq.h new file mode 100644 index 0000000000..dfc1fc9315 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/rseq.h @@ -0,0 +1,44 @@ +/* Restartable Sequences Linux riscv architecture header. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#ifndef _SYS_RSEQ_H +# error "Never use directly; include instead." +#endif + +/* RSEQ_SIG is a signature required before each abort handler code. + + It is a 32-bit value that maps to actual architecture code compiled + into applications and libraries. It needs to be defined for each + architecture. When choosing this value, it needs to be taken into + account that generating invalid instructions may have ill effects on + tools like objdump, and may also have impact on the CPU speculative + execution efficiency in some cases. + + Select the instruction "csrw mhartid, x0" as the RSEQ_SIG. Unlike + other architectures, the ebreak instruction has no immediate field for + distinguishing purposes. Hence, ebreak is not suitable as RSEQ_SIG. + "csrw mhartid, x0" can also satisfy the RSEQ requirement because it + is an uncommon instruction and will raise an illegal instruction + exception when executed in all modes. */ + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define RSEQ_SIG 0xf1401073 +#else +/* RSEQ is currently only supported on Little-Endian. */ +#endif From patchwork Mon Aug 5 20:48:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=PBObKL0J; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7rs5Qg9z1ydt for ; Tue, 6 Aug 2024 06:51:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CD5E385EC54 for ; Mon, 5 Aug 2024 20:51:24 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 7ED3B385C6C3 for ; Mon, 5 Aug 2024 20:49:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7ED3B385C6C3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7ED3B385C6C3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890953; cv=none; b=ELhD3+2VHwOLKkLdxhYK57Al16JumlkjgBZmA455F6n9RJg4NNXQTFc5o82rz2JZD4t0uZw+mrGXZMuVQe6G3arJRyRBRUWVH9bTbcRafuhElmE3QmjmRRPVCRTB+uIqPQN1+PNmmmzcCOUJNBBi+SGAb27QUl0SZKIF4PoM1Hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890953; c=relaxed/simple; bh=9I69ZhxQgSZGk0+qDJvi35BijcyLoLfcB/gboc8B98c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=HFnh1DWwjPa8vnIySf3NTw+Wiekan1wb6huCRpOMgoB+KRkj8dMqaBn8gZskBsZSd296Ge/q5LnmEwsfdk4kqm3+skH2zf6d0AyCuXvuLsVU/WTZ9liSMm+d7EhTRkVXzjdak1pi6nW7NpbCCTYFRGgMa2pAHUdPEU9MDqg38Oo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890951; bh=9I69ZhxQgSZGk0+qDJvi35BijcyLoLfcB/gboc8B98c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBObKL0JNz5AAVb/5blYl3MWlALBQyKlu2l79Uy4Q8vkaNgrnUaZgQMCsba9nX207 8bCsi64+dopeYRs8CLMG1jcxj+T6pQLHKaQq1ZJN4PeXTaNofINaTcmY7GuQMBLwxT hkO+LNXcK+KA923YYYHHBnFGqZ4DM0VEezoydib5hCoJzx4oiEnqjHtrLGAY55NBZt qNjpg8clYwIDBkbU3SIVYLFxUZTdUZQsp2azFSr+EKBtGnnT2K/zFA7gVhafeNpQUr aEv2rBCFMPckur0JyI2mKuOKm+fR5EXn4d6h4tIo4/9q72Fx4dQ4MBT8gTmwVrMrkn 7sNBHCtHEASow== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pH0yTYz1GhR; Mon, 5 Aug 2024 16:49:11 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 14/17] nptl: Introduce RSEQ_GETMEM_VOLATILE and RSEQ_SETMEM Date: Mon, 5 Aug 2024 16:48:36 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-14-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be used to access and write to the rseq area in the extra TLS block. Signed-off-by: Michael Jeanson --- sysdeps/i386/nptl/tcb-access.h | 61 ++++++++++++++++++++++++++++++++++++++++ sysdeps/nptl/tcb-access.h | 5 ++++ sysdeps/x86_64/nptl/tcb-access.h | 61 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) diff --git a/sysdeps/i386/nptl/tcb-access.h b/sysdeps/i386/nptl/tcb-access.h index 4b6221e103..eb40906c48 100644 --- a/sysdeps/i386/nptl/tcb-access.h +++ b/sysdeps/i386/nptl/tcb-access.h @@ -123,3 +123,64 @@ "i" (offsetof (struct pthread, member)), \ "r" (idx)); \ }}) + + +#if IS_IN (rtld) +/* Use the hidden symbol in ld.so. */ +# define rseq_offset_sym _rseq_offset +#else +# define rseq_offset_sym __rseq_offset +#endif + +/* Read member of the RSEQ area directly. */ +#define RSEQ_GETMEM_VOLATILE(descr, member) \ + ({ __typeof (descr->member) __value; \ + _Static_assert (sizeof (__value) == 1 \ + || sizeof (__value) == 4 \ + || sizeof (__value) == 8, \ + "size of per-thread data"); \ + if (sizeof (__value) == 1) \ + asm volatile ("movb %%gs:%P2(%3),%b0" \ + : "=q" (__value) \ + : "0" (0), "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else if (sizeof (__value) == 4) \ + asm volatile ("movl %%gs:%P1(%2),%0" \ + : "=r" (__value) \ + : "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else /* 8 */ \ + { \ + asm volatile ("movl %%gs:%P1(%2),%%eax\n\t" \ + "movl %%gs:4+%P1(%2),%%edx" \ + : "=&A" (__value) \ + : "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + } \ + __value; }) + +/* Set member of the RSEQ area directly. */ +#define RSEQ_SETMEM(descr, member, value) \ + ({ \ + _Static_assert (sizeof (descr->member) == 1 \ + || sizeof (descr->member) == 4 \ + || sizeof (descr->member) == 8, \ + "size of per-thread data"); \ + if (sizeof (descr->member) == 1) \ + asm volatile ("movb %b0,%%gs:%P1(%2)" : \ + : "iq" (value), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else if (sizeof (descr->member) == 4) \ + asm volatile ("movl %0,%%gs:%P1(%2)" : \ + : "ir" (value), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else /* 8 */ \ + { \ + asm volatile ("movl %%eax,%%gs:%P1(%2)\n\t" \ + "movl %%edx,%%gs:4+%P1(%2)" : \ + : "A" ((uint64_t) cast_to_integer (value)), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + }}) diff --git a/sysdeps/nptl/tcb-access.h b/sysdeps/nptl/tcb-access.h index 600433766f..9532f30022 100644 --- a/sysdeps/nptl/tcb-access.h +++ b/sysdeps/nptl/tcb-access.h @@ -30,3 +30,8 @@ descr->member = (value) #define THREAD_SETMEM_NC(descr, member, idx, value) \ descr->member[idx] = (value) + +#define RSEQ_GETMEM_VOLATILE(descr, member) \ + THREAD_GETMEM_VOLATILE(descr, member) +#define RSEQ_SETMEM(descr, member, value) \ + THREAD_SETMEM(descr, member, value) diff --git a/sysdeps/x86_64/nptl/tcb-access.h b/sysdeps/x86_64/nptl/tcb-access.h index d35948f111..2edead755e 100644 --- a/sysdeps/x86_64/nptl/tcb-access.h +++ b/sysdeps/x86_64/nptl/tcb-access.h @@ -130,3 +130,64 @@ "i" (offsetof (struct pthread, member[0])), \ "r" (idx)); \ }}) + +#if IS_IN (rtld) +/* Use the hidden symbol in ld.so. */ +# define rseq_offset_sym _rseq_offset +#else +# define rseq_offset_sym __rseq_offset +#endif + +/* Read member of the RSEQ area directly. */ +# define RSEQ_GETMEM_VOLATILE(descr, member) \ + ({ __typeof (descr->member) __value; \ + _Static_assert (sizeof (__value) == 1 \ + || sizeof (__value) == 4 \ + || sizeof (__value) == 8, \ + "size of per-thread data"); \ + if (sizeof (__value) == 1) \ + asm volatile ("movb %%fs:%P2(%q3),%b0" \ + : "=q" (__value) \ + : "0" (0), "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else if (sizeof (__value) == 4) \ + asm volatile ("movl %%fs:%P1(%q2),%0" \ + : "=r" (__value) \ + : "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else /* 8 */ \ + { \ + asm volatile ("movq %%fs:%P1(%q2),%q0" \ + : "=r" (__value) \ + : "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + } \ + __value; }) + +/* Set member of the RSEQ area directly. */ +# define RSEQ_SETMEM(descr, member, value) \ + ({ \ + _Static_assert (sizeof (descr->member) == 1 \ + || sizeof (descr->member) == 4 \ + || sizeof (descr->member) == 8, \ + "size of per-thread data"); \ + if (sizeof (descr->member) == 1) \ + asm volatile ("movb %b0,%%fs:%P1(%q2)" : \ + : "iq" (value), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else if (sizeof (descr->member) == 4) \ + asm volatile ("movl %0,%%fs:%P1(%q2)" : \ + : IMM_MODE (value), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + else /* 8 */ \ + { \ + /* Since movq takes a signed 32-bit immediate or a register source \ + operand, use "er" constraint for 32-bit signed integer constant \ + or register. */ \ + asm volatile ("movq %q0,%%fs:%P1(%q2)" : \ + : "er" ((uint64_t) cast_to_integer (value)), \ + "i" (offsetof (struct rseq_area, member)), \ + "r" (rseq_offset_sym)); \ + }}) From patchwork Mon Aug 5 20:48:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=ckukTayZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7rs4gsNz1ybS for ; Tue, 6 Aug 2024 06:51:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78000385E44D for ; Mon, 5 Aug 2024 20:51:23 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 74A36385DDC4 for ; Mon, 5 Aug 2024 20:49:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74A36385DDC4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74A36385DDC4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; cv=none; b=RxL6QRg6v6pktYKL0KkCOxf4Yz1Mu8A1difiZ9eClVU50bBVcwKoidsTZb5uVh57IESyGvjpd9nuIxNznCdDCUqKsZU8DzEov6f+DC1d/G7iYOudvAXYxRvb3Cul/BhvrFUpQSqATmdwO4Dt5HwrhYFQjm/NSFk+pL8Q01ee1UU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; c=relaxed/simple; bh=KlKVzC1C31F43VHnQejgqUpD/xrjaAp6//bIXkD5cW8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RmAoaJPVsgRmRA+rEvvTW96HBChUq8kjKNTCtP45Xa26ndHVimMe1dX43hpQbwtXF/j3StRG/Cu8KqNqByDPftxJxkXJqThOQNUl6XJcf7pI5SD9icIwUFcUhiJRbNkR+TETibR8VFgxxcxEcEN51SYx4BH2/zQFyeAuZUCm9mw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890952; bh=KlKVzC1C31F43VHnQejgqUpD/xrjaAp6//bIXkD5cW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckukTayZ8cLB3+tR/3Cbu9mjSDRKN1+N5GuNddIIIMF/+44zULDOko7EZVewQaWFx 6WN9sHrK8xEIK23QbMXQTndiAHVLIeWoBucgjP1xZl0gzaWotXcuvmO1Z7ciADDEqY Wku7cGfVpMkkrufHKVP/tZwRJgawNExuBN2J/Wju+CM1zghoIyd2kE3IPmGw0Y1OBk ZWbVvdQRPrSMaTeg11iuTuXXiSER5kZbRHLekYFttIhoyICRlnKA8YUtJ58Udqhm4Z Ffkr8wejhCxCUQ8r8quP00TU2l3TuVU6QnzdH76boVCWWpfxxHis41n4Wkl3+cwioi GSffS79hzdvAQ== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pJ0VHZz1GhS; Mon, 5 Aug 2024 16:49:12 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 15/17] nptl: Move the rseq area to the 'extra TLS' block Date: Mon, 5 Aug 2024 16:48:37 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-15-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Move the rseq area to the newly added 'extra TLS' block, this is the last step in adding support for the rseq extended ABI. The size of the rseq area is now dynamic and depends on the rseq features reported by the kernel through the elf auxiliary vector. This will allow applications to use rseq features past the 32 bytes of the original rseq ABI as they become available in future kernels. Signed-off-by: Michael Jeanson --- Changes since v11: - __rseq_size is now set directly in _dl_parse_auxv, set it to 0 when the main thread registration fails or is disabled by tunable --- nptl/pthread_create.c | 2 +- sysdeps/nptl/dl-tls_init_tp.c | 20 +++--- sysdeps/unix/sysv/linux/Makefile | 10 +++ sysdeps/unix/sysv/linux/rseq-internal.h | 64 ++++++++++++++++-- sysdeps/unix/sysv/linux/sched_getcpu.c | 3 +- sysdeps/unix/sysv/linux/tst-rseq-disable-static.c | 1 + sysdeps/unix/sysv/linux/tst-rseq-disable.c | 60 ++++++++++++++--- sysdeps/unix/sysv/linux/tst-rseq-nptl-static.c | 1 + sysdeps/unix/sysv/linux/tst-rseq-static.c | 1 + sysdeps/unix/sysv/linux/tst-rseq.c | 81 ++++++++++++++++++----- sysdeps/unix/sysv/linux/tst-rseq.h | 7 +- 11 files changed, 205 insertions(+), 45 deletions(-) diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 1d3665d5ed..9b49ee7121 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -691,7 +691,7 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, /* Inherit rseq registration state. Without seccomp filters, rseq registration will either always fail or always succeed. */ - if ((int) THREAD_GETMEM_VOLATILE (self, rseq_area.cpu_id) >= 0) + if ((int) RSEQ_GETMEM_VOLATILE (rseq_get_area(), cpu_id) >= 0) pd->flags |= ATTR_FLAG_DO_RSEQ; /* Initialize the field for the ID of the thread which is waiting diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index b2abb2762d..46dc666cbc 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -101,19 +101,17 @@ __tls_init_tp (void) } { + /* If the registration fails or is disabled by tunable, the public + '__rseq_size' will be set '0' regardless of the feature size of the + allocated rseq area. An rseq area of at least 32 bytes is always + allocated since application code is allowed to test the status of the + rseq registration with 'rseq->cpu_id >= 0'. */ bool do_rseq = true; do_rseq = TUNABLE_GET (rseq, int, NULL); - if (rseq_register_current_thread (pd, do_rseq)) - _rseq_size = RSEQ_AREA_SIZE_INITIAL_USED; - -#ifdef RSEQ_SIG - /* This should be a compile-time constant, but the current - infrastructure makes it difficult to determine its value. Not - all targets support __thread_pointer, so set __rseq_offset only - if the rseq registration may have happened because RSEQ_SIG is - defined. */ - _rseq_offset = (char *) &pd->rseq_area - (char *) __thread_pointer (); -#endif + if (!rseq_register_current_thread (pd, do_rseq)) + { + _rseq_size = 0; + } } /* Set initial thread's stack block from 0 up to __libc_stack_end. diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 59998c7af4..a6c142d363 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -263,6 +263,11 @@ tests-internal += \ tst-rseq-disable \ # tests-internal +tests-static += \ + tst-rseq-disable-static \ + tst-rseq-static \ + # tests-static + tests-time64 += \ tst-adjtimex-time64 \ tst-clock_adjtime-time64 \ @@ -396,6 +401,7 @@ $(objpfx)tst-mount-compile.out: ../sysdeps/unix/sysv/linux/tst-mount-compile.py $(objpfx)tst-mount-compile.out: $(sysdeps-linux-python-deps) tst-rseq-disable-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0 +tst-rseq-disable-static-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0 endif # $(subdir) == misc @@ -661,4 +667,8 @@ tests += \ tests-internal += \ tst-rseq-nptl \ # tests-internal + +tests-static += \ + tst-rseq-nptl-static \ + # tests-static endif diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 2aae447b60..d26d69fd6a 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -24,6 +24,26 @@ #include #include #include +#include +#include + +/* rseq area registered with the kernel. Use a custom definition here to + isolate from the system provided header which could lack some fields of the + Extended ABI. + + Access to fields of the Extended ABI beyond the 20 bytes of the original ABI + (after 'flags') must be gated by a check of the feature size. */ +struct rseq_area +{ + /* Original ABI. */ + uint32_t cpu_id_start; + uint32_t cpu_id; + uint64_t rseq_cs; + uint32_t flags; + /* Extended ABI. */ + uint32_t node_id; + uint32_t mm_cid; +}; /* Minimum size of the rseq area allocation required by the syscall. The actually used rseq feature size may be less (20 bytes initially). */ @@ -41,10 +61,27 @@ extern size_t _rseq_align attribute_hidden; /* Size of the active features in the rseq area. Populated from the auxiliary vector with a minimum of '20'. + Set to '0' on registration failure of the main thread. In .data.relro but not yet write-protected. */ extern unsigned int _rseq_size attribute_hidden; + +/* Offset from the thread pointer to the rseq area, always set to allow + checking the registration status by reading the 'cpu_id' field. + In .data.relro but not yet write-protected. */ extern ptrdiff_t _rseq_offset attribute_hidden; +/* Returns a pointer to the current thread rseq area. */ +static inline struct rseq_area * +rseq_get_area(void) +{ +#if IS_IN (rtld) + /* Use the hidden symbol in ld.so. */ + return (struct rseq_area *) ((char *) __thread_pointer() + _rseq_offset); +#else + return (struct rseq_area *) ((char *) __thread_pointer() + __rseq_offset); +#endif +} + #ifdef RSEQ_SIG static inline bool rseq_register_current_thread (struct pthread *self, bool do_rseq) @@ -52,29 +89,44 @@ rseq_register_current_thread (struct pthread *self, bool do_rseq) if (do_rseq) { unsigned int size; + + /* Get the feature size from the auxiliary vector, this will always be at + least 20 bytes. */ #if IS_IN (rtld) /* Use the hidden symbol in ld.so. */ size = _rseq_size; #else size = __rseq_size; #endif + + /* The feature size can be smaller than the minimum rseq area size of 32 + bytes accepted by the syscall, if this is the case, bump the size of + the registration to the minimum. The 'extra TLS' block is always at + least 32 bytes. */ if (size < RSEQ_AREA_SIZE_INITIAL) - /* The initial implementation used only 20 bytes out of 32, - but still expected size 32. */ size = RSEQ_AREA_SIZE_INITIAL; - int ret = INTERNAL_SYSCALL_CALL (rseq, &self->rseq_area, - size, 0, RSEQ_SIG); + + /* The kernel expects 'rseq_area->rseq_cs == NULL' on registration, zero + the whole rseq area. */ + memset(rseq_get_area(), 0, size); + + int ret = INTERNAL_SYSCALL_CALL (rseq, rseq_get_area(), size, 0, + RSEQ_SIG); if (!INTERNAL_SYSCALL_ERROR_P (ret)) return true; } - THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); + + /* If the registration failed or is disabled by tunable, we have to set 'cpu_id' to + RSEQ_CPU_ID_REGISTRATION_FAILED to allow userspace to properly test the + status of the registration. */ + RSEQ_SETMEM (rseq_get_area(), cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); return false; } #else /* RSEQ_SIG */ static inline bool rseq_register_current_thread (struct pthread *self, bool do_rseq) { - THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); + RSEQ_SETMEM (rseq_get_area(), cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); return false; } #endif /* RSEQ_SIG */ diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c index 72a3360550..3cdf854316 100644 --- a/sysdeps/unix/sysv/linux/sched_getcpu.c +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c @@ -19,6 +19,7 @@ #include #include #include +#include static int vsyscall_sched_getcpu (void) @@ -36,6 +37,6 @@ vsyscall_sched_getcpu (void) int sched_getcpu (void) { - int cpu_id = THREAD_GETMEM_VOLATILE (THREAD_SELF, rseq_area.cpu_id); + int cpu_id = RSEQ_GETMEM_VOLATILE (rseq_get_area(), cpu_id); return __glibc_likely (cpu_id >= 0) ? cpu_id : vsyscall_sched_getcpu (); } diff --git a/sysdeps/unix/sysv/linux/tst-rseq-disable-static.c b/sysdeps/unix/sysv/linux/tst-rseq-disable-static.c new file mode 100644 index 0000000000..2687d13d3d --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-rseq-disable-static.c @@ -0,0 +1 @@ +#include "tst-rseq-disable.c" diff --git a/sysdeps/unix/sysv/linux/tst-rseq-disable.c b/sysdeps/unix/sysv/linux/tst-rseq-disable.c index bbc655bec4..b1f4e894f1 100644 --- a/sysdeps/unix/sysv/linux/tst-rseq-disable.c +++ b/sysdeps/unix/sysv/linux/tst-rseq-disable.c @@ -26,32 +26,65 @@ #include #ifdef RSEQ_SIG +# include +# include "tst-rseq.h" + +static __thread struct rseq local_rseq = { + .cpu_id = RSEQ_CPU_ID_REGISTRATION_FAILED, +}; /* Check that rseq can be registered and has not been taken by glibc. */ static void check_rseq_disabled (void) { - struct pthread *pd = THREAD_SELF; + struct rseq *rseq_area = (struct rseq *) ((char *) __thread_pointer () + __rseq_offset); + +#if TLS_TCB_AT_TP + /* The rseq area block should come before the thread pointer and be at least 32 bytes. */ + TEST_VERIFY (__rseq_offset <= RSEQ_TEST_MIN_SIZE); +#elif TLS_DTV_AT_TP + /* The rseq area block should come after the thread pointer. */ + TEST_VERIFY (__rseq_offset >= 0); +#else +# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" +#endif + /* __rseq_flags is unused and should always be '0'. */ TEST_COMPARE (__rseq_flags, 0); - TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset - == (char *) &pd->rseq_area); + + /* When rseq is not registered, __rseq_size should always be '0'. */ TEST_COMPARE (__rseq_size, 0); - TEST_COMPARE ((int) pd->rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); - int ret = syscall (__NR_rseq, &pd->rseq_area, sizeof (pd->rseq_area), - 0, RSEQ_SIG); + /* When rseq is not registered, the 'cpu_id' field should be set to + RSEQ_CPU_ID_REGISTRATION_FAILED. */ + TEST_COMPARE ((int) rseq_area->cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); + + /* Test a rseq registration which should succeed since the internal + registration is disabled. */ + int ret = syscall (__NR_rseq, &local_rseq, RSEQ_TEST_MIN_SIZE, 0, RSEQ_SIG); if (ret == 0) { - ret = syscall (__NR_rseq, &pd->rseq_area, sizeof (pd->rseq_area), + /* A successful registration should set the cpu id. */ + TEST_VERIFY (local_rseq.cpu_id >= 0); + + /* Test we can also unregister rseq. */ + ret = syscall (__NR_rseq, &local_rseq, RSEQ_TEST_MIN_SIZE, RSEQ_FLAG_UNREGISTER, RSEQ_SIG); TEST_COMPARE (ret, 0); - pd->rseq_area.cpu_id = RSEQ_CPU_ID_REGISTRATION_FAILED; } else { - TEST_VERIFY (errno != -EINVAL); - TEST_VERIFY (errno != -EBUSY); + /* Check if we failed with EINVAL which would mean an invalid rseq flags, + a mis-aligned rseq area address or an incorrect rseq size. */ + TEST_VERIFY (errno != EINVAL); + + /* Check if we failed with EBUSY which means an existing rseq + registration. */ + TEST_VERIFY (errno != EBUSY); + + /* Check if we failed with EFAULT which means an invalid rseq area + address. */ + TEST_VERIFY (errno != EFAULT); } } @@ -71,6 +104,13 @@ proc_func (void *ignored) static int do_test (void) { + printf ("info: __rseq_size: %u\n", __rseq_size); + printf ("info: __rseq_offset: %td\n", __rseq_offset); + printf ("info: __rseq_flags: %u\n", __rseq_flags); + printf ("info: getauxval (AT_RSEQ_FEATURE_SIZE): %ld\n", + getauxval (AT_RSEQ_FEATURE_SIZE)); + printf ("info: getauxval (AT_RSEQ_ALIGN): %ld\n", getauxval (AT_RSEQ_ALIGN)); + puts ("info: checking main thread"); check_rseq_disabled (); diff --git a/sysdeps/unix/sysv/linux/tst-rseq-nptl-static.c b/sysdeps/unix/sysv/linux/tst-rseq-nptl-static.c new file mode 100644 index 0000000000..6e2c923bb9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-rseq-nptl-static.c @@ -0,0 +1 @@ +#include "tst-rseq-nptl.c" diff --git a/sysdeps/unix/sysv/linux/tst-rseq-static.c b/sysdeps/unix/sysv/linux/tst-rseq-static.c new file mode 100644 index 0000000000..1d97f3bd3d --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-rseq-static.c @@ -0,0 +1 @@ +#include "tst-rseq.c" diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c index 08a9533130..802672e840 100644 --- a/sysdeps/unix/sysv/linux/tst-rseq.c +++ b/sysdeps/unix/sysv/linux/tst-rseq.c @@ -19,6 +19,8 @@ not linked against libpthread. */ #include +#include +#include #include #include #include @@ -32,23 +34,66 @@ # include # include # include +# include # include "tst-rseq.h" static void do_rseq_main_test (void) { - struct pthread *pd = THREAD_SELF; + size_t rseq_align = MAX (getauxval (AT_RSEQ_ALIGN), RSEQ_TEST_MIN_ALIGN); + size_t rseq_feature_size = MAX (getauxval (AT_RSEQ_FEATURE_SIZE), RSEQ_TEST_MIN_FEATURE_SIZE); + size_t rseq_alloc_size = roundup (MAX (rseq_feature_size, RSEQ_TEST_MIN_SIZE), rseq_align); + struct rseq *global_rseq = __thread_pointer () + __rseq_offset; TEST_VERIFY_EXIT (rseq_thread_registered ()); + + /* __rseq_flags is unused and should always be '0'. */ TEST_COMPARE (__rseq_flags, 0); - TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset - == (char *) &pd->rseq_area); - /* The current implementation only supports the initial size. */ - TEST_COMPARE (__rseq_size, 20); + + /* When rseq is registered, __rseq_size should report the feature size. */ + TEST_COMPARE (__rseq_size, rseq_feature_size); + + /* When rseq is registered, the 'cpu_id' field should be set to a valid cpu + * number. */ + TEST_VERIFY ((int32_t) global_rseq->cpu_id >= 0); + + /* The rseq area address must be aligned. */ + TEST_VERIFY (((unsigned long) global_rseq % rseq_align) == 0); + +#if TLS_TCB_AT_TP + /* The rseq area block should come before the thread pointer and be at least 32 bytes. */ + TEST_VERIFY (__rseq_offset <= RSEQ_TEST_MIN_SIZE); +#elif TLS_DTV_AT_TP + /* The rseq area block should come after the thread pointer. */ + TEST_VERIFY (__rseq_offset >= 0); +#else +# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" +#endif + + /* Test a rseq registration with the same arguments as the internal + registration which should fail with errno == EBUSY. */ + TEST_VERIFY (((unsigned long) global_rseq % rseq_align) == 0); + TEST_VERIFY (__rseq_size <= rseq_alloc_size); + int ret = syscall (__NR_rseq, global_rseq, rseq_alloc_size, 0, RSEQ_SIG); + TEST_VERIFY (ret != 0); + TEST_COMPARE (errno, EBUSY); +} + +static void * +thread_func (void *ignored) +{ + do_rseq_main_test (); + return NULL; } static void -do_rseq_test (void) +proc_func (void *ignored) +{ + do_rseq_main_test (); +} + +static int +do_test (void) { if (!rseq_available ()) { @@ -60,21 +105,27 @@ do_rseq_test (void) printf ("info: getauxval (AT_RSEQ_FEATURE_SIZE): %ld\n", getauxval (AT_RSEQ_FEATURE_SIZE)); printf ("info: getauxval (AT_RSEQ_ALIGN): %ld\n", getauxval (AT_RSEQ_ALIGN)); + + puts ("info: checking main thread"); + do_rseq_main_test (); + + puts ("info: checking main thread (2)"); do_rseq_main_test (); + + puts ("info: checking new thread"); + xpthread_join (xpthread_create (NULL, thread_func, NULL)); + + puts ("info: checking subprocess"); + support_isolate_in_subprocess (proc_func, NULL); + + return 0; } #else /* RSEQ_SIG */ -static void -do_rseq_test (void) -{ - FAIL_UNSUPPORTED ("glibc does not define RSEQ_SIG, skipping test"); -} -#endif /* RSEQ_SIG */ - static int do_test (void) { - do_rseq_test (); - return 0; + FAIL_UNSUPPORTED ("glibc does not define RSEQ_SIG, skipping test"); } +#endif /* RSEQ_SIG */ #include diff --git a/sysdeps/unix/sysv/linux/tst-rseq.h b/sysdeps/unix/sysv/linux/tst-rseq.h index dc603327d3..7a2e19b07f 100644 --- a/sysdeps/unix/sysv/linux/tst-rseq.h +++ b/sysdeps/unix/sysv/linux/tst-rseq.h @@ -23,11 +23,16 @@ #include #include #include +#include + +#define RSEQ_TEST_MIN_SIZE 32 +#define RSEQ_TEST_MIN_FEATURE_SIZE 20 +#define RSEQ_TEST_MIN_ALIGN 32 static inline bool rseq_thread_registered (void) { - return THREAD_GETMEM_VOLATILE (THREAD_SELF, rseq_area.cpu_id) >= 0; + return RSEQ_GETMEM_VOLATILE (rseq_get_area(), cpu_id) >= 0; } static inline int From patchwork Mon Aug 5 20:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=cua8WlZF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7vG1C7hz1ybS for ; Tue, 6 Aug 2024 06:53:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 091F4385842D for ; Mon, 5 Aug 2024 20:53:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [IPv6:2607:5300:203:b2ee::31e5]) by sourceware.org (Postfix) with ESMTPS id 620DE385E838 for ; Mon, 5 Aug 2024 20:49:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 620DE385E838 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 620DE385E838 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:5300:203:b2ee::31e5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; cv=none; b=fzyMCyDkuYDINSvXDfgHF5SQvC/p6x3W8gOtvtzg3ilGs/fd7iQY2dnrB5SEg/h/mXB9IIpT9VXhrmXq6KzJkhf/FUgbI1g7CpbK7BQbZkgBH62BYfClkUZW3VDNMyG38+gelb8026Mu+N8F2XYE55uNJpuWbJK4TGroqCxY2eg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; c=relaxed/simple; bh=DjBqEzzWXoZiEY07GyKMKFy+4DEzwA5wL5sw5FD24mw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=a3MXNLVQo4X5KjFDh8vOjCAQfsbn9W+HTEsSPCaz33HVm0HwIi1vFsRcDFa25YtTyJ68M+79ypZIrCZFTlEnGM65U4CEvnfpUNFsYabvUpeJOt1BXR4xJVsWjVjiddhL+vyd7qRSq8saysfjTtvgdyZqkhsEilfu4ti3ROJqhAM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890953; bh=DjBqEzzWXoZiEY07GyKMKFy+4DEzwA5wL5sw5FD24mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cua8WlZFslOfKbR3JWpikm+YPWb1qRyZqi8eh2E6nzOdXWG+oW5vNPqJi2GguvObf sPyutOq3xWM3YdfSe8WR5MrpSfwpDeKTx+3qCdITc8FXHevbGBNdvnKruxuIKSGHhX AFzHcYz5Hvg1k/COFVynYZvptpQjZtfiPXPk3k+pk2nwS+R2DOcDVOYpPJ7GRWoI1J 7XE27fSQcycclXZXTYhbjivYFOIsbr+yK6mZbEwpdA06TBy4q2l63RwZjy+mT8dhUT U4Nty1bZQakZ/Rm1vtxh3j5lFOl2MIDqSRankQW7/Hgo/9zdRXC/cke0u8sFJfeznI 1y9HE3/iJiKHw== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pK07Ddz1Fy9; Mon, 5 Aug 2024 16:49:13 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 16/17] nptl: Remove the rseq area from 'struct pthread' Date: Mon, 5 Aug 2024 16:48:38 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-16-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org The rseq extensible ABI implementation moved the rseq area to the 'extra TLS' block, remove the unused 'rseq_area' member of 'struct pthread'. Signed-off-by: Michael Jeanson --- nptl/descr.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/nptl/descr.h b/nptl/descr.h index 8cef95810c..cdc3c82d9a 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -404,25 +404,11 @@ struct pthread /* Used on strsignal. */ struct tls_internal_t tls_state; - /* 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; - the other fields are unused and not included here. */ - union - { - struct - { - uint32_t cpu_id_start; - uint32_t cpu_id; - }; - char pad[32]; /* Original rseq area size. */ - } rseq_area __attribute__ ((aligned (32))); - /* Amount of end padding, if any, in this structure. - This definition relies on rseq_area being last. */ + This definition relies on tls_state being last. */ #define PTHREAD_STRUCT_END_PADDING \ - (sizeof (struct pthread) - offsetof (struct pthread, rseq_area) \ - + sizeof ((struct pthread) {}.rseq_area)) + (sizeof (struct pthread) - offsetof (struct pthread, tls_state) \ + + sizeof ((struct pthread) {}.tls_state)) } __attribute ((aligned (TCB_ALIGNMENT))); static inline bool From patchwork Mon Aug 5 20:48:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1969213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=UNc7pvFL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd7vz62rmz1ybS for ; Tue, 6 Aug 2024 06:54:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACF9D385C6C6 for ; Mon, 5 Aug 2024 20:54:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id 55CF7385DC1E for ; Mon, 5 Aug 2024 20:49:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55CF7385DC1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 55CF7385DC1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; cv=none; b=GblagDY21aBcEukTjItHayOCnjzY53ixeq2BsOJTOj0VHDmoAhpVWK5inWWddT6+O30ZqcAlzZ1v8i0RcqLGcfMtqoo9WobNOjBIandG0nVt3bw9M180uZNkvCeUHDFyOG+AOtI+ZTlg8IooJ14n4+MELq5D8jKGyAbQtc/f88o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722890955; c=relaxed/simple; bh=qPsYBnF32gRLZzsnFN7VpeHAfF6ekNMvuLkqY2e8DcU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=LEzIha2HOD9acWliFKvAUwhITmLi9o7gxHDHVr8+2I3MkSwJw1K46/E5GXDFIpQupzn5QxZp81SaABeZTAQCKgOJyx3LQcmU9vdY38pRJhztNmpU6z4kFVuo6+iT58TCb035ZqNtUY0saYy3IFQ3w37Xd/Jj3za9DmuiFTKjx30= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1722890954; bh=qPsYBnF32gRLZzsnFN7VpeHAfF6ekNMvuLkqY2e8DcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UNc7pvFL9Xxva1uAbUAQzSNOJZ+sUAlsUAO3gEhuYXrQUwLSqYodWM3zrv/bLRHv1 hZkE3GKApzAOYjZ4k+y6xyVyRheSO66pNflUTqt3oN6mv8pLSVZCv0j+i3s1PdX/du wlkgXpMjbYsd9GNE2S7NKUvZOUyDreyXXN1Ja1DJfUdg3MXgq42FWQUOC13phxbVhZ M4jkZhByr2BhquM4UZYt6tIzjqa7sl8MffM7N0GYEqV5wNBiBHwo482sn2/ZwhYfHU 8w30MORHRqLS3bhmf8QqT/rpGGTlWin2bSnVQgpOD0TWUomXPW2+zhx5b/osgjhEON EZtsYaklrqf8w== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Wd7pK6hDrz1GhT; Mon, 5 Aug 2024 16:49:13 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Carlos O'Donell , DJ Delorie , Mathieu Desnoyers Subject: [PATCH v12 17/17] Linux: Update internal copy of '' Date: Mon, 5 Aug 2024 16:48:39 -0400 Message-Id: <20240801-rseq-abi-v11-split-v12-17-0e87479dddc0@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> References: <20240801-rseq-abi-v11-split-v12-0-0e87479dddc0@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Sync the internal copy of '' with the latest Linux kernel 'include/uapi/linux/rseq.h'. Signed-off-by: Michael Jeanson --- sysdeps/unix/sysv/linux/sys/rseq.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sysdeps/unix/sysv/linux/sys/rseq.h b/sysdeps/unix/sysv/linux/sys/rseq.h index b8afab8945..7f0c27fc42 100644 --- a/sysdeps/unix/sysv/linux/sys/rseq.h +++ b/sysdeps/unix/sysv/linux/sys/rseq.h @@ -152,6 +152,17 @@ struct rseq Inhibit instruction sequence block restart on migration for this thread. */ uint32_t flags; + /* Restartable sequences node_id field. Updated by the kernel. Read by + user-space with single-copy atomicity semantics. This field should only + be read by the thread which registered this data structure. Aligned on + 32-bit. Contains the current NUMA node ID. */ + uint32_t node_id; + /* Restartable sequences mm_cid field. Updated by the kernel. Read by + user-space with single-copy atomicity semantics. This field should only + be read by the thread which registered this data structure. Aligned on + 32-bit. Contains the current thread's concurrency ID (allocated + uniquely within a memory map). */ + uint32_t mm_cid; } __attribute__ ((__aligned__ (32))); #endif /* __GLIBC_HAVE_KERNEL_RSEQ */