kernel: Mask away unsafe bits in rflags when restoring state after a signal
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
89786d8be2
commit
f9003d7a58
@ -150,6 +150,8 @@ void Thread::sigreturn(Registers* current_regs)
|
||||
{
|
||||
memcpy(®s, current_regs, sizeof(regs));
|
||||
|
||||
u64 rflags = current_regs->rflags;
|
||||
|
||||
u64 rsp;
|
||||
pop_mem_from_stack((u8*)&rsp, sizeof(rsp));
|
||||
regs.rsp = rsp;
|
||||
@ -159,8 +161,7 @@ void Thread::sigreturn(Registers* current_regs)
|
||||
memcpy(®s, current_regs, sizeof(regs));
|
||||
regs.cs = 0x18 | 3;
|
||||
regs.ss = 0x20 | 3;
|
||||
// FIXME: Using this, a program can craft a special RFLAGS that gives them a higher IOPL or other stuff. Find out
|
||||
// exactly what bits to block from modifying.
|
||||
regs.rflags = (rflags & ~0xdff) | (regs.rflags & 0xdff);
|
||||
|
||||
fp_data.restore();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user