From nobody Fri Apr 29 20:55:13 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D4B251994FF4; Fri, 29 Apr 2022 20:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kql9t0gvDz3F6T; Fri, 29 Apr 2022 20:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651265714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+ssX2I81jbHRIU5bdY/Yvbd4e2DbuQg8qA0In4oykgQ=; b=RALdEMSIqjs3QVvMsqO8XyqU/IOzupZed2JiMNO3zlMHRjdDJcMdBAYGn8ktZPTC5ww75U aKtJWTMONfEyWzCk/7ukDweKAGVYnHYS/wtIdPKdBM7oceUsTOL7XEz/xNVxYbNNSr2PM2 EcIlFIf5S4jJpzJ9uOfoRSgHq1XkSgFmFgywdAcZHKfIoM+v9+5Vw9v4MJlap/1ytwDv+o eFxZy8q7cBmx2raA4ARmWwVP8H47q0CK8eckiH1qovk5W8mALlQlFVmgdQIjbnAtLaap8Q OaPNfjHTbOJAvSEEe40i0pGBzpp+UBnsfNOxUCAe+a+i3kINUaT3dLmAFdjHpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A86A51428C; Fri, 29 Apr 2022 20:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23TKtDtl055362; Fri, 29 Apr 2022 20:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23TKtDMC055361; Fri, 29 Apr 2022 20:55:13 GMT (envelope-from git) Date: Fri, 29 Apr 2022 20:55:13 GMT Message-Id: <202204292055.23TKtDMC055361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 374ca4a3dd1b - stable/13 - libc: Fix the alignment of the TCB to match rtld for several architectures. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 374ca4a3dd1b37436da93ee6172d8b4d7cb36f7c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651265714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+ssX2I81jbHRIU5bdY/Yvbd4e2DbuQg8qA0In4oykgQ=; b=JVRVAb3bpDqxMotC1JXqcxz31JlE+NRS0g5qjwA4x6vHarRUsAo1uTb4HPsiNGq3o1ofoo QZWTIT3f35pj/0ERlCij9QJ5oG66f+YWJtt9unaDgUJh3hMFD869PrjNDHvXGeDPCboi8t ii3+o7n8lHVo421sNJ4mzwb8hw4wzjPdkyMClB7AfbrbR5NgFZI5Iu1EXShx6Gvda6yUXO dnnkykh5a1ajpwU4ZDDwufpbz0JQjJfMTSKpgle05VdQepd1N9s6Cl2LPhgakF1DFR7rTD V0ib/FrXIppRYWbFXav6pkVpsnHfEKEFqfe69pcVd278SqsYAbeaRf8au7dM1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651265714; a=rsa-sha256; cv=none; b=B16XKdHQQeKIcGpNDjI6Bh5zQ/9liDErDsLuxRsXRhXnr4v1/N1wj9wVQcaKxUYJGveUcR SIO2R96tNndB38YuMXjgGkLPh6AZpm8/n8wQKtxRi3jC2+NyZ6bOcZfxu11rrg23IF+IrV tO66OA8zERjkbCdr/3+Y4vnyzeME9F/3o5XP7y8jHOBwNvyytgYlqLfDEaiA8T9qSzViLg FrUMCGHF76xdNcPabtowZyuqF6/5MgSYSxYMKH59macZfyi+t4wVL36uuaFFafCNhwyKE2 bDE9l8WLEbeWKyi59YXs3krn5LfKH3qqMK8klY//gYjltPGewtJgOvvAkD2ghw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=374ca4a3dd1b37436da93ee6172d8b4d7cb36f7c commit 374ca4a3dd1b37436da93ee6172d8b4d7cb36f7c Author: John Baldwin AuthorDate: 2021-12-09 21:16:57 +0000 Commit: John Baldwin CommitDate: 2022-04-29 20:50:05 +0000 libc: Fix the alignment of the TCB to match rtld for several architectures. - Use 16 byte alignment rather than 8 for aarch64, powerpc64, and RISC-V. - Use 8 byte alignment rather than 4 for 32-bit arm, mips, and powerpc. I suspect that mips64 should be using 16 byte alignment, but both libc and rtld currently use 8 byte alignment. Reviewed by: kib, jrtc27 Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33350 (cherry picked from commit 4c2f5bfbfa48b33b11912e7308ebd6f98fb6e647) --- lib/libc/gen/tls.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index d90aac028b88..5995cf605ed3 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -72,11 +72,14 @@ void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign); void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign); void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); -#if defined(__amd64__) +#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv) #define TLS_TCB_ALIGN 16 -#elif defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \ - defined(__mips__) || defined(__powerpc__) || defined(__riscv) -#define TLS_TCB_ALIGN sizeof(void *) +#elif defined(__arm__) || defined(__mips__) +#define TLS_TCB_ALIGN 8 +#elif defined(__powerpc__) +#define TLS_TCB_ALIGN TLS_TCB_SIZE +#elif defined(__i386__) +#define TLS_TCB_ALIGN 4 #else #error TLS_TCB_ALIGN undefined for target architecture #endif