Page MenuHomeFreeBSD

rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V
ClosedPublic

Authored by jrtc27 on May 5 2025, 11:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 9, 10:44 PM
Unknown Object (File)
Wed, Apr 8, 7:02 PM
Unknown Object (File)
Sun, Apr 5, 6:38 PM
Unknown Object (File)
Thu, Mar 26, 12:37 AM
Unknown Object (File)
Wed, Mar 25, 5:47 AM
Unknown Object (File)
Sun, Mar 22, 2:38 AM
Unknown Object (File)
Mar 12 2026, 12:48 AM
Unknown Object (File)
Jan 31 2026, 10:00 AM
Subscribers

Details

Summary

The implementation here is meant to mirror what a GOT entry for the
given symbol would use for ti_offset. However, on PowerPC and RISC-V,
TLS_DTV_OFFSET is non-zero, and so the GOT entries are normally biased
by this, but we fail to do so here. As a result we end up getting a
pointer TLS_DTV_OFFSET past where the variable actually is.

(Note this also applies to MIPS on stable/13)

Fixes: 5ceeeba90c6c ("Import DragonFly BSD commit")
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable