This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Revise 32-bit hppa stub sequences in elf32-hppa.c
- From: John David Anglin <dave dot anglin at bell dot net>
- To: Binutils <binutils at sourceware dot org>
- Date: Sat, 19 Oct 2019 13:59:10 -0400
- Subject: Re: [PATCH] Revise 32-bit hppa stub sequences in elf32-hppa.c
- References: <56fcb9be-c60e-a821-9233-52cf38729534@bell.net>
On 2019-10-12 5:40 p.m., John David Anglin wrote:
> This patch is the binutils portion of a series of changes intended to fix glibc/23296. This bug
> is a data race in the setting of function descriptors during lazy binding. If a descriptor
> is updated between the loading of the function target address and the PIC global pointer
> in another thread, _dl_runtime_resolve() is entered with the new global pointer instead
> of the expected reloc offset. _dl_runtime_resolve() could handle this situation if we modify
> the indirect call sequence to preserve the function pointer (descriptor address) in register
> %r22.
>
> This patch revises the PLT trampoline and import stubs to preserve the function pointer in
> register %r22. This unfortunately makes the stubs one instruction longer. However, the dynamic
> linker has one less relocation per stub to deal with. Also, if we need an ordered load for the
> function address, this now can be done since we have the necessary zero offset.
>
> Tested on hppa-unknown-linux-gnu.
>
> Will commit soon unless someone has a better suggestion on how to proceed.
>
> Dave
>
> 2019-10-12 John David Anglin <danglin@gcc.gnu.org>
>
> * elf32-hppa.c: Revise import stub sequences.
> (LONG_BRANCH_STUB_SIZE): Define.
> (LONG_BRANCH_SHARED_STUB_SIZE): Define.
> (IMPORT_STUB_SIZE): Define.
> (IMPORT_SHARED_STUB_SIZE): Define.
> (EXPORT_STUB_SIZE): Define.
> (plt_stub): Revise to not use register %r22.
> (LDO_R1_R22): Define.
> (LDW_R22_R21): Define.
> (LDW_R22_R19): Define.
> (hppa_build_one_stub): Update stub generation and use new defines.
> (hppa_size_one_stub): Likewise.
>
Committed.
Dave
--
John David Anglin dave.anglin@bell.net