arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user
authorWill Deacon <will.deacon@arm.com>
Mon, 5 Feb 2018 15:34:22 +0000 (15:34 +0000)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:22 +0000 (18:46 +0800)
commit0de9e9c895a4ae48fa972747e75323d8ed25d167
tree3e897cc840ad8222731c056b9255db492e4a3437
parentf46d204859360f3a94a68574f7ae7ea753959493
arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user

commit 84624087dd7e 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: Alex Shi <alex.shi@linaro.org>
Conflicts:
keep __{get/put}_user_unaligned in arch/arm64/include/asm/uaccess.h
arch/arm64/include/asm/uaccess.h