Kernel: Show the unmapped-after-init symbol being accessed

This makes it a lot easier to figure out what unmapped function is being
accessed, and a lot easier to reason about _why_ it is being accessed.
This commit is contained in:
Ali Mohammad Pur 2021-07-26 13:52:05 +04:30 committed by Gunnar Beutner
parent c95ac83367
commit 306d898ee5
Notes: sideshowbarker 2024-07-18 08:19:50 +09:00

View File

@ -24,6 +24,7 @@
#include <Kernel/Arch/x86/Processor.h>
#include <Kernel/Arch/x86/RegisterState.h>
#include <Kernel/Arch/x86/TrapFrame.h>
#include <Kernel/KSyms.h>
extern FlatPtr start_of_unmap_after_init;
extern FlatPtr end_of_unmap_after_init;
@ -323,7 +324,8 @@ void page_fault_handler(TrapFrame* trap)
if (fault_address >= (FlatPtr)&start_of_unmap_after_init && fault_address < (FlatPtr)&end_of_unmap_after_init) {
dump(regs);
PANIC("Attempt to access UNMAP_AFTER_INIT section");
auto sym = symbolicate_kernel_address(fault_address);
PANIC("Attempt to access UNMAP_AFTER_INIT section ({:#p}: {})", fault_address, sym ? sym->name : "(Unknown)");
}
if (fault_address >= (FlatPtr)&start_of_kernel_ksyms && fault_address < (FlatPtr)&end_of_kernel_ksyms) {