3 ms·
And that your allocation isn’t at the end of a page.
by vlovich123 4y ago
And that your allocation isn’t at the end of a page.
- Dylan16807 4y agoIf you legitimately have the buffer length then it doesn't matter how the allocation is aligned. The extra time to read the next page with no errors doesn't need to be avoided, since it's rare and you're very likely to use that data anyway. The only thing you need is certainty that you have the buffer length.
- vlovich123 4y agoYou're assuming the next page is mapped. If it's pointing into unmapped memory, then you'll segfault.
- Dylan16807 4y agoI'm not assuming. When I say "guarantee", I mean the code is designed so the first 8 bytes are always mapped. When I say "runtime length check", I mean the code only runs if the first 8 bytes are in fact mapped. No assumptions. No possible way to segfault. The read is valid. If buffer[6] is not mapped, then you don't "legitimately have the buffer length".
- vlovich123 4y agoOk then I just misunderstood / some kind of language preciseness confusion. We’re on the same page now. AFAIK this is what the article is saying to do.
- Dylan16807 4y ago> AFAIK this is what the article is saying to do. Yeah, that's why I quoted the article.