binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld

ld: guard the vxworks ELF link hash table read

Fixes a heap overflow in the VxWorks ELF linker by ensuring the ELF hash table is present before access.

The linker’s VxWorks emulation incorrectly accessed ELF-specific hash table members without first verifying the hash table’s type. This could lead to a heap-based buffer overflow when a generic ELF output format was selected via a linker script. This change adds a check for is_elf_hash_table to prevent this out-of-bounds read, resolving AddressSanitizer reports.

In Details

In ld/emultempl/vxworks.em, the vxworks_after_open function would read dynamic_sections_created from link_info.hash after checking for bfd_target_elf_flavour. However, link_info.hash could be a generic bfd_link_hash_table when OUTPUT_FORMAT(elf*...) was used without a specific ELF backend. Accessing dynamic_sections_created (a member of struct elf_link_hash_table) on a generic hash table caused an out-of-bounds read. The patch adds a guard is_elf_hash_table(link_info.hash) to prevent this.

For Context
link hash table
A data structure used by the linker to store and efficiently look up symbols and other information during the linking process.
elf_link_hash_table
A specific type of link hash table used for ELF object files, containing ELF-specific information.
bfd_link_hash_table
A generic link hash table structure used by the BFD library.
OUTPUT_FORMAT
A linker script command that specifies the output file format.
is_elf_hash_table
A function that checks if a given link hash table is of the ELF type.
Filed Under: linkervxworkselfsecurityheap overflow