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
This commit is contained in:
@@ -337,7 +337,7 @@ map_object(int fd, const char *path, const struct stat *sb, bool ismain)
|
||||
obj->tlsalign = phtls->p_align;
|
||||
obj->tlspoffset = phtls->p_offset;
|
||||
obj->tlsinitsize = phtls->p_filesz;
|
||||
obj->tlsinit = mapbase + phtls->p_vaddr;
|
||||
obj->tlsinit = obj->relocbase + phtls->p_vaddr;
|
||||
}
|
||||
obj->stack_flags = stack_flags;
|
||||
if (note_start < note_end)
|
||||
|
||||
Reference in New Issue
Block a user