Chapter 7: Oops! Interpreting the Kernel Bug Diagnostic
Kernel code is supposed to be perfect. It mustn't ever crash. But, of course, it does on occasion... Welcome to the real world.
When userspace code hits a (typical) bug – an invalid memory access, say – the processor's Memory Management Unit (MMU), upon failing to translate the invalid userspace virtual address to a physical one (via the process context's paging tables), raises a fault. The fault handler within the kernel then takes control. It ultimately (and typically) results in a fatal signal (often, SIGSEGV
) being sent to the faulting process (or thread). This, of course, has the process possibly handle the signal and terminate.
Now take exactly the same case – except that this time, the invalid memory access occurs in kernel space (in kernel mode)! Hey, that's not supposed to happen, right? True, but bugs do happen, within kernel space too. This time, the kernel fault handler...