From: Ingo Molnar Date: Mon, 25 May 2015 08:57:06 +0000 (+0200) Subject: x86/fpu: Add debugging check to fpu__restore() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ce2a1e67f1738535b011a7b4bd42cc114b1d805f;p=linux-beck.git x86/fpu: Add debugging check to fpu__restore() The copy_fpstate_to_fpregs() function is never supposed to fail, so add a debugging check to its call site in fpu__restore(). Cc: Andy Lutomirski Cc: Bobby Powers Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 86a9a9a086fa..874ef1701750 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -371,6 +371,8 @@ void fpu__restore(struct fpu *fpu) kernel_fpu_disable(); fpregs_activate(fpu); if (unlikely(copy_fpstate_to_fpregs(fpu))) { + /* Copying the kernel state to FPU registers should never fail: */ + WARN_ON_FPU(1); fpu__clear(fpu); force_sig_info(SIGSEGV, SEND_SIG_PRIV, current); } else {