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 <k...@freebsd.org>
> > AuthorDate: 2025-05-22 04:32:25 +0000
> > Commit:     Konstantin Belousov <k...@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.

Reply via email to