UserspaceEmulator: Interpret zero-alignment as page-sized alignment

This commit fixes an issue where zero-alignment would lead to the
requested range being allocated outside of the total available range,
hitting an assert in RangeAllocator::allocate_anywhere().
This commit is contained in:
Rummskartoffel 2022-01-08 20:46:59 +01:00 committed by Andreas Kling
parent 963b0f76cf
commit 89502fc329

View file

@ -866,6 +866,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
{
Syscall::SC_mmap_params params;
mmu().copy_from_vm(&params, params_addr, sizeof(params));
params.alignment = params.alignment ? params.alignment : PAGE_SIZE;
u32 requested_size = round_up_to_power_of_two(params.size, PAGE_SIZE);
FlatPtr final_address;