Skip to content

Commit 8dffe13

Browse files
committed
Handle low/zero addresses better during page faults
1 parent f432996 commit 8dffe13

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/tinykvm/vcpu_run.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ long vCPU::run_once()
223223
auto& memory = machine().main_memory();
224224
if (UNLIKELY(regs.rip >= memory.physbase + INTR_ASM_ADDR+0x1000)) {
225225
Machine::machine_exception("Security violation", intr);
226+
} else if (UNLIKELY(addr < 0x2000)) {
227+
/* Kernel space page fault */
228+
this->handle_exception(intr);
229+
Machine::machine_exception("Kernel or zero page fault", intr);
226230
}
227231

228232
machine().memory.get_writable_page(addr, PDE64_USER | PDE64_RW, false);

0 commit comments

Comments
 (0)