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) + sysarch(AMD64_SET_TLSBASE, &addr); + else if (__getosreldate() >= P_OSREL_WRFSBASE && (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) wrfsbase((uintptr_t)addr); else diff --git a/sys/x86/include/tls.h b/sys/x86/include/tls.h index 4b6b58b4a5e3..b431c336122c 100644 --- a/sys/x86/include/tls.h +++ b/sys/x86/include/tls.h @@ -59,7 +59,7 @@ static __inline void _tcb_set(struct tcb *tcb) { #ifdef __amd64__ - amd64_set_fsbase(tcb); + amd64_set_tlsbase(tcb); #else i386_set_gsbase(tcb); #endif