summaryrefslogtreecommitdiffstats
path: root/arch/arm64/lib/copy_in_user.S
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2016-07-01 15:58:21 +0200
committerCatalin Marinas <catalin.marinas@arm.com>2016-11-21 18:33:47 +0100
commitbd38967d406fb4f9fca67d612db71b5d74cfb0f5 (patch)
treefbcc9bd2e2f70c40387fe166de6f4e874c0d0bdb /arch/arm64/lib/copy_in_user.S
parentarm64: Update the synchronous external abort fault description (diff)
downloadlinux-bd38967d406fb4f9fca67d612db71b5d74cfb0f5.tar.xz
linux-bd38967d406fb4f9fca67d612db71b5d74cfb0f5.zip
arm64: Factor out PAN enabling/disabling into separate uaccess_* macros
This patch moves the directly coded alternatives for turning PAN on/off into separate uaccess_{enable,disable} macros or functions. The asm macros take a few arguments which will be used in subsequent patches. Note that any (unlikely) access that the compiler might generate between uaccess_enable() and uaccess_disable(), other than those explicitly specified by the user access code, will not be protected by PAN. Cc: Will Deacon <will.deacon@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Kees Cook <keescook@chromium.org> Reviewed-by: Mark Rutland <mark.rutland@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.S11
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
index f7292dd08c84..718b1c4e2f85 100644
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -18,11 +18,8 @@
#include <linux/linkage.h>
-#include <asm/alternative.h>
-#include <asm/assembler.h>
#include <asm/cache.h>
-#include <asm/cpufeature.h>
-#include <asm/sysreg.h>
+#include <asm/uaccess.h>
/*
* Copy from user space to user space (alignment handled by the hardware)
@@ -68,12 +65,10 @@
end .req x5
ENTRY(__copy_in_user)
-ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_ALT_PAN_NOT_UAO, \
- CONFIG_ARM64_PAN)
+ uaccess_enable_not_uao x3, x4
add end, x0, x2
#include "copy_template.S"
-ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
- CONFIG_ARM64_PAN)
+ uaccess_disable_not_uao x3
mov x0, #0
ret
ENDPROC(__copy_in_user)