diff options
| author | Jiang Liu <jiang.liu@huawei.com> | 2013-09-27 04:04:41 -0400 |
|---|---|---|
| committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-09-27 13:21:37 -0400 |
| commit | 6db83cea1c975b9a102e17def7d2795814e1ae2b (patch) | |
| tree | 8bb027ee7d2738649783800354f88de59580d9cd | |
| parent | fc18047c732f6becba92618a397555927687efd3 (diff) | |
arm64: fix possible invalid FPSIMD initialization state
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>
| -rw-r--r-- | arch/arm64/kernel/fpsimd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 1f2e4d5a5c0f..bb785d23dbde 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c | |||
| @@ -80,8 +80,10 @@ void fpsimd_thread_switch(struct task_struct *next) | |||
| 80 | 80 | ||
| 81 | void fpsimd_flush_thread(void) | 81 | void fpsimd_flush_thread(void) |
| 82 | { | 82 | { |
| 83 | preempt_disable(); | ||
| 83 | memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); | 84 | memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); |
| 84 | fpsimd_load_state(¤t->thread.fpsimd_state); | 85 | fpsimd_load_state(¤t->thread.fpsimd_state); |
| 86 | preempt_enable(); | ||
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | #ifdef CONFIG_KERNEL_MODE_NEON | 89 | #ifdef CONFIG_KERNEL_MODE_NEON |
