News for hackers. Stuff that matters.
Re:How OpenBSD Leverages Malloc to Find Bugs by jsnell on Monday November 28, 2011 @01:57PM (#3287093)
The second 4k is a guard page, to catch buffer overflows. So the heap looks like:

3k empty, 1k data, 4k empty and read/write-protected.

The extra page is needed since you can't set the memory protection flags at a higher granularity.

Re:How OpenBSD Leverages Malloc to Find Bugs by eridius on Tuesday November 29, 2011 @01:18PM (#3291419)
Ah. It sounded like you were mapping 2 4k pages for the allocation itself, aligning the allocation at the end of that 2-page span, and then mapping the following page and marking it as denied.
Re:How OpenBSD Leverages Malloc to Find Bugs by jsnell on Wednesday November 30, 2011 @06:55PM (#3297482)
I wasn't the original poster, that was just my impression of the scheme. I could have misunderstood, in which case I don't have any alternate theories for what that second page is for :-)