ARM: 7419/1: vfp: fix VFP flushing regression on sigreturn path
authorWill Deacon <will.deacon@arm.com>
Tue, 15 May 2012 14:51:54 +0000 (15:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 17 May 2012 13:48:56 +0000 (14:48 +0100)
commit67f681e8a54892eab84c0d3dc6d246f884603895
treebd1ab001b446712e5741220d80ce8c877b9e6482
parente2907e9c97d792cd8cb56ea8cae3981a86f0e630
ARM: 7419/1: vfp: fix VFP flushing regression on sigreturn path

Commit 422f8be1 ("ARM: 7400/1: vfp: clear fpscr length and stride bits
on entry to sig handler") flushes the VFP state prior to entering a
signal handler so that a VFP operation inside the handler will trap and
force a restore of ABI-compliant registers. Reflushing and disabling VFP
on the sigreturn path is predicated on the saved thread state indicating
that VFP was used by the handler -- however for SMP platforms this is
only set on context-switch, making the check unreliable and causing VFP
register corruption in userspace since the register values are not
necessarily those restored from the sigframe.

This patch unconditionally flushes the VFP state after a signal handler.
Since we already perform the flush before the handler and the flushing
itself happens lazily, the redundant flush when VFP is not used by the
handler is essentially a nop.

Reported-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/vfp/vfpmodule.c