Some of the tests in testbin/sbrktest
will purposely attempt to access invalid memory regions (outside of the heap). These tests say that you should expect a SEGFAULT
to be thrown.
The thing is, my vm_fault()
is detecting that the address is a SEGFAULT and in this case, vm_fault()
returns EFAULT
. Back in mips_trap()
though, a proper SEGFAULT
is not being triggered and instead it’s evaluating into the following statement…
/*
* If we get to this point, it's a fatal fault - either it's
* one of the other exceptions, like illegal instruction, or
* it was a page fault we couldn't handle.
*/
if (!iskern) {
/*
* Fatal fault in user mode.
* Kill the current user process.
*/
kill_curthread(tf->tf_epc, code, tf->tf_vaddr);
goto done;
}
What do I need to do differently to make sure I throw a proper SEGFAULT
in these cases? Do I need to add logic to mips_trap()
?