mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Print a helpful panic message for READONLY_AFTER_INIT crashes
This commit is contained in:
parent
d8013c60bb
commit
a10accd48c
Notes:
sideshowbarker
2024-07-18 22:19:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a10accd48cb
1 changed files with 8 additions and 0 deletions
|
@ -53,6 +53,9 @@
|
|||
#include <Kernel/VM/ProcessPagingScope.h>
|
||||
#include <LibC/mallocdefs.h>
|
||||
|
||||
extern FlatPtr start_of_ro_after_init;
|
||||
extern FlatPtr end_of_ro_after_init;
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static DescriptorTablePointer s_idtr;
|
||||
|
@ -265,6 +268,11 @@ void page_fault_handler(TrapFrame* trap)
|
|||
handle_crash(regs, "Bad stack on page fault", SIGSTKFLT);
|
||||
}
|
||||
|
||||
if (fault_address >= (FlatPtr)&start_of_ro_after_init && fault_address < (FlatPtr)&end_of_ro_after_init) {
|
||||
dump(regs);
|
||||
PANIC("Attempt to write into READONLY_AFTER_INIT section");
|
||||
}
|
||||
|
||||
auto response = MM.handle_page_fault(PageFault(regs.exception_code, VirtualAddress(fault_address)));
|
||||
|
||||
if (response == PageFaultResponse::ShouldCrash || response == PageFaultResponse::OutOfMemory) {
|
||||
|
|
Loading…
Reference in a new issue