summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorJulien Thierry <julien.thierry@arm.com>2019-02-13 21:10:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 10:20:46 +0100
commitd5e5018179eada4f3d95d11fdfa1c9bd14595f0b (patch)
tree2a4bae23a1be371d637c7f40ba7cb116d49622a2 /arch/arm/lib
parent0d24778382b8c39e3af2d9a7a87e0f38438b7216 (diff)
downloadlinux-stable-d5e5018179eada4f3d95d11fdfa1c9bd14595f0b.tar.gz
linux-stable-d5e5018179eada4f3d95d11fdfa1c9bd14595f0b.tar.bz2
linux-stable-d5e5018179eada4f3d95d11fdfa1c9bd14595f0b.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"