summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorJulien Thierry <julien.thierry@arm.com>2019-02-14 09:49:21 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 10:18:26 +0100
commitb5d788516d936b3eabaed9d2df492eac95ac7e17 (patch)
tree4511a03b3ff4186e1202d5ae4d22fbce801d83ba /arch/arm/lib
parent17e3a84090784f814096f8c41cd21fbe40dcf565 (diff)
downloadlinux-stable-b5d788516d936b3eabaed9d2df492eac95ac7e17.tar.gz
linux-stable-b5d788516d936b3eabaed9d2df492eac95ac7e17.tar.bz2
linux-stable-b5d788516d936b3eabaed9d2df492eac95ac7e17.zip
ARM: 8796/1: spectre-v1,v1.1: provide helpers for address sanitization
Commit afaf6838f4bc896a711180b702b388b8cfa638fc upstream. Introduce C and asm helpers to sanitize user address, taking the address range they target into account. Use asm helper for existing sanitization in __copy_from_user(). Signed-off-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David A. Long <dave.long@linaro.org> Reviewed-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/copy_from_user.S6
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S
index a826df3d3814..6709a8d33963 100644
--- a/arch/arm/lib/copy_from_user.S
+++ b/arch/arm/lib/copy_from_user.S
@@ -93,11 +93,7 @@ ENTRY(arm_copy_from_user)
#ifdef CONFIG_CPU_SPECTRE
get_thread_info r3
ldr r3, [r3, #TI_ADDR_LIMIT]
- adds ip, r1, r2 @ ip=addr+size
- sub r3, r3, #1 @ addr_limit - 1
- cmpcc ip, r3 @ if (addr+size > addr_limit - 1)
- movcs r1, #0 @ addr = NULL
- csdb
+ uaccess_mask_range_ptr r1, r2, r3, ip
#endif
#include "copy_template.S"