diff --git a/Kernel/Syscalls/futex.cpp b/Kernel/Syscalls/futex.cpp index bee8bf9bef..61c64dd3b8 100644 --- a/Kernel/Syscalls/futex.cpp +++ b/Kernel/Syscalls/futex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,6 @@ */ #include -#include #include #include #include @@ -145,9 +144,7 @@ int Process::sys$futex(Userspace user_params) // acquiring the queue lock RefPtr vmobject, vmobject2; if (!is_private) { - if (!Kernel::is_user_range(VirtualAddress(user_address_or_offset), sizeof(u32))) - return -EFAULT; - auto region = MM.find_region_from_vaddr(space(), VirtualAddress(user_address_or_offset)); + auto region = space().find_region_containing(Range { VirtualAddress { user_address_or_offset }, sizeof(u32) }); if (!region) return -EFAULT; vmobject = region->vmobject(); @@ -157,9 +154,7 @@ int Process::sys$futex(Userspace user_params) case FUTEX_REQUEUE: case FUTEX_CMP_REQUEUE: case FUTEX_WAKE_OP: { - if (!Kernel::is_user_range(VirtualAddress(user_address_or_offset2), sizeof(u32))) - return -EFAULT; - auto region2 = MM.find_region_from_vaddr(space(), VirtualAddress(user_address_or_offset2)); + auto region2 = space().find_region_containing(Range { VirtualAddress { user_address_or_offset2 }, sizeof(u32) }); if (!region2) return -EFAULT; vmobject2 = region2->vmobject(); diff --git a/Kernel/Syscalls/get_stack_bounds.cpp b/Kernel/Syscalls/get_stack_bounds.cpp index a1b115ec3c..90f1561376 100644 --- a/Kernel/Syscalls/get_stack_bounds.cpp +++ b/Kernel/Syscalls/get_stack_bounds.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,14 +25,14 @@ */ #include -#include +#include namespace Kernel { int Process::sys$get_stack_bounds(FlatPtr* user_stack_base, size_t* user_stack_size) { FlatPtr stack_pointer = Thread::current()->get_register_dump_from_stack().userspace_esp; - auto* stack_region = MM.find_region_from_vaddr(space(), VirtualAddress(stack_pointer)); + auto* stack_region = space().find_region_containing(Range { VirtualAddress(stack_pointer), 1 }); if (!stack_region) { ASSERT_NOT_REACHED(); return -EINVAL;