Kernel: Move end_of_kernel_image after the .ksyms section

Without this we won't be able to detect whether .ksyms overlaps the end
of the page table we set up for the kernel image.
This commit is contained in:
Gunnar Beutner 2021-07-16 09:50:34 +02:00 committed by Andreas Kling
commit cbdb488578
Notes: sideshowbarker 2024-07-18 08:55:46 +09:00
5 changed files with 38 additions and 5 deletions

View file

@ -29,6 +29,8 @@ extern FlatPtr start_of_unmap_after_init;
extern FlatPtr end_of_unmap_after_init;
extern FlatPtr start_of_ro_after_init;
extern FlatPtr end_of_ro_after_init;
extern FlatPtr start_of_kernel_ksyms;
extern FlatPtr end_of_kernel_ksyms;
namespace Kernel {
@ -335,6 +337,11 @@ void page_fault_handler(TrapFrame* trap)
PANIC("Attempt to access UNMAP_AFTER_INIT section");
}
if (fault_address >= (FlatPtr)&start_of_kernel_ksyms && fault_address < (FlatPtr)&end_of_kernel_ksyms) {
dump(regs);
PANIC("Attempt to access KSYMS section");
}
PageFault fault { regs.exception_code, VirtualAddress { fault_address } };
auto response = MM.handle_page_fault(fault);