]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.16.4/mips-uaccess-add-micromips-clobbers-to-bzero-invocation.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.16.4 / mips-uaccess-add-micromips-clobbers-to-bzero-invocation.patch
1 From b3d7e55c3f886493235bfee08e1e5a4a27cbcce8 Mon Sep 17 00:00:00 2001
2 From: Matt Redfearn <matt.redfearn@mips.com>
3 Date: Tue, 17 Apr 2018 16:40:01 +0100
4 Subject: MIPS: uaccess: Add micromips clobbers to bzero invocation
5
6 From: Matt Redfearn <matt.redfearn@mips.com>
7
8 commit b3d7e55c3f886493235bfee08e1e5a4a27cbcce8 upstream.
9
10 The micromips implementation of bzero additionally clobbers registers t7
11 & t8. Specify this in the clobbers list when invoking bzero.
12
13 Fixes: 26c5e07d1478 ("MIPS: microMIPS: Optimise 'memset' core library function.")
14 Reported-by: James Hogan <jhogan@kernel.org>
15 Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
16 Cc: Ralf Baechle <ralf@linux-mips.org>
17 Cc: linux-mips@linux-mips.org
18 Cc: <stable@vger.kernel.org> # 3.10+
19 Patchwork: https://patchwork.linux-mips.org/patch/19110/
20 Signed-off-by: James Hogan <jhogan@kernel.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 arch/mips/include/asm/uaccess.h | 11 +++++++++--
25 1 file changed, 9 insertions(+), 2 deletions(-)
26
27 --- a/arch/mips/include/asm/uaccess.h
28 +++ b/arch/mips/include/asm/uaccess.h
29 @@ -654,6 +654,13 @@ __clear_user(void __user *addr, __kernel
30 {
31 __kernel_size_t res;
32
33 +#ifdef CONFIG_CPU_MICROMIPS
34 +/* micromips memset / bzero also clobbers t7 & t8 */
35 +#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
36 +#else
37 +#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
38 +#endif /* CONFIG_CPU_MICROMIPS */
39 +
40 if (eva_kernel_access()) {
41 __asm__ __volatile__(
42 "move\t$4, %1\n\t"
43 @@ -663,7 +670,7 @@ __clear_user(void __user *addr, __kernel
44 "move\t%0, $6"
45 : "=r" (res)
46 : "r" (addr), "r" (size)
47 - : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
48 + : bzero_clobbers);
49 } else {
50 might_fault();
51 __asm__ __volatile__(
52 @@ -674,7 +681,7 @@ __clear_user(void __user *addr, __kernel
53 "move\t%0, $6"
54 : "=r" (res)
55 : "r" (addr), "r" (size)
56 - : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
57 + : bzero_clobbers);
58 }
59
60 return res;