4 ms·
OpenBSD's malloc function is based on mmap, which will give you cleared pages.
by Sanddancer 12y ago
OpenBSD's malloc function is based on mmap, which will give you cleared pages.
- _yosefk 12y agoYou mean it always relinquishes pages to the OS upon free and never reuses a page? So every malloc is a memset(0) inside the kernel?
- weland 12y agoTechnically yes (although, by default, no), but it's more efficient than that would imply. By default, I think only small chunks are overwritten, so OpenSSL's meagre 64 KB of Heartbleed payload would have been filled with useless junk, whereas multi-megabyte mallocs() in e.g. a RDBMS would have been unaffected. There are some other protection mechanism included, too; there's a more in-depth presentation here: http://www.openbsd.org/papers/eurobsdcon2009/otto-malloc.pdf http://www.openbsd.org/papers/eurobsdcon2009/otto-malloc.pdf