From 2dc0ef8813f6197bc2c63dc8726dac9d3a2c2d7a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 17 Feb 2019 08:32:08 +0100 Subject: [PATCH] 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.) --- Kernel/Process.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index b0cb123af7..e5f7e2db5a 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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();