mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:37:34 +00:00
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:
parent
251293f2e1
commit
9e1fcb74a2
1 changed files with 2 additions and 0 deletions
|
@ -970,6 +970,7 @@ ShouldUnblockProcess Process::dispatch_signal(byte signal)
|
||||||
auto* region = allocate_region(LinearAddress(), PAGE_SIZE, "signal_trampoline", true, true);
|
auto* region = allocate_region(LinearAddress(), PAGE_SIZE, "signal_trampoline", true, true);
|
||||||
m_return_to_ring3_from_signal_trampoline = region->laddr();
|
m_return_to_ring3_from_signal_trampoline = region->laddr();
|
||||||
byte* code_ptr = m_return_to_ring3_from_signal_trampoline.as_ptr();
|
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++ = 0x5a; // pop edx
|
||||||
*code_ptr++ = 0xb8; // mov eax, <dword>
|
*code_ptr++ = 0xb8; // mov eax, <dword>
|
||||||
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;
|
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;
|
||||||
|
@ -983,6 +984,7 @@ ShouldUnblockProcess Process::dispatch_signal(byte signal)
|
||||||
*code_ptr++ = 0x0b;
|
*code_ptr++ = 0x0b;
|
||||||
|
|
||||||
m_return_to_ring0_from_signal_trampoline = LinearAddress((dword)code_ptr);
|
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++ = 0x5a; // pop edx
|
||||||
*code_ptr++ = 0xb8; // mov eax, <dword>
|
*code_ptr++ = 0xb8; // mov eax, <dword>
|
||||||
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;
|
*(dword*)code_ptr = Syscall::SC_restore_signal_mask;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue