binutils Newspaper
NOVEMBER 30, 2026
arm — Proposed

arm: reject a relocation whose field lies outside the section

Binutils ARM ELF support now rejects relocations with fields outside section bounds.

This patch modifies binutils’ ARM ELF handling to reject relocations where the accessed field falls outside the section boundaries. This prevents crafted objects from causing the linker to read or write past section contents, addressing a security vulnerability.

In the Thread 1 participant
  1. Harshit Kumar <harshit7kr@gmail.com> proposer

    Proposes adding checks to reject relocations whose fields lie outside section boundaries.

    “elf32_arm_relocate_section applied each relocation without checking that the relocated field lies inside the section, so a crafted object with a bad r_offset made the linker read and write past the section contents. elf64-x86-64.c and elf32-i386.c already range-check.”

In Details

This is the first patch in a series addressing security issues in binutils' ARM ELF processing. It introduces a critical bounds check at the beginning of the relocation loop within elf32_arm_relocate_section. This ensures that the memory range accessed by a relocation (considering potentially wider fields than the basic howto size for certain Thumb and ARM instructions) is fully contained within the section. This prevents heap-buffer-overflows and other memory corruption when processing malformed object files, aligning with checks already present in x86 ELF backends.

For Context
relocation
A placeholder in object code that specifies how to modify an address or symbol reference when linking.
r_offset
The offset within the section where the relocation is to be applied.
position-independent code
Code that can be loaded and executed at any memory address without modification.
ELF
Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.
BFD
Binary File Descriptor library, used by binutils to handle various object file formats.
howto
Describes how a relocation should be applied, including the size of the field being modified.
R_ARM_THM_BF16
An ARM relocation type for Thumb instructions, potentially affecting 16 bits.
R_ARM_LDR_PC_G0
An ARM relocation type for load instructions relative to the program counter.
R_ARM_NONE
A relocation type that indicates no operation is needed.
Filed Under: armsecurityrelocationelfbinutils