HomeFreeBSD

rtld: do not relocate tlsinit address twice

Description

rtld: do not relocate tlsinit address twice

The addend for PT_TLS p_vaddr value should be obj' relocbase and not
mapbase. It does not matter for dso which is linked at the address
zero, but for executables in direct-exec mode with non-zero link
address mapbase is already at the link base. Then, adding mapbase to
phtls->p_vaddr adds twice as much relocbase offset as needed.

PR: 288334
Reported by: Jordan Gordeev <jgopensource@proton.me>
Reviewed by: jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51448

Details

Provenance
kibAuthored on Jul 21 2025, 4:09 AM
Reviewer
jrtc27
Differential Revision
D51448: rtld: do not relocate tlsinit address twice
Parents
rG5df4eb5fd7f2: krb5: Add pkgbase templates
Branches
Unknown
Tags
Unknown