kernel: Make sure addresses allocated by mmap() are ALWAYS page-aligned
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Fixes a kernel crash. Thanks a lot, sysfuzz!
This commit is contained in:
parent
04322d9ff7
commit
36e6787415
@ -41,9 +41,9 @@ Result<u64> sys_mmap(Registers*, SyscallArgs args)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FIXME: We should be more flexible if MAP_FIXED was not specified.
|
// FIXME: We should be more flexible if MAP_FIXED was not specified.
|
||||||
if (!TRY(current->vm_allocator->test_and_alloc_region((u64)addr, get_blocks_from_size(len, ARCH_PAGE_SIZE))))
|
address = align_down<ARCH_PAGE_SIZE>((u64)addr);
|
||||||
|
if (!TRY(current->vm_allocator->test_and_alloc_region(address, get_blocks_from_size(len, ARCH_PAGE_SIZE))))
|
||||||
return err(ENOMEM);
|
return err(ENOMEM);
|
||||||
address = (u64)addr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mmu_flags = MMU::User | MMU::NoExecute;
|
int mmu_flags = MMU::User | MMU::NoExecute;
|
||||||
|
Loading…
Reference in New Issue
Block a user