Skip to content
Snippets Groups Projects
Commit 6f464e76 authored by Avi Kivity's avatar Avi Kivity
Browse files

mmu: don't pass really bad faults to the application

Trying to execute the null pointer, or faults within the kernel code, are
a really bad sign and it's better to abort early with them.
parent 0affe14a
No related branches found
No related tags found
No related merge requests found
......@@ -11,11 +11,13 @@ SECTIONS
. = 0x201000;
.dynamic : { *(.dynamic) } :dynamic :text
.text : {
text_start = .;
*(.text.hot .text.hot.*)
*(.text.unlikely .text.*_unlikely)
*(.text.fixup)
*(.text.startup .text.startup.*)
*(.text .text.*)
text_end = .;
} :text
. = ALIGN(8);
.fixup : {
......
......@@ -868,10 +868,18 @@ void switch_to_runtime_page_table()
void page_fault(exception_frame *ef)
{
extern const char text_start[], text_end[];
sched::exception_guard g;
auto addr = processor::read_cr2();
if (fixup_fault(ef)) {
return;
}
auto pc = reinterpret_cast<void*>(ef->rip);
if (!pc) {
abort("trying to execute null pointer");
}
if (pc >= text_start && pc < text_end) {
abort("page fault outside application");
}
osv::handle_segmentation_fault(addr, ef);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment