1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 10:27:35 +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:
Andreas Kling 2019-09-27 20:17:41 +02:00
parent d5f3972012
commit 2584636d19
4 changed files with 17 additions and 12 deletions

View file

@ -276,7 +276,7 @@ public:
Region* allocate_region(VirtualAddress, size_t, const String& name, int prot = PROT_READ | PROT_WRITE, bool commit = true);
bool deallocate_region(Region& region);
Region& allocate_split_region(const Region& source_region, const Range&);
Region& allocate_split_region(const Region& source_region, const Range&, size_t offset_in_vmo);
void set_being_inspected(bool b) { m_being_inspected = b; }
bool is_being_inspected() const { return m_being_inspected; }