[PATCH v2 2/2] ld: do not read ELF fields from a generic link hash table
Jan Beulich
jbeulich@suse.com
Fri Nov 6 08:39:29 GMT 2026
On 16.10.2026 18:54, Harshit Kumar wrote:
> ldelf_after_open_output assumes that an ELF output BFD implies an ELF
> link hash table. A linker script can select an ELF flavour that uses
> the generic hash table, for example OUTPUT_FORMAT("elf64-nfp"). The
> hook then reads hash_table_id, which is past the end of the generic
> table (AddressSanitizer, heap-buffer-overflow, READ of size 4).
>
> Test is_elf_hash_table before reading the table, as other uses of
> link_info.hash in ld do. compatible_format in bfd/elflink.c does the
> same before it reads the ELF fields.
>
> Extend ld-x86-64/arch-confusion.exp to cover the generic hash table,
> using elf64-nfp and, when that is not built, elf32-little.
>
> Signed-off-by: Harshit Kumar <harshit7kr@gmail.com>
Okay.
Jan
More information about the Binutils
mailing list