4 ms·
"The OpenBSD malloc system allows you to enable some extra checks, like use after free, heap overflow or guard pages..." How would the added protection compare
by hpeter 3y ago
"The OpenBSD malloc system allows you to enable some extra checks, like use after free, heap overflow or guard pages..."
How would the added protection compare to safety in rust?
Wouldn't it be useful to develop C on a memory hardened system, then deploy anywhere knowing there were checks during development? Would that help avoid the memory issues later in production?
- steveklabnik 3y agoRust's borrow checker does not only check heap memory, it checks pointers (references in Rust terminology) to anywhere. Additionally, these checks in malloc are at runtime, whereas the borrow checker is at compile time. These checks are good, but they do not go as far as Rust does in terms of statically preventing issues. > Wouldn't it be useful to develop C on a memory hardened system, then deploy anywhere knowing there were checks during development? Would that help avoid the memory issues later in production? It helps but one aspect of runtime vs compile time checking is that for runtime checks, you only get the checks if you actually exercise the code path that causes the issue. If you ship with some checks on in development, and turn them off in release, you run the risk of having missed cases that will still cause problems. All of this is better than doing nothing at all, and is a good thing.