1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Kernel: munmap() should round up to nearest page size, just like mmap().

The mismatch between the two was causing some trouble if you'd mmap e.g 1KB
and then try to munmap() it. The kernel would whine that it couldn't find
any such mapping (because mmap() actually rounded the 1KB to a 4KB page.)
This commit is contained in:
Andreas Kling 2019-02-17 08:32:08 +01:00
parent 82768e7ac5
commit 2dc0ef8813

View file

@ -134,6 +134,7 @@ bool Process::deallocate_region(Region& region)
Region* Process::region_from_range(LinearAddress laddr, size_t size)
{
size = PAGE_ROUND_UP(size);
for (auto& region : m_regions) {
if (region->laddr() == laddr && region->size() == size)
return region.ptr();