HomeFreeBSD

rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0

Description

rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0

For a Variant II architecture, the TP offset of a TLS symbol is st_value -
tlsoffset + r_addend. tlsoffset is computed by either calculate_tls_offset
or calculate_first_tls_offset.

The return value of calculate_first_tls_offset is the smallest integer
satisfying res >= size and (-res) % p_align = p_vaddr % p_align
(= p_offset % p_align). (The formula is a bit contrived. The basic idea
is to subtract the minimum integer from size + align - 1 so that the result
ihas the expected remainder.)

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31538
Differential revision: https://reviews.freebsd.org/D31541

Details

Provenance
fbsd-phab_maskray.meAuthored on Aug 14 2021, 4:56 PM
kibCommitted on Aug 16 2021, 10:55 AM
Reviewer
kib
Differential Revision
D31538: rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0
Parents
rGcc1345056b11: Add missing lex/yacc dependency for mkesdb/mkcsmapper bootstrap
Branches
Unknown
Tags
Unknown