From 89502fc329cd9591f95741f234a86ab0928ea52a Mon Sep 17 00:00:00 2001 From: Rummskartoffel Date: Sat, 8 Jan 2022 20:46:59 +0100 Subject: [PATCH] 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(). --- Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index 6672409ef4..442efb2cbf 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -866,6 +866,7 @@ u32 Emulator::virt$mmap(u32 params_addr) { Syscall::SC_mmap_params params; mmu().copy_from_vm(¶ms, 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;