TLDR Tech / Practical
Zeroization: Why Wiping Memory Can Be Counterproductive
The author investigates how the indiscriminate addition of zeroization functions to erase secrets from memory can be ineffective, potentially leaving more copies of a secret than the original code. By analyzing C code through assembly, the article shows that straightforward `memset` calls can be optimized away, volatile byte writes may replace secrets with zeros without preserving the original value, and opaque wiping functions can cause compilers to generate stack spill copies that persist after cleanup. The author concludes that while clearing password buffers and retiring contexts is still valuable, developers must examine compiler output and avoid haphazardly implementing wiping routines.
Read the full story