Integer overflow bugs remain one of the most prevalent root causes of memory corruption and privilege escalation in low-level embedded C code. However, how microprocessors handle arithmetic wrapping varies fundamentally across architectures.
Architecture Comparison
- ARM (Cortex-M/A): Uses Dedicated APSR flags (
Cfor unsigned carry,Vfor signed overflow). Conditional branches likeBVSandBLOinspect these flags directly. - RISC-V (RV32/RV64): Strips condition flags completely! Overflow detection requires explicit comparison instructions (e.g.
ADD rd, rs1, rs2followed byBLTU rd, rs1, overflow_handler). - MIPS: The
ADDinstruction generates a hardware trap exception on signed overflow, whereasADDU(unsigned add) wraps silently without trapping. - PowerPC: Utilizes Condition Register (CR) and Summary Overflow (SO) bits in the XER register.
Get New Research & U-Boot Lab Resources
Subscribe to receive notifications when new embedded security papers, reverse engineering tools, and U-Boot VM updates are released.