From becfa228fe3c83ce382318a5b9f47237a3db9282 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 26 May 2026 02:17:08 +0300 Subject: [PATCH] Kernel: fix signal handler block mask restoration --- kernel/arch/i686/Signal.S | 2 +- kernel/arch/x86_64/Signal.S | 2 +- kernel/kernel/Thread.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/arch/i686/Signal.S b/kernel/arch/i686/Signal.S index bd75d449..47b08305 100644 --- a/kernel/arch/i686/Signal.S +++ b/kernel/arch/i686/Signal.S @@ -59,7 +59,7 @@ signal_trampoline: addl $24, %esp // restore sigmask - movl $83, %eax // SYS_SIGPROCMASK + movl $79, %eax // SYS_SIGPROCMASK movl $3, %ebx // SIG_SETMASK leal 72(%esp), %ecx // set xorl %edx, %edx // oset diff --git a/kernel/arch/x86_64/Signal.S b/kernel/arch/x86_64/Signal.S index ca9e979a..27ca40de 100644 --- a/kernel/arch/x86_64/Signal.S +++ b/kernel/arch/x86_64/Signal.S @@ -61,7 +61,7 @@ signal_trampoline: addq $40, %rsp // restore sigmask - movq $83, %rdi // SYS_SIGPROCMASK + movq $79, %rdi // SYS_SIGPROCMASK movq $3, %rsi // SIG_SETMASK leaq 192(%rsp), %rdx // set xorq %r10, %r10 // oset diff --git a/kernel/kernel/Thread.cpp b/kernel/kernel/Thread.cpp index b6d2ac5a..b54e6aa5 100644 --- a/kernel/kernel/Thread.cpp +++ b/kernel/kernel/Thread.cpp @@ -10,10 +10,14 @@ #include #include #include +#include namespace Kernel { + static_assert(SYS_SIGPROCMASK == 79, "this is hard coded in arch/*/Signal.S"); + static_assert(SIG_SETMASK == 3, "this is hard coded in arch/*/Signal.S"); + #if ARCH(x86_64) static constexpr vaddr_t s_user_stack_addr_start = 0x0000700000000000; #elif ARCH(i686)