1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

Kernel: Send SIGSEGV on seg-fault

Now programs can catch the SIGSEGV signal when they segfault.

This commit also introduced the send_urgent_signal_to_self method,
which is needed to send signals to a thread when handling exceptions
caused by the same thread.
This commit is contained in:
Drew Stratford 2019-10-07 22:22:50 +13:00 committed by Andreas Kling
parent 7fc903b97a
commit c136fd3fe2
3 changed files with 31 additions and 0 deletions

View file

@ -262,6 +262,11 @@ void exception_14_handler(RegisterDump& regs)
auto response = MM.handle_page_fault(PageFault(regs.exception_code, VirtualAddress(fault_address)));
if (response == PageFaultResponse::ShouldCrash) {
if(current->has_signal_handler(SIGSEGV)){
current->send_urgent_signal_to_self(SIGSEGV);
return;
}
kprintf("\033[31;1m%s(%u:%u) Unrecoverable page fault, %s address %p\033[0m\n",
current->process().name().characters(),
current->pid(),