x86 ELF output target confusion, one OOB write and one OOB read
Two patches fix out-of-bounds read and write vulnerabilities in the linker related to x86 ELF output target confusion.
This patch series addresses two distinct security vulnerabilities in the GNU linker (ld) related to how it handles x86 ELF output targets when a linker script retargets the output format. The first patch fixes an out-of-bounds write that occurs when a non-x86 target ID is used with the x86 ELF backend. The second patch corrects an out-of-bounds read in the generic ELF hook when a linker script specifies an ELF flavor that uses a generic link hash table instead of an ELF-specific one. Both issues could lead to heap buffer overflows and are detected by AddressSanitizer.
- proposer
Submits a two-part patch series to resolve out-of-bounds access issues in the linker caused by confusion over x86 ELF output targets.
“A linker script can retarget the output BFD with OUTPUT_FORMAT. The x86 emulation hook and ld's generic ELF hook still run after that, and each assumes the link hash table matches the emulation or ELF. Each patch fixes one out of bounds access found this way.”
In Details
This is the cover letter for a series of two patches that fix security vulnerabilities in the GNU linker (ld) related to output target confusion in x86 ELF builds. When a linker script uses OUTPUT_FORMAT to specify a different target (e.g., elf64-bpfle or elf64-nfp), the x86 emulation hook and the generic ELF hook can incorrectly assume the link hash table matches their respective backends. This leads to out-of-bounds writes (in patch 1) and out-of-bounds reads (in patch 2), both potentially causing heap buffer overflows. The patches ensure that the correct hash table type is identifi…
- linker script
- A file that contains commands for the linker, specifying how to arrange sections, resolve symbols, and define the output file format.
- OUTPUT_FORMAT
- A linker script command used to specify the output file format.
- x86 emulation hook
- A mechanism within the linker that allows x86-specific logic to be applied during the linking process.
- generic ELF hook
- A general-purpose hook for handling ELF files in the linker, used when specific backend logic is not applicable or available.
- AddressSanitizer
- A fast memory error detector for C/C++ that finds use-after-free, heap corruption, and buffer overflow bugs.