news.volyx.in

D4D4 (nmichaels.org)

475 points by csense · 344 days ago · 56 comments on HN

Article summary

The article discusses a strange occurrence of d4d4 instructions in disassembled ARM code, which were found to be unreachable and seemed to be used for alignment purposes. The author investigates the cause and finds that the linker, LLD, is inserting these instructions to align object files. However, the instruction is not a trap as intended, but rather a conditional branch. The author concludes that this is a bug in LLD, as the instruction can potentially be used as a ROP gadget.

Main themes

  • exploit mitigation
  • code commenting
  • linker behavior
  • ARM architecture
  • security vulnerabilities
  • code maintenance

What commenters say

  • The use of a conditional branch instead of a trap instruction is a bug that can be exploited.
  • Comments in code can become outdated and misleading, making commit logs a better place for explanations.
  • The practice of using trap instructions for padding is an exploit mitigation technique, but its implementation in LLD is flawed.
  • The choice of instruction for padding should be carefully considered to avoid potential security vulnerabilities.
  • Code should be self-documenting, but comments can still be useful for explaining complex or non-obvious design decisions.
  • The use of commit logs to explain code changes is a good practice, as it provides a clear and permanent record of the reasoning behind the code.