ARM: oabi-compat: copy semops using __copy_from_user()
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 9 Jul 2018 09:20:06 +0000 (10:20 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 2 Aug 2018 16:41:38 +0000 (17:41 +0100)
commit8c8484a1c18e3231648f5ba7cc5ffb7fd70b3ca4
tree9b153365e46226742f21870918e32c167519786e
parent42019fc50dfadb219f9e6ddf4c354f3837057d80
ARM: oabi-compat: copy semops using __copy_from_user()

__get_user_error() is used as a fast accessor to make copying structure
members 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.

Rather than using __get_user_error() to copy each semops element member,
copy each semops element in full using __copy_from_user().

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/sys_oabi-compat.c