page_fault_handler: do not try to fault addresses < 4k

There is no good reason to map these low addresses (userspace could with
mmap fixed, but that is grounds for many exploits...);

the main advantage however is if we do a null deref or close to (0->foo)
within a pagefault we will get a panic stack instead of getting a hang
because we cannot get some locks.
This commit is contained in:
Dominique Martinet
2017-10-05 10:42:13 +09:00
parent 217dd9c1e5
commit c3dfb1663d

View File

@ -1124,7 +1124,11 @@ static void page_fault_handler(void *fault_addr, uint64_t reason, void *regs)
cpu_enable_interrupt();
error = page_fault_process_vm(thread->vm, fault_addr, reason);
if ((uintptr_t)fault_addr < 4096) {
error = -EINVAL;
} else {
error = page_fault_process_vm(thread->vm, fault_addr, reason);
}
if (error) {
struct siginfo info;