Skip to content

Instantly share code, notes, and snippets.

View manikndn-m's full-sized avatar

M. Manikandan manikndn-m

View GitHub Profile
@manikndn-m
manikndn-m / memsafe-useless.md
Last active November 7, 2026 07:32
Memory Safety is a Useless Concept

Memory Safety is a Useless Concept

Over the last decade or so, there has been a strong push towards languages that are considered "memory safe", citing security as the primary reason. However, most security benefits attributed to memory safety languages can be very easily achieved by applying certain mitigations to unsafe languages:

  • Bounds checking: Eliminates all buffer overflows/underflows. Requires language support.
  • Control-flow Integrity (CFI): Checks whether indirect jumps (function pointers/vtable) are valid (at runtime). This mitigation when combined with hardware mitigations like Intel CET would prevent all remote-code execution (RCE) attacks.
  • Type-stable allocators: Traditional memory allocators reuse the set of same memory regions for objects of approximately same size (called "size classes"). The problem that would arise here is that when a use-after-free occurs and the two successive objects are of different data types, this could enable RCE attacks (this is known as *type