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

Kernel + LibPthread: Use Userspace<T> in the create_thread syscall

This commit is contained in:
Brian Gianforcaro 2020-08-05 00:11:56 -07:00 committed by Andreas Kling
parent 337e8f98cd
commit 7490ea9449
4 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@
namespace Kernel {
int Process::sys$create_thread(void* (*entry)(void*), const Syscall::SC_create_thread_params* user_params)
int Process::sys$create_thread(void* (*entry)(void*), Userspace<const Syscall::SC_create_thread_params*> user_params)
{
REQUIRE_PROMISE(thread);
if (!validate_read((const void*)entry, sizeof(void*)))
@ -45,13 +45,13 @@ int Process::sys$create_thread(void* (*entry)(void*), const Syscall::SC_create_t
unsigned detach_state = params.m_detach_state;
int schedule_priority = params.m_schedule_priority;
void* stack_location = params.m_stack_location;
Userspace<void*> stack_location = params.m_stack_location;
unsigned stack_size = params.m_stack_size;
if (!validate_write(stack_location, stack_size))
return -EFAULT;
u32 user_stack_address = reinterpret_cast<u32>(stack_location) + stack_size;
u32 user_stack_address = reinterpret_cast<u32>(stack_location.ptr()) + stack_size;
if (!MM.validate_user_stack(*this, VirtualAddress(user_stack_address - 4)))
return -EFAULT;