mmu: correctly calculate size for unmap operations
Right now, we graciously accept - as does Linux - a mmap call for a size smaller than a page: we align it up, and serve it. But the same alignment is missing from unmap: so if the user rightfully tries to unmap using the same size, it will fail. The following test program succeeds on Linux but fails on OSv: int main () { void *ret = mmap(NULL, 64, PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0); if (ret == NULL) { return 1; } return munmap(ret, 64); } After this patch, it works for us as well. Reviewed-by:Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment