arm64: Use pointer masking to limit uaccess speculation
authorRobin Murphy <robin.murphy@arm.com>
Mon, 5 Feb 2018 15:34:19 +0000 (15:34 +0000)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:20 +0000 (18:46 +0800)
commitd8278416a1da7e0c5bb1ab5abc837254830b736a
tree18c910d72807fc11dc07bdeb53283e4fd0e95034
parentb32160ab74ea1bf6c11e96868c8230d6f3717e13
arm64: Use pointer masking to limit uaccess speculation

commit 4d8efc2d5ee4 upstream.

Similarly to x86, mitigate speculation past an access_ok() check by
masking the pointer against the address limit before use.

Even if we don't expect speculative writes per se, it is plausible that
a CPU may still speculate at least as far as fetching a cache line for
writing, hence we also harden put_user() and clear_user() for peace of
mind.

Signed-off-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>
arch/arm64/include/asm/uaccess.h