Kernel: pass FPU restore exception to user process

Previously, user processes could cause a kernel panic upon FPU state
restore, by passing bogus FPU state to the kernel (through e.g.
sigreturn). With this patch, the process is now sent a SIGFPE signal
instead.
This commit is contained in:
David van Moolenbroek
2012-03-03 19:25:57 +01:00
parent 4b6a98de5f
commit 0a8a2ecfb5
10 changed files with 125 additions and 13 deletions

View File

@@ -1885,7 +1885,15 @@ PUBLIC void copr_not_available_handler(void)
* restore the current process' state and let it run again, do not
* schedule!
*/
restore_fpu(p);
if (restore_fpu(p) != OK) {
/* Restoring FPU state failed. This is always the process's own
* fault. Send a signal, and schedule another process instead.
*/
*local_fpu_owner = NULL;
cause_sig(proc_nr(p), SIGFPE);
return;
}
*local_fpu_owner = p;
context_stop(proc_addr(KERNEL));
restore_user_context(p);