From 6048df4e91668b2a95d3da50d8f9a66e4f932945 Mon Sep 17 00:00:00 2001 From: vasilito Date: Thu, 9 Jul 2026 20:39:47 +0300 Subject: [PATCH] kernel: remove todo!() on NonfatalInternalError in page fault handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page fault handler for user-mode faults had a separate arms for Segv, RecursionLimitExceeded, and NonfatalInternalError from try_correcting_page_tables. The first two fell through to return Segv to the process; NonfatalInternalError called todo!() which causes a kernel panic. This is a kernel-level crash triggered by a userspace page table correction attempt that reports an internal (non-fatal) error. Fix: collapse NonfatalInternalError into the same fall-through arm as Segv and RecursionLimitExceeded. The error name says 'nonfatal' — it should not crash the kernel. The userspace process receives a segmentation fault signal instead. --- src/memory/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/memory/mod.rs b/src/memory/mod.rs index 393ae7ebd9..ac4064cac5 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -1028,8 +1028,7 @@ pub fn page_fault_handler( match context::memory::try_correcting_page_tables(faulting_page, mode, &mut token) { Ok(()) => return Ok(()), Err(PfError::Oom) => todo!("oom"), - Err(PfError::Segv | PfError::RecursionLimitExceeded) => (), - Err(PfError::NonfatalInternalError) => todo!(), + Err(PfError::Segv | PfError::RecursionLimitExceeded | PfError::NonfatalInternalError) => (), } }