Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jun 2025 22:32:59 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Mark Millard <marklmi@yahoo.com>
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:  <aEsra4zbL6_v51xC@kib.kiev.ua>
In-Reply-To: <4C483AC0-4082-4EBB-AAC2-01610E0482B3@yahoo.com>
References:  <4C483AC0-4082-4EBB-AAC2-01610E0482B3.ref@yahoo.com> <4C483AC0-4082-4EBB-AAC2-01610E0482B3@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 12, 2025 at 12:22:52PM -0700, Mark Millard wrote:
> Konstantin Belousov <kib_at_FreeBSD.org> 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 <kib@FreeBSD.org>
> > AuthorDate: 2025-05-22 04:32:25 +0000
> > Commit:     Konstantin Belousov <kib@FreeBSD.org>
> > 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aEsra4zbL6_v51xC>