Kernel: Returning from a signal handler reset the signal mask correctly.

We were setting the handled signal number as the new signal mask, oops.
This commit is contained in:
Andreas Kling 2019-03-05 11:00:26 +01:00
parent 251293f2e1
commit 9e1fcb74a2
Notes: sideshowbarker 2024-07-19 15:33:05 +09:00

View file

@ -970,6 +970,7 @@ ShouldUnblockProcess Process::dispatch_signal(byte signal)
auto* region = allocate_region(LinearAddress(), PAGE_SIZE, "signal_trampoline", true, true);
m_return_to_ring3_from_signal_trampoline = region->laddr();
byte* code_ptr = m_return_to_ring3_from_signal_trampoline.as_ptr();
*code_ptr++ = 0x58; // pop eax (Skip over signal argument)
*code_ptr++ = 0x5a; // pop edx
*code_ptr++ = 0xb8; // mov eax, <dword>
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;
@ -983,6 +984,7 @@ ShouldUnblockProcess Process::dispatch_signal(byte signal)
*code_ptr++ = 0x0b;
m_return_to_ring0_from_signal_trampoline = LinearAddress((dword)code_ptr);
*code_ptr++ = 0x58; // pop eax (Skip over signal argument)
*code_ptr++ = 0x5a; // pop edx
*code_ptr++ = 0xb8; // mov eax, <dword>
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;