home · projects · papers · blog · gallery · contact ·
anil madhavapeddy // anil.recoil.org


mmap-based malloc on OpenBSD

Posted by avsm Sun, 08 Aug 2004 23:02:08 GMT

Thierry Deval has recently committed an impressive implementation of malloc that uses mmap instead of the older sbrk to allocate memory in OpenBSD. The advantage of the new approach is that it allows all the neat randomization features that have been added to OpenBSD recently to happen transparently in malloc (so that you don't just get consecutive pages back as in most operating systems). The downside is a slight slowdown, but in this age of insane CPUs, who cares?

It has had the side-effect of exposing a number of latent bugs in programs which silently access memory locations larger than the area they malloced; I fixed one which had remained lurking in my gcc bounds checker (see gcc-local) for over a year, and other bugs have cropped up in programs as important as newfs. Until someone goes through the pain of porting the awesome Valgrind to OpenBSD, being able to expose more bugs this way is pretty useful.

Posted in ,  | no comments

Comments

(leave url/email »)

   Comment Markup Help Preview comment



Copyright © 2003-2006 by Anil Madhavapeddy. All rights reserved.
Original design used with kind permission from Jon Parise.
Valid CSS
Valid XHTML 1.0