aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2013-09-27 09:04:41 +0100
committerMark Brown <broonie@linaro.org>2014-05-14 12:16:48 +0100
commit47b1e20b206944ea097b775e0e4a569f8bdeeb7c (patch)
treed578318f0ffaeaea06214bbf90d0aaffa231e802
parent6c0ab8b35469a97968c1482b14106afa8db3d743 (diff)
downloadlinux-linaro-stable-47b1e20b206944ea097b775e0e4a569f8bdeeb7c.tar.gz
arm64: fix possible invalid FPSIMD initialization state
commit 6db83cea1c975b9a102e17def7d2795814e1ae2b upstream. If context switching happens during executing fpsimd_flush_thread(), stale value in FPSIMD registers will be saved into current thread's fpsimd_state by fpsimd_thread_switch(). That may cause invalid initialization state for the new process, so disable preemption when executing fpsimd_flush_thread(). Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: Jiang Liu <liuj97@gmail.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 2bf5861acf602fe6201ac1f82955ac7283e56b6f) Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--arch/arm64/kernel/fpsimd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index e8b8357aedb4..2fa308e4a1fa 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -79,8 +79,10 @@ void fpsimd_thread_switch(struct task_struct *next)
void fpsimd_flush_thread(void)
{
+ preempt_disable();
memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
fpsimd_load_state(&current->thread.fpsimd_state);
+ preempt_enable();
}
/*