From nobody Sun Nov 17 18:50:12 2024 X-Original-To: freebsd-arm@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 4Xs0FM0DJsz5dGZW for ; Sun, 17 Nov 2024 18:50:31 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic311-24.consmr.mail.gq1.yahoo.com (sonic311-24.consmr.mail.gq1.yahoo.com [98.137.65.205]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xs0FK3XkFz4sBj for ; Sun, 17 Nov 2024 18:50:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=neKjkKqy; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.205 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1731869427; bh=YEY8PoP1abpImlmHvhC3wCj3mod+7NbHWu6AcOq8Y2c=; h=From:Subject:Date:Cc:To:References:From:Subject:Reply-To; b=neKjkKqyGiIJkzFcKU0TyNYqe8sf1OZY4/Cu19qQJWfJuywTcpqFOT3QQgcun5No4xH7TJZ6zKucAKeMwKF9wNILgM7xQ2jJD2cCn24qlNbGwpmrMyL7FZ56xf/vJnnUbMrXMGQ2UEVveAfHABsbb5BpNuLBuSTrtDWZLMqhq6KojHz9wNX7HphH9TjS34ee/N5Q55gYXbUdGz1qG9U8aO7OwE2B6XXBBzH10yQ5Xy8kRH0T0jBogmUkRNJzscMSWmGXIupEybM5D9kF+c9Atnj9Z6cqQy/GE9cCo2eGYvtrViN6DyRN32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JBM4gOsw1FPXC2Ue50is3Wq0LA6uLpm5_9N_urWPzNT5v.eZggvIm1RC2i qfKAHsnVGhCSltnv1vFEp9LDEhDs8ge3UI_nW3O.tcDlXsaoaVZ4e5Z7r9Cm_4EuGWutUOtSj7Gm CiqtraKOKndnVDXJGKIhSOULpWEZmeGK51NkDY3.1YD0a_b.cUSRjKd6yYJVMVtHrddtwbPBcw61 uDgyXUlDAvSy.TbxhmMxvonrHNDeWrklcklvIxk57r5wwyZfPATPD5wXZQV7DivNNj.6JMlJ5MlZ cE5.c8A2e_H0c3G98a.R0FxJ97JXCo9tw0neETVcXRoH7OpEwZ56dQ7nABAA_o7h2BXZ9Dd95Jgx aWvUldXEAky5jBwdZqchhkRPGp1gD28bREtC4_w2XKi6GeRlUCwe1.7vBk2gvZvr1VMJUZdARnRB wgITlzpTuSTDe0XZScDVgkslQdsGDgsNUYnOEk6PGB1KcAGmSFErjTfk6VtF2tx0wzgHe1TrNu.U vgh7sgU8E1v.XoLMVsvUZBBEVr6.OjQUWZHohHfH7rmSaQDM8YXS0TP2w_MuANqV5Ywze_HeaLfV xuJaAYPR5JdeV9WGDH4Lyyk2pwTFOObupUsh_ySV.qH92p7BwtK1uf7bdc53knmbD_t6hfhkkDe. btQsS.YshX4Zw0vGSHtuc_kuYUmhpedoFcmgJ3vlUNtA.SsFcoNMs5GqC8oQrvvb0ri69c4dlmOX SrFASue4d1ra8L.BnXLp4J.FdFeWqzfRyrvCssA-- X-Sonic-MF: X-Sonic-ID: be5c4fb4-d0e3-4176-a8ea-79756082f749 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Sun, 17 Nov 2024 18:50:27 +0000 Received: by hermes--production-gq1-5dd4b47f46-bxhh2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 99849222eba2bf10d648c9b8575febad; Sun, 17 Nov 2024 18:50:23 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Should stable/1[34] and supported 1[34].*-RELEASE have -ftls-model=initial-exec fixes MFC'd and/or EC'd for armv7? Message-Id: Date: Sun, 17 Nov 2024 10:50:12 -0800 Cc: Konstantin Belousov To: FreeBSD-STABLE Mailing List , FreeBSD ARM List X-Mailer: Apple Mail (2.3776.700.51) References: X-Spamd-Result: default: False [-2.86 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.86)[-0.864]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; DKIM_TRACE(0.00)[yahoo.com:+]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_THREE(0.00)[3]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; APPLE_MAILER_COMMON(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.205:from]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.205:from] X-Rspamd-Queue-Id: 4Xs0FK3XkFz4sBj X-Spamd-Bar: -- [Not that they could be timed for 14.2-RELEASE at this point.] Given an update to the bootstrap lang/rust compiler that has already been fixed, the below fixes why lang/rust has not built on the official package build server s for 1[34].* since at least lang/rust 1.77.0 . (The traceable records do not go back beyond that. But it may be that rust became dependent at 1.77.0 for all I know.) It also blocks private armv7 lang/rust builds for stable/1[34] . Other packages may have build failures that are related but I'll use the lang/rust activity here: used as the test case. I have locally tested building lang/rust 1.82.0_1 on stable/14 both with and without the changes in question. With the 2 commits it built just fine, unlike without. (I did not try just 1 of the 2, just the pair as I unit.) The primary, recent bugzilla activity is at: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282663 But the below avoids going through the discovery process and history that is recorded there. (There are also other related bugzilla's around but this one is where the potential MFC's were identified.) See also the fallout records for lang/rust for armv7: = https://portsfallout.com/fallout?port=3Dlang%2Frust&maintainer=3D&env=3Dar= mv7&category=3D&flavor=3D (but ignore the lang/rustpython lines that also match the pattern used). Only main got the fixes back in 2023-Nov and only main has worked for lang/rust for the official armv7 package build servers since then for any records that I've found -- lang/rust 1.77.0 and later. The 2 commits are: = https://cgit.freebsd.org/src/commit/?id=3D98fd69f0090da73d9d0451bd769d7752= 468284c6 = https://cgit.freebsd.org/src/commit/?id=3D6e5b1ff71e01bd48172483cb6df921f8= 4300ea3a I show the details below. Whitespace might not be accurately preserved = below. https://cgit.freebsd.org/src/commit/?id=3D98fd69f0090d is: author R. Christian McDonald 2023-11-03 12:56:58 +0000 committer Kristof Provost 2023-11-03 21:43:40 +0000 . . . rtld/arm: fix initial-exec (IE) thread-local storage relocation net/frr[89] revealed an interesting edge-case on arm when dynamically linking a shared library that declares more than one static TLS variable with at least one using the "initial-exec" TLS model. In the case of frr[89], this library was libfrr.so which essentially does the following: #include #include "lib.h" static __thread int *a __attribute__((tls_model("initial-exec"))); void lib_test() { static __thread int b =3D -1; printf("&a =3D %p\n", &a); printf(" a =3D %p\n", a); printf("\n"); printf("&b =3D %p\n", &b); printf(" b =3D %d\n", b); } Allocates a file scoped `static __thread` pointer with tls_model("initial-exec") and later a block scoped TLS int. Notice in the above minimal reproducer, `b =3D=3D -1`. The relocation process does the wrong thing and ends up pointing both `a` and `b` at the same place in memory. The output of the above in the broken state is: &a =3D 0x4009c018 a =3D 0xffffffff &b =3D 0x4009c018 b =3D -1 With the patch applied, the output becomes: &a =3D 0x4009c01c a =3D 0x0 &b =3D 0x4009c018 b =3D -1 Reviewed by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42415/ Diffstat -rw-r--r-- libexec/rtld-elf/arm/reloc.c 7=09 1 files changed, 5 insertions, 2 deletions diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index c3e95940be74..6efc9f499761 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -280,10 +280,13 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel = *rel, SymCache *cache, return -1; =20 tmp =3D (Elf_Addr)def->st_value + = defobj->tlsoffset; - if (__predict_true(RELOC_ALIGNED_P(where))) + if (__predict_true(RELOC_ALIGNED_P(where))) { + tmp +=3D *where; *where =3D tmp; - else + } else { + tmp +=3D load_ptr(where); store_ptr(where, tmp); + } dbg("TLS_TPOFF32 %s in %s --> %p", obj->strtab + obj->symtab[symnum].st_name, obj->path, (void *)tmp); https://cgit.freebsd.org/src/commit/?id=3D6e5b1ff71e01 is: author R. Christian McDonald 2023-11-09 20:22:21 = +0000 committer Kristof Provost 2023-11-09 = 20:24:23 +0000 . . . Reviewed by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42415/ libc: enable initial-exec (IE) as default thread-local storage model on = arm As suggested by jrtc27@ in https://reviews.freebsd.org/D42415, this patch enables IE as default thread-local storage model in libc on arm. Reviewed by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42445 Diffstat -rw-r--r-- lib/libc/Makefile 4=09 1 files changed, 0 insertions, 4 deletions diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 7540eb8c21ad..e817104642b8 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -54,11 +54,7 @@ CFLAGS+=3D${CANCELPOINTS_CFLAGS} =20 # Use a more efficient TLS model for libc since we can reasonably = assume that # it will be loaded during program startup. -.if ${LIBC_ARCH} =3D=3D "aarch64" || ${LIBC_ARCH} =3D=3D "amd64" || \ - ${LIBC_ARCH} =3D=3D "i386" || ${LIBC_ARCH} =3D=3D "riscv" || \ - ${LIBC_ARCH:Mpowerpc*} !=3D "" CFLAGS+=3D -ftls-model=3Dinitial-exec -.endif =20 # # Link with static libcompiler_rt.a. =3D=3D=3D Mark Millard marklmi at yahoo.com