PR 34327 Fix out-of-bounds accesses in relocations
Binutils BFD library now performs better bounds-checking for relocations, preventing potential crashes.
Several relocations handlers in the BFD library have been updated to improve out-of-bounds access checks. This change addresses a security and stability concern (PR 34327) by ensuring that relocation offsets are validated against section boundaries, preventing potential assertion failures and segmentation faults across various architectures like ARM, MIPS, and SPU.
In Details
This patch enhances the robustness of the BFD library's relocation handling by ensuring that reloc_offset_in_range or equivalent checks are consistently applied. It fixes issues where relocation fields could extend beyond their designated sections, particularly affecting architectures like s12z and mmix, and corrects an incorrect size definition for R_MMIX_BASE_PLUS_OFFSET.
- Relocation
- A process performed by the linker to fix up symbolic references between object files. It involves adjusting memory addresses and other constant values in the code and data segments based on the final memory layout of the executable.
- BFD
- The Binary File Descriptor library, a part of GNU Binutils. It provides an abstraction layer to manage different object file formats, enabling tools like the linker and assembler to work with various executable and symbolic formats.
- out-of-bounds access
- An operation that attempts to read or write memory outside the allocated boundaries of a buffer or data structure. This can lead to data corruption, crashes, or security vulnerabilities.