mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 10:05:10 +00:00
Kernel: Fix partial munmap() deallocating still-in-use VM
We were always returning the full VM range of the partially-unmapped Region to the range allocator. This caused us to re-use those addresses for subsequent VM allocations. This patch also skips creating a new VMObject in partial munmap(). Instead we just make split regions that point into the same VMObject. This fixes the mysterious GCC ICE on large C++ programs.
This commit is contained in:
parent
d5f3972012
commit
2584636d19
4 changed files with 17 additions and 12 deletions
|
@ -705,7 +705,7 @@ void MemoryManager::map_region_at_address(PageDirectory& page_directory, Region&
|
|||
}
|
||||
}
|
||||
|
||||
bool MemoryManager::unmap_region(Region& region)
|
||||
bool MemoryManager::unmap_region(Region& region, bool deallocate_range)
|
||||
{
|
||||
ASSERT(region.page_directory());
|
||||
InterruptDisabler disabler;
|
||||
|
@ -722,7 +722,8 @@ bool MemoryManager::unmap_region(Region& region)
|
|||
dbgprintf("MM: >> Unmapped V%p => P%p <<\n", vaddr, physical_page ? physical_page->paddr().get() : 0);
|
||||
#endif
|
||||
}
|
||||
region.page_directory()->range_allocator().deallocate({ region.vaddr(), region.size() });
|
||||
if (deallocate_range)
|
||||
region.page_directory()->range_allocator().deallocate(region.range());
|
||||
region.release_page_directory();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue