summaryrefslogtreecommitdiffstats
path: root/arch/arm64/lib/copy_in_user.S
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2016-02-05 14:58:50 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2016-02-18 17:27:05 +0000
commit705441960033e66b63524521f153fbb28c99ddbd (patch)
treef24a8ab766c2e44e3aa5eaa49c852836023db055 /arch/arm64/lib/copy_in_user.S
parent644c2ae198412c956700e55a2acf80b2541f6aa5 (diff)
downloadblackbird-obmc-linux-705441960033e66b63524521f153fbb28c99ddbd.tar.gz
blackbird-obmc-linux-705441960033e66b63524521f153fbb28c99ddbd.zip
arm64: kernel: Don't toggle PAN on systems with UAO
If a CPU supports both Privileged Access Never (PAN) and User Access Override (UAO), we don't need to disable/re-enable PAN round all copy_to_user() like calls. UAO alternatives cause these calls to use the 'unprivileged' load/store instructions, which are overridden to be the privileged kind when fs==KERNEL_DS. This patch changes the copy_to_user() calls to have their PAN toggling depend on a new composite 'feature' ARM64_ALT_PAN_NOT_UAO. If both features are detected, PAN will be enabled, but the copy_to_user() alternatives will not be applied. This means PAN will be enabled all the time for these functions. If only PAN is detected, the toggling will be enabled as normal. This will save the time taken to disable/re-enable PAN, and allow us to catch copy_to_user() accesses that occur with fs==KERNEL_DS. Futex and swp-emulation code continue to hang their PAN toggling code on ARM64_HAS_PAN. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/lib/copy_in_user.S')
-rw-r--r--arch/arm64/lib/copy_in_user.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
index feaad1520dc1..f7292dd08c84 100644
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -68,11 +68,11 @@
end .req x5
ENTRY(__copy_in_user)
-ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_HAS_PAN, \
+ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_ALT_PAN_NOT_UAO, \
CONFIG_ARM64_PAN)
add end, x0, x2
#include "copy_template.S"
-ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \
+ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
CONFIG_ARM64_PAN)
mov x0, #0
ret
OpenPOWER on IntegriCloud