arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user
authorMark Rutland <mark.rutland@arm.com>
Thu, 12 Apr 2018 11:11:04 +0000 (12:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Apr 2018 06:20:43 +0000 (08:20 +0200)
commit4c03928fd68a710ec55b7a07a4e65d2f438a1256
tree0bffd156cc2b9133bac70fd3997374777cd97a8c
parent346edd61ce1ce5f2a2a3e81518d86b2b239ed4d4
arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user

From: Will Deacon <will.deacon@arm.com>

commit 84624087dd7e3b482b7b11c170ebc1f329b3a218 upstream.

access_ok isn't an expensive operation once the addr_limit for the current
thread has been loaded into the cache. Given that the initial access_ok
check preceding a sequence of __{get,put}_user operations will take
the brunt of the miss, we can make the __* variants identical to the
full-fat versions, which brings with it the benefits of address masking.

The likely cost in these sequences will be from toggling PAN/UAO, which
we can address later by implementing the *_unsafe versions.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com> [v4.9 backport]
Tested-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/uaccess.h