Kernel: Don't panic when stack trace leads to GPF

if there is was a uncanonical address in stack trace we ended up in an
infinite recursive loop trying to print stack trace
This commit is contained in:
2026-05-25 02:19:56 +03:00
parent 43d03eb4a9
commit 585e021c7f

View File

@@ -256,6 +256,18 @@ namespace Kernel
break; break;
} }
case ISR::GeneralProtectionFault:
{
const uint8_t* ip = reinterpret_cast<const uint8_t*>(interrupt_stack->ip);
for (const auto& safe_user : s_safe_user_page_faults)
{
if (ip < safe_user.ip_start || ip >= safe_user.ip_end)
continue;
interrupt_stack->ip = reinterpret_cast<vaddr_t>(safe_user.ip_fault);
return;
}
break;
}
case ISR::DeviceNotAvailable: case ISR::DeviceNotAvailable:
{ {
if (pid == 0 || !Thread::current().is_userspace()) if (pid == 0 || !Thread::current().is_userspace())