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)
Fri, Jul 4, 12:13 AM
Unknown Object (File)
Wed, Jul 2, 2:52 AM
Unknown Object (File)
Mon, Jun 30, 5:24 PM
Unknown Object (File)
Tue, Jun 24, 6:24 AM
Unknown Object (File)
Tue, Jun 17, 7:56 AM
Unknown Object (File)
Sun, Jun 15, 1:28 PM
Unknown Object (File)
Sun, Jun 15, 8:59 AM
Unknown Object (File)
Fri, Jun 13, 3:49 PM
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