ARM: 7308/1: vfp: flush thread hwstate before copying ptrace registers
authorWill Deacon <will.deacon@arm.com>
Mon, 30 Jan 2012 19:23:29 +0000 (20:23 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 2 Feb 2012 17:37:42 +0000 (17:37 +0000)
If we are context switched whilst copying into a thread's
vfp_hard_struct then the partial copy may be corrupted by the VFP
context switching code (see "ARM: vfp: flush thread hwstate before
restoring context from sigframe").

This patch updates the ptrace VFP set code so that the thread state is
flushed before the copy, therefore disabling VFP and preventing
corruption from occurring.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/ptrace.c

index d001be4e0ce16896539c70ccced6e0887400d2a6..e33870ff0ac092b25e31a49e3074899ee0ac6339 100644 (file)
@@ -726,8 +726,8 @@ static int vfp_set(struct task_struct *target,
        if (ret)
                return ret;
 
-       thread->vfpstate.hard = new_vfp;
        vfp_flush_hwstate(thread);
+       thread->vfpstate.hard = new_vfp;
 
        return 0;
 }