[PATCH RT 08/13] x86/fpu: Disable preemption around local_bh_disable()

From: Steven Rostedt
Date: Mon Jan 07 2019 - 14:53:50 EST

4.14.87-rt50-rc1 stable review patch.
If anyone has any objections, please let me know.


From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

[ Upstream commit f70ac4a5ca5df1d84dae809453464eca16b54f51 ]

__fpu__restore_sig() restores the content of the FPU state in the CPUs
and in order to avoid concurency it disbles BH. On !RT it also disables
preemption but on RT we can get preempted in BH.

Add preempt_disable() while the FPU state is restored.

Cc: stable-rt@xxxxxxxxxxxxxxx
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
arch/x86/kernel/fpu/signal.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index d99a8ee9e185..5e0274a94133 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -344,10 +344,12 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);

+ preempt_disable();
fpu->initialized = 1;
+ preempt_enable();

return err;
} else {