ARM: vfp: use __copy_from_user() when restoring VFP state
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 7 Nov 2018 16:43:58 +0000 (11:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Nov 2018 07:20:39 +0000 (08:20 +0100)
commit9c91b9687904d28ad29974ce9028bb6a6088527f
tree377b67a6e4c4afd55564c4db5dd1a5e23bb64340
parent50f032cc506a0f8c5a44c2f19950ae0f287b43db
ARM: vfp: use __copy_from_user() when restoring VFP state

Commit 42019fc50dfadb219f9e6ddf4c354f3837057d80 upstream.

__get_user_error() is used as a fast accessor to make copying structure
members in the signal handling path as efficient as possible.  However,
with software PAN and the recent Spectre variant 1, the efficiency is
reduced as these are no longer fast accessors.

In the case of software PAN, it has to switch the domain register around
each access, and with Spectre variant 1, it would have to repeat the
access_ok() check for each access.

Use __copy_from_user() rather than __get_user_err() for individual
members when restoring VFP state.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David A. Long <dave.long@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/thread_info.h
arch/arm/kernel/signal.c
arch/arm/vfp/vfpmodule.c