From a9e436c4a3bc30e34212ec2ee6b52c76443f341d Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 30 Nov 2021 00:27:28 +0200 Subject: [PATCH] Kernel: Replace usages of SIGSTKFLT with SIGSEGV SIGSTKFLT is a signal that signifies a stack fault in a x87 coprocessor, this signal is not POSIX and also unused by Linux and the BSDs, so let's use SIGSEGV so programs that setup signal handlers for the common signals could still handle them in serenity. --- Kernel/Arch/x86/common/Interrupts.cpp | 2 +- Kernel/Memory/MemoryManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp index d355354ec4..0c2650ed9b 100644 --- a/Kernel/Arch/x86/common/Interrupts.cpp +++ b/Kernel/Arch/x86/common/Interrupts.cpp @@ -316,7 +316,7 @@ void page_fault_handler(TrapFrame* trap) VirtualAddress userspace_sp = VirtualAddress { regs.userspace_sp() }; if (!faulted_in_kernel && !MM.validate_user_stack(current_thread->process().address_space(), userspace_sp)) { dbgln("Invalid stack pointer: {}", userspace_sp); - handle_crash(regs, "Bad stack on page fault", SIGSTKFLT); + handle_crash(regs, "Bad stack on page fault", SIGSEGV); } if (fault_address >= (FlatPtr)&start_of_ro_after_init && fault_address < (FlatPtr)&end_of_ro_after_init) { diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 9d915078a1..42cd4e34f3 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -654,7 +654,7 @@ void MemoryManager::validate_syscall_preconditions(AddressSpace& space, Register VirtualAddress userspace_sp = VirtualAddress { regs.userspace_sp() }; if (!MM.validate_user_stack_no_lock(space, userspace_sp)) { dbgln("Invalid stack pointer: {}", userspace_sp); - unlock_and_handle_crash("Bad stack on syscall entry", SIGSTKFLT); + unlock_and_handle_crash("Bad stack on syscall entry", SIGSEGV); } }