[MIPS] Disallow CpU exception in kernel again.
The commit 4d40bff7110e9e1a97ff8c01bdd6350e9867cc10 ("Allow CpU exception in kernel partially") was broken. The commit was to fix theoretical problem but broke usual case. Revert it for now. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:

committed by
Ralf Baechle

parent
9a9943575a
commit
5323180db7
@@ -113,10 +113,10 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
|
||||
* Save FPU state to signal context. Signal handler
|
||||
* will "inherit" current FPU state.
|
||||
*/
|
||||
preempt_disable();
|
||||
own_fpu(1);
|
||||
enable_fp_in_kernel();
|
||||
err |= save_fp_context(sc);
|
||||
disable_fp_in_kernel();
|
||||
preempt_enable();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -148,7 +148,10 @@ check_and_restore_fp_context(struct sigcontext __user *sc)
|
||||
err = sig = fpcsr_pending(&sc->sc_fpc_csr);
|
||||
if (err > 0)
|
||||
err = 0;
|
||||
preempt_disable();
|
||||
own_fpu(0);
|
||||
err |= restore_fp_context(sc);
|
||||
preempt_enable();
|
||||
return err ?: sig;
|
||||
}
|
||||
|
||||
@@ -187,11 +190,8 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
|
||||
|
||||
if (used_math) {
|
||||
/* restore fpu context if we have used it before */
|
||||
own_fpu(0);
|
||||
enable_fp_in_kernel();
|
||||
if (!err)
|
||||
err = check_and_restore_fp_context(sc);
|
||||
disable_fp_in_kernel();
|
||||
} else {
|
||||
/* signal handler may have used FPU. Give it up. */
|
||||
lose_fpu(0);
|
||||
|
Reference in New Issue
Block a user