r/programming • • Apr 09 '14

Theo de Raadt: "OpenSSL has exploit mitigation countermeasures to make sure it's exploitable"

[deleted] — view deleted post

2.0k Upvotes

661 comments sorted by

View all comments

Show parent comment

8

u/cparen Apr 10 '14

We had this discussion at work. Halfway through, the following phrase lept from my mouth:

Because no good thing ever came from the thought: "Hey, I bet we can write a better memory management scheme than the one we've been using for decades."

Sigh. I wrote a custom allocator for a fairly trivial event query system once.

I built the smallest thing I could that solved the problem. I tried to keep it simple. We cache the most recent N allocations for a number of size buckets. It's a bucket lookaside list, that's it. The idea was clever enough; the implementation didn't need to be, and it was about 20% comments.

This ultimately let to a 2x speedup in end-to-end query execution. Not 10%. Not 50%. 100% more queries per second, sustained. This took us from being allocation bound to not.

This gave me a lot of respect for the "terrible" code I sometimes see in terrible systems. I know that at least one or two "terrible" programs were just good programmers trying to do the best they could with what they had at hand, when doing nothing just wasn't cutting it. Could be all of them, for all I know.

tl;dr? I dunno. Maybe "don't hate the player, hate the game".