From nobody Thu Jun 12 19:32:59 2025 X-Original-To: dev-commits-src-main@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 4bJCP622ZWz5yJG5 for ; Thu, 12 Jun 2025 19:33:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4bJCP46dHnz3Pkn for ; Thu, 12 Jun 2025 19:33:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 55CJWxAg047645; Thu, 12 Jun 2025 22:33:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 55CJWxAg047645 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 55CJWxRR047644; Thu, 12 Jun 2025 22:32:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 12 Jun 2025 22:32:59 +0300 From: Konstantin Belousov To: Mark Millard Cc: dev-commits-src-main@freebsd.org Subject: Re: git: 883596411327 - stable/14 - amd64: switch to amd64_set_tlsbase to set tls base [|| (. . . && osrel >= 1403502) test too?] Message-ID: References: <4C483AC0-4082-4EBB-AAC2-01610E0482B3.ref@yahoo.com> <4C483AC0-4082-4EBB-AAC2-01610E0482B3@yahoo.com> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C483AC0-4082-4EBB-AAC2-01610E0482B3@yahoo.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4bJCP46dHnz3Pkn X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Thu, Jun 12, 2025 at 12:22:52PM -0700, Mark Millard wrote: > Konstantin Belousov wrote on > Date: Thu, 12 Jun 2025 18:03:03 UTC : > > > The branch stable/14 has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=88359641132766cc0a8eed283a7a704595c7c119 > > > > commit 88359641132766cc0a8eed283a7a704595c7c119 > > Author: Konstantin Belousov > > AuthorDate: 2025-05-22 04:32:25 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2025-06-12 18:02:50 +0000 > > > > amd64: switch to amd64_set_tlsbase to set tls base > > > > (cherry picked from commit aef025fc9b6c8b06677086a93c866ee09622f6fa) > > --- > > libexec/rtld-elf/amd64/reloc.c | 6 ++++-- > > sys/x86/include/tls.h | 2 +- > > 2 files changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c > > index 7e7f01a5d186..74693d35ba1d 100644 > > --- a/libexec/rtld-elf/amd64/reloc.c > > +++ b/libexec/rtld-elf/amd64/reloc.c > > @@ -530,10 +530,12 @@ allocate_initial_tls(Obj_Entry *objs) > > addr = allocate_tls(objs, 0, TLS_TCB_SIZE, TLS_TCB_ALIGN); > > > > /* > > - * This does not use _tcb_set() as it calls amd64_set_fsbase() > > + * This does not use _tcb_set() as it calls amd64_set_tlsbase() > > * which is an ifunc and rtld must not use ifuncs. > > */ > > - if (__getosreldate() >= P_OSREL_WRFSBASE && > > + if (__getosreldate() >= P_OSREL_TLSBASE) > > lib/libc/amd64/sys/amd64_set_tlsbase.c has more in its test, > "|| (P_OSREL_MAJOR(osrel) == 14 && osrel >= 1403502)" : > > +DEFINE_UIFUNC(, int, amd64_set_tlsbase, (void *)) > +{ > + int osrel; > + > + osrel = __getosreldate(); > + if (osrel >= P_OSREL_TLSBASE || > + (P_OSREL_MAJOR(osrel) == 14 && osrel >= 1403502)) > + return (amd64_set_tlsbase_syscall); > + return (amd64_set_fsbase); > +} > > Is the difference in libexec/rtld-elf/amd64/reloc.c related > to P_OSREL_TLSBASE like testing deliberate? Thanks, should be fixed.