1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

UserspaceEmulator: Exclude special ranges from RangeAllocator

If we do not mark these ranges as reserved, RangeAllocator might later
give us addresses that overlap these, which then causes an assertion
failure in the SoftMMU.  This behavior led to recurring CI failures, and
sometimes made programs as simple as `/bin/true` fail.

Fixes "Crash 1" reported in #9104
This commit is contained in:
Daniel Bertalan 2021-12-24 22:54:26 +01:00 committed by Idan Horowitz
parent 979f300337
commit 4e1898df99
4 changed files with 20 additions and 3 deletions

View file

@ -181,4 +181,11 @@ void RangeAllocator::deallocate(const Range& range)
}
}
void RangeAllocator::reserve_user_range(VirtualAddress begin, size_t size)
{
auto end = round_up_to_power_of_two(begin.offset(size).get(), PAGE_SIZE);
auto allocated_range = allocate_specific(begin.page_base(), end - begin.page_base().get());
VERIFY(allocated_range.has_value());
}
}