mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix insecure user-space pointer dereferences in sys_tfork.
This commit is contained in:
parent
08c11ee45c
commit
8f8f09ac82
1 changed files with 6 additions and 2 deletions
|
@ -930,8 +930,12 @@ cleanup_done:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pid_t sys_tfork(int flags, tforkregs_t* regs)
|
static pid_t sys_tfork(int flags, tforkregs_t* user_regs)
|
||||||
{
|
{
|
||||||
|
tforkregs_t regs;
|
||||||
|
if ( !CopyFromUser(®s, user_regs, sizeof(regs)) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
if ( Signal::IsPending() )
|
if ( Signal::IsPending() )
|
||||||
return errno = EINTR, -1;
|
return errno = EINTR, -1;
|
||||||
|
|
||||||
|
@ -940,7 +944,7 @@ static pid_t sys_tfork(int flags, tforkregs_t* regs)
|
||||||
return errno = ENOSYS, -1;
|
return errno = ENOSYS, -1;
|
||||||
|
|
||||||
CPU::InterruptRegisters cpuregs;
|
CPU::InterruptRegisters cpuregs;
|
||||||
InitializeThreadRegisters(&cpuregs, regs);
|
InitializeThreadRegisters(&cpuregs, ®s);
|
||||||
|
|
||||||
// TODO: Is it a hack to create a new kernel stack here?
|
// TODO: Is it a hack to create a new kernel stack here?
|
||||||
Thread* curthread = CurrentThread();
|
Thread* curthread = CurrentThread();
|
||||||
|
|
Loading…
Add table
Reference in a new issue