3 ms·
Could you be more specific on what you have in mind here? As far as I can see, if something like Heartbleed exists, you can't rely on "safe memory abstractions
by AnimalMuppet 11y ago
Could you be more specific on what you have in mind here?
As far as I can see, if something like Heartbleed exists, you can't rely on "safe memory abstractions" at a lower level, because Heartbleed let the attacker look at the internal memory of those abstractions. They quit being abstractions; their raw memory is open to the attacker.
Or is your claim that safe abstractions would have prevented Heartbleed (and all other possible attacks that let the attacker read memory)?
- voxic11 11y agoPretty sure he is claiming that bad abstractions make it very likely that you will produce code which doesn't do what you think it will do, such as leaking memory contents.
- twic 11y agoFor Heartbleed, you need an abstraction like "container that i can write bytes to and then read the same bytes from" which has the leak "sometimes you can read other bytes too". In C, the memory abstraction the language gives you has that leak, so it's really hard to build a container on top of it that doesn't have that leak. In safer languages, the memory abstraction doesn't have that leak, because bounds are checked, and new byte buffers are initialised to zero. You can still build an abstraction which does have that leak - say, by writing your own reusable byte buffer class which doesn't check bounds or zero on reuse - but at least you have the option of getting it right. In an even safer language, the type system might make it impossible to make that mistake, or the library might supply a safe implementation of that abstraction already. Remember, Heartbleed is not about the attacker doing some kind of Jedi memory trick to read your secrets: they are relying on your own code to read things it shouldn't. If the abstractions your program is built on don't allow that, then there's no way for it to be used to that end.
- cuckcuckspruce 11y ago>In C, the memory abstraction the language gives you has that leak, so it's really hard to build a container on top of it that doesn't have that leak. >In safer languages, the memory abstraction doesn't have that leak, because bounds are checked, and new byte buffers are initialised to zero. Most of the implementations of these safer languages are in C, so clearly there's a way to do this correctly in C.