aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/assembler.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-09-07 07:22:06 -0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-12-06 18:14:00 +0100
commitbd690a3f314893040876db9ffa623058ce2e9164 (patch)
tree3159002269180576ab22b0e1e044767f3050a907 /arch/arm/include/asm/assembler.h
parent68ee93f3d058ff58f994d08be00d3aad9ec20970 (diff)
downloadkernel_samsung_smdk4412-bd690a3f314893040876db9ffa623058ce2e9164.zip
kernel_samsung_smdk4412-bd690a3f314893040876db9ffa623058ce2e9164.tar.gz
kernel_samsung_smdk4412-bd690a3f314893040876db9ffa623058ce2e9164.tar.bz2
ARM: 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS
commit 8404663 upstream. The {get,put}_user macros don't perform range checking on the provided __user address when !CPU_HAS_DOMAINS. This patch reworks the out-of-line assembly accessors to check the user address against a specified limit, returning -EFAULT if is is out of range. [will: changed get_user register allocation to match put_user] [rmk: fixed building on older ARM architectures] Reported-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> [bwh: Backported to 3.2: TUSER() was called T()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> [steven@steven676.net: make apply to 3.0] Tested-by: Moritz Bandemer <replicant@posteo.mx>
Diffstat (limited to 'arch/arm/include/asm/assembler.h')
-rw-r--r--arch/arm/include/asm/assembler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 7bb8bf9..456649e 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -299,6 +299,14 @@
usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort
.endm
+ .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
+#ifndef CONFIG_CPU_USE_DOMAINS
+ adds \tmp, \addr, #\size - 1
+ sbcccs \tmp, \tmp, \limit
+ bcs \bad
+#endif
+ .endm
+
/* Utility macro for declaring string literals */
.macro string name:req, string
.type \name , #object