4 ms·
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 need
by jsnell 15y ago
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.
- eridius 15y agoAh. 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.
- jsnell 15y agoI 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 :-)