<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>No Content, No Fuss: mmap-based malloc on OpenBSD</title>
    <link>http://anil.recoil.org/blog/articles/2004/08/09/mmap-based-malloc-on-openbsd</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Anil Madhavapeddy</description>
    <item>
      <title>mmap-based malloc on OpenBSD</title>
      <description>&lt;p&gt;&lt;a href="http://www.deval.be/"&gt;Thierry Deval&lt;/a&gt; has recently &lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=109134993612461&amp;amp;w=2"&gt;committed&lt;/a&gt; an impressive implementation of
&lt;a href="openbsd3"&gt;malloc&lt;/a&gt; that uses &lt;a href="openbsd2"&gt;mmap&lt;/a&gt;
instead of the older &lt;a href="openbsd2"&gt;sbrk&lt;/a&gt; to allocate memory in &lt;a href="http://www.openbsd.org/"&gt;OpenBSD&lt;/a&gt;.
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?
&lt;/p&gt;

&lt;p&gt;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
&lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=109199309502349&amp;amp;w=2"&gt;fixed&lt;/a&gt; one
which had remained lurking in my gcc bounds checker (see &lt;a href="openbsd1"&gt;gcc-local&lt;/a&gt;) for over a year, and
other bugs have cropped up in programs as important as &lt;a href="openbsd8"&gt;newfs&lt;/a&gt;.  Until someone
goes through the pain of porting the awesome &lt;a href="http://valgrind.kde.org/"&gt;Valgrind&lt;/a&gt; to
OpenBSD, being able to expose more bugs this way is pretty useful.
&lt;/p&gt;</description>
      <pubDate>Mon, 09 Aug 2004 00:02:08 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:efe5e3b4-ad0e-4f90-9199-03a198b2bd7e</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2004/08/09/mmap-based-malloc-on-openbsd</link>
      <category>hacking</category>
      <category>openbsd</category>
    </item>
  </channel>
</rss>
